Commit e33fbf30a4697b23867a3cd728122a1475d6701f
1 parent
3b010273
Exists in
master
and in
3 other branches
Adding breadcrumb topic view update
Showing
2 changed files
with
28 additions
and
0 deletions
Show diff stats
amadeus/static/js/topics.js
1 | +$('.collapse').on('shown.bs.collapse', function (e) { | |
2 | + if($(this).is(e.target)){ | |
3 | + var li = $(".breadcrumb").find('li:last-child'); | |
4 | + var li_text = $(li).html(); | |
5 | + var url = $(".subs_url").val(); | |
6 | + var new_li = $(li).clone(); | |
7 | + | |
8 | + new_li.html($(this).parent().find('.panel-title').text()); | |
9 | + | |
10 | + $(li).html("<a href='" + url + "'>" + li_text + "</a>"); | |
11 | + $(li).append("<span class='divider'>/</span>"); | |
12 | + | |
13 | + new_li.appendTo('.breadcrumb'); | |
14 | + } | |
15 | +}); | |
16 | + | |
17 | +$('.collapse').on('hide.bs.collapse', function (e) { | |
18 | + if($(this).is(e.target)){ | |
19 | + $(".breadcrumb").find('li:last-child').remove(); | |
20 | + | |
21 | + var li = $(".breadcrumb").find('li:last-child'); | |
22 | + var text = $(li).find('a').text(); | |
23 | + | |
24 | + $(li).html(text); | |
25 | + } | |
26 | +}); | |
27 | + | |
1 | 28 | // utilizado para fazer a re-organização dos tópicos |
2 | 29 | $("#topics-accordion").sortable({ |
3 | 30 | delay: 100, | ... | ... |
topics/templates/topics/list.html
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | |
6 | 6 | <div class="panel-group subject-group" id="topics-accordion" role="tablist" aria-multiselectable="true"> |
7 | 7 | <input type="hidden" class="url_order" value="{% url 'topics:update_order' %}" /> |
8 | + <input type="hidden" class="subs_url" value="{% url 'subjects:view' subject.slug %}" /> | |
8 | 9 | {% for topic in subject.topic_subject.all %} |
9 | 10 | {% if not topic.repository and topic.visible or has_subject_permissions %} |
10 | 11 | <div class="panel panel-info {% if not topic.visible or topic.repository %} topic-panel-invisible {% else %} topic-panel {% endif %} topic-panel"> | ... | ... |