Commit 74cf290dbe7a94a5a633e1b2b2907b8563bb8f20
1 parent
6ae31493
Exists in
master
and in
3 other branches
Adding pendencies subject breadcrumb and menu button active
Showing
5 changed files
with
34 additions
and
9 deletions
Show diff stats
amadeus/static/js/pendencies.js
| @@ -13,18 +13,40 @@ $('.pendencies-content').on('show.bs.collapse', function(e) { | @@ -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 | $('.pendencies-content').on('hidden.bs.collapse', function(e) { | 33 | $('.pendencies-content').on('hidden.bs.collapse', function(e) { |
| 17 | - if($(this).is(e.target)){ | 34 | + if($(this).is(e.target)){ |
| 18 | var btn = $(this).parent().find('.fa-angle-down'); | 35 | var btn = $(this).parent().find('.fa-angle-down'); |
| 19 | 36 | ||
| 20 | btn = btn[0]; | 37 | btn = btn[0]; |
| 21 | 38 | ||
| 22 | $(btn).switchClass("fa-angle-down", "fa-angle-right", 250, "easeInOutQuad"); | 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 | var panel_id = $(this).data('id'), | 50 | var panel_id = $(this).data('id'), |
| 29 | pendencies = $(this).find('.pendencies'), | 51 | pendencies = $(this).find('.pendencies'), |
| 30 | history = $(this).find('.history'), | 52 | history = $(this).find('.history'), |
amadeus/templates/base.html
| @@ -185,7 +185,7 @@ | @@ -185,7 +185,7 @@ | ||
| 185 | <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Messages" %}"> | 185 | <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Messages" %}"> |
| 186 | <i class="fa fa-envelope-o" aria-hidden="true"></i> | 186 | <i class="fa fa-envelope-o" aria-hidden="true"></i> |
| 187 | </li> | 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 | <a href="{% url 'notifications:manage' %}"> | 189 | <a href="{% url 'notifications:manage' %}"> |
| 190 | <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> | 190 | <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> |
| 191 | {% if notifications_count > 0 %} | 191 | {% if notifications_count > 0 %} |
| @@ -234,7 +234,7 @@ | @@ -234,7 +234,7 @@ | ||
| 234 | <li class="item" data-toggle="tooltip" data-placement="top" title="{% trans "Messages" %}"> | 234 | <li class="item" data-toggle="tooltip" data-placement="top" title="{% trans "Messages" %}"> |
| 235 | <i class="fa fa-envelope-o" aria-hidden="true"></i> | 235 | <i class="fa fa-envelope-o" aria-hidden="true"></i> |
| 236 | </li> | 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 | <a href="{% url 'notifications:manage' %}"> | 238 | <a href="{% url 'notifications:manage' %}"> |
| 239 | <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> | 239 | <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> |
| 240 | {% if notifications_count > 0 %} | 240 | {% if notifications_count > 0 %} |
notifications/templates/notifications/_view.html
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | <div class="col-md-12"> | 5 | <div class="col-md-12"> |
| 6 | <div class="panel panel-default"> | 6 | <div class="panel panel-default"> |
| 7 | <div class="pendency panel-body"> | 7 | <div class="pendency panel-body"> |
| 8 | - <ul class="breadcrumb"> | 8 | + <ul class="breadcrumb pend-card"> |
| 9 | <li> | 9 | <li> |
| 10 | <a href="">{% trans 'Home' %}</a> | 10 | <a href="">{% trans 'Home' %}</a> |
| 11 | </li> | 11 | </li> |
notifications/templates/notifications/index.html
| @@ -10,6 +10,8 @@ | @@ -10,6 +10,8 @@ | ||
| 10 | {% endblock %} | 10 | {% endblock %} |
| 11 | 11 | ||
| 12 | {% block content %} | 12 | {% block content %} |
| 13 | + <input type="hidden" id="pend_url" value="{% url 'notifications:manage' %}" /> | ||
| 14 | + | ||
| 13 | {% if notifications.count > 0 %} | 15 | {% if notifications.count > 0 %} |
| 14 | <div class="panel-group" id="subject-accordion" role="tablist" aria-multiselectable="true"> | 16 | <div class="panel-group" id="subject-accordion" role="tablist" aria-multiselectable="true"> |
| 15 | {% for notification in notifications %} | 17 | {% for notification in notifications %} |
| @@ -17,7 +19,7 @@ | @@ -17,7 +19,7 @@ | ||
| 17 | <div class="panel-heading"> | 19 | <div class="panel-heading"> |
| 18 | <div class="row"> | 20 | <div class="row"> |
| 19 | <div class="col-md-12 category-header"> | 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 | <a class="category-course-link pull-left" data-parent="#subject-accordion" data-toggle="collapse" href="#subject_{{ notification.task__resource__topic__subject }}"> | 23 | <a class="category-course-link pull-left" data-parent="#subject-accordion" data-toggle="collapse" href="#subject_{{ notification.task__resource__topic__subject }}"> |
| 22 | <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 }}) | 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 | </a> | 25 | </a> |
notifications/views.py
| @@ -143,6 +143,7 @@ class IndexView(LoginRequiredMixin, generic.ListView): | @@ -143,6 +143,7 @@ class IndexView(LoginRequiredMixin, generic.ListView): | ||
| 143 | context = super(IndexView, self).get_context_data(**kwargs) | 143 | context = super(IndexView, self).get_context_data(**kwargs) |
| 144 | 144 | ||
| 145 | context['title'] = _('Pendencies') | 145 | context['title'] = _('Pendencies') |
| 146 | + context['pendencies_menu_active'] = "subjects_menu_active" | ||
| 146 | 147 | ||
| 147 | return context | 148 | return context |
| 148 | 149 |