-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sidebar box to navigate through learning path
...When viewing an item in that learning path
- Loading branch information
Showing
11 changed files
with
79 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var LearningPaths = { | ||
init: function () { | ||
$('.learning-path-topic-title').click(function () { | ||
const container = $(this).closest('.learning-path-topic'); | ||
const contents = container.find('.learning-path-topic-contents'); | ||
$(this).find('.expand-icon, .collapse-icon').toggleClass('collapse-icon').toggleClass('expand-icon'); | ||
contents.slideToggle(); | ||
}); | ||
|
||
if (window.location.hash) { | ||
var topic = $('.learning-path-topic' + window.location.hash); | ||
if (topic.length) { | ||
$('.learning-path-topic-title', topic).click(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module LearningPathsHelper | ||
|
||
def learning_path_breadcrumb_param(topic_link, topic_item) | ||
{ lp: [topic_link, topic_item].map(&:id).join(':') } | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
app/views/learning_path_topic_items/_learning_path_topic_item.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<% resource = learning_path_topic_item.resource %> | ||
<%= render partial: resource, locals: { collection_item: learning_path_topic_item } %> | ||
<% locals = local_assigns.merge(collection_item: local_assigns.delete(:learning_path_topic_item)) %> | ||
<%= render partial: resource, locals: locals %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<h4 class="nav-heading"><%= LearningPath.model_name.human %></h4> | ||
<div class="nav-block learning-path-navigation"> | ||
<%= link_to(topic_link.learning_path.title, topic_link.learning_path) %><br/> | ||
<%= topic_link.topic.title %> | ||
|
||
<%= item_comment(topic_item) %> | ||
|
||
<div> | ||
<% next_item = topic_item.next_item %> | ||
<% if next_item %> | ||
<strong><%= t('learning_paths.next_item') %>:</strong><br/> | ||
<%= link_to(next_item.resource.title, polymorphic_path(next_item.resource, **learning_path_breadcrumb_param(topic_link, next_item))) %> | ||
<% else %> | ||
<% next_topic = topic_link.next_topic %> | ||
<% if next_topic %> | ||
<strong><%= t('learning_paths.next_topic') %>:</strong><br/> | ||
<%= link_to(next_topic.topic.title, learning_path_path(next_topic.learning_path, anchor: "topic-#{next_topic.id}")) %> | ||
<% else %> | ||
<span class="empty"><%= t('learning_paths.end_of') %></span> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters