Commit 74cf290dbe7a94a5a633e1b2b2907b8563bb8f20

Authored by Zambom
1 parent 6ae31493

Adding pendencies subject breadcrumb and menu button active

amadeus/static/js/pendencies.js
... ... @@ -13,18 +13,40 @@ $('.pendencies-content').on('show.bs.collapse', function(e) {
13 13 }
14 14 });
15 15  
  16 +$('.pendencies-content').on('shown.bs.collapse', function (e) {
  17 + if($(this).is(e.target)){
  18 + var breadcrumb = $(".breadcrumb")[0];
  19 + var li = $(breadcrumb).find('li:last-child');
  20 + var li_text = $(li).html();
  21 + var url = $("#pend_url").val();
  22 + var new_li = $(li).clone();
  23 +
  24 + new_li.html($(this).parent().find('.panel-title').data('title'));
  25 +
  26 + $(li).html("<a href='" + url + "'>" + li_text + "</a>");
  27 + $(li).append("<span class='divider'>/</span>");
  28 +
  29 + new_li.appendTo(breadcrumb);
  30 + }
  31 +});
  32 +
16 33 $('.pendencies-content').on('hidden.bs.collapse', function(e) {
17   - if($(this).is(e.target)){
  34 + if($(this).is(e.target)){
18 35 var btn = $(this).parent().find('.fa-angle-down');
19 36  
20 37 btn = btn[0];
21 38  
22 39 $(btn).switchClass("fa-angle-down", "fa-angle-right", 250, "easeInOutQuad");
23   - }
24   -});
25 40  
26   -$('.pendencies-content').on('hidden.bs.collapse', function(e) {
27   - if($(this).is(e.target)){
  41 + var breadcrumb = $(".breadcrumb")[0];
  42 +
  43 + $(breadcrumb).find('li:last-child').remove();
  44 +
  45 + var li = $(breadcrumb).find('li:last-child');
  46 + var text = $(li).find('a').text();
  47 +
  48 + $(li).html(text);
  49 +
28 50 var panel_id = $(this).data('id'),
29 51 pendencies = $(this).find('.pendencies'),
30 52 history = $(this).find('.history'),
... ...
amadeus/templates/base.html
... ... @@ -185,7 +185,7 @@
185 185 <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Messages" %}">
186 186 <i class="fa fa-envelope-o" aria-hidden="true"></i>
187 187 </li>
188   - <li class="item action_icon" data-toggle="tooltip" data-placement="right" title="{% trans "Pendencias" %}">
  188 + <li class="item {{ pendencies_menu_active }} action_icon" data-toggle="tooltip" data-placement="right" title="{% trans "Pendencias" %}">
189 189 <a href="{% url 'notifications:manage' %}">
190 190 <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
191 191 {% if notifications_count > 0 %}
... ... @@ -234,7 +234,7 @@
234 234 <li class="item" data-toggle="tooltip" data-placement="top" title="{% trans "Messages" %}">
235 235 <i class="fa fa-envelope-o" aria-hidden="true"></i>
236 236 </li>
237   - <li class="item action_icon" data-toggle="tooltip" data-placement="top" title="{% trans "Pendencias" %}">
  237 + <li class="item {{ pendencies_menu_active }} action_icon" data-toggle="tooltip" data-placement="top" title="{% trans "Pendencias" %}">
238 238 <a href="{% url 'notifications:manage' %}">
239 239 <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
240 240 {% if notifications_count > 0 %}
... ...
notifications/templates/notifications/_view.html
... ... @@ -5,7 +5,7 @@
5 5 <div class="col-md-12">
6 6 <div class="panel panel-default">
7 7 <div class="pendency panel-body">
8   - <ul class="breadcrumb">
  8 + <ul class="breadcrumb pend-card">
9 9 <li>
10 10 <a href="">{% trans 'Home' %}</a>
11 11 </li>
... ...
notifications/templates/notifications/index.html
... ... @@ -10,6 +10,8 @@
10 10 {% endblock %}
11 11  
12 12 {% block content %}
  13 + <input type="hidden" id="pend_url" value="{% url 'notifications:manage' %}" />
  14 +
13 15 {% if notifications.count > 0 %}
14 16 <div class="panel-group" id="subject-accordion" role="tablist" aria-multiselectable="true">
15 17 {% for notification in notifications %}
... ... @@ -17,7 +19,7 @@
17 19 <div class="panel-heading">
18 20 <div class="row">
19 21 <div class="col-md-12 category-header">
20   - <h4 class="panel-title">
  22 + <h4 class="panel-title" data-title="{{ notification.task__resource__topic__subject__name }}">
21 23 <a class="category-course-link pull-left" data-parent="#subject-accordion" data-toggle="collapse" href="#subject_{{ notification.task__resource__topic__subject }}">
22 24 <button class="btn btn-default btn-xs text-center cat-selector"><i class="fa fa-angle-right fa-2x" aria-hidden="true"></i></button> {{ notification.task__resource__topic__subject__name }} ({{ notification.total }})
23 25 </a>
... ...
notifications/views.py
... ... @@ -143,6 +143,7 @@ class IndexView(LoginRequiredMixin, generic.ListView):
143 143 context = super(IndexView, self).get_context_data(**kwargs)
144 144  
145 145 context['title'] = _('Pendencies')
  146 + context['pendencies_menu_active'] = "subjects_menu_active"
146 147  
147 148 return context
148 149  
... ...