Commit a143d808302ec73c9cc6a54245a04e8bee39d5f2
1 parent
279160e9
Exists in
master
and in
3 other branches
Adjusts
Showing
7 changed files
with
34 additions
and
26 deletions
Show diff stats
amadeus/static/css/base/amadeus.css
@@ -37,6 +37,10 @@ | @@ -37,6 +37,10 @@ | ||
37 | color: white; | 37 | color: white; |
38 | } | 38 | } |
39 | 39 | ||
40 | +#sidebar-menu > .subjects_menu_active { | ||
41 | + background-color: #00695C; | ||
42 | +} | ||
43 | + | ||
40 | #sidebar-menu > .item:hover{ | 44 | #sidebar-menu > .item:hover{ |
41 | background-color: #00695C; | 45 | background-color: #00695C; |
42 | } | 46 | } |
@@ -109,23 +113,25 @@ | @@ -109,23 +113,25 @@ | ||
109 | } | 113 | } |
110 | 114 | ||
111 | #core-subjects-options-div{ | 115 | #core-subjects-options-div{ |
112 | - width: 100%; | 116 | + width: 100%; |
113 | margin-bottom: 2%; | 117 | margin-bottom: 2%; |
114 | height: 30px; | 118 | height: 30px; |
115 | } | 119 | } |
116 | 120 | ||
117 | .core-subjects-options li{ | 121 | .core-subjects-options li{ |
118 | - float:left; | ||
119 | - padding: 10px; | ||
120 | - background-color: #FFFFFF; | ||
121 | - margin: 1px; | ||
122 | - | 122 | + float:left; |
123 | + padding: 10px; | ||
124 | + background-color: #FFFFFF; | ||
125 | + margin: 1px; | ||
123 | border-bottom: 10px; | 126 | border-bottom: 10px; |
124 | border-bottom-style: solid; | 127 | border-bottom-style: solid; |
128 | + border-bottom-color: #D2D2D2; | ||
129 | + color: #A0A0A0; | ||
125 | } | 130 | } |
126 | 131 | ||
127 | .core-subjects-options li.active{ | 132 | .core-subjects-options li.active{ |
128 | - border-bottom-color: green; | 133 | + color: inherit; |
134 | + border-bottom-color: green; | ||
129 | } | 135 | } |
130 | 136 | ||
131 | #delete-category-footer{ | 137 | #delete-category-footer{ |
amadeus/templates/base.html
@@ -142,7 +142,7 @@ | @@ -142,7 +142,7 @@ | ||
142 | <div id="sidebar-menu-div" class="col-xs-1 col-sm-1 col-md-1 col-lg-1 col-xl-1"> | 142 | <div id="sidebar-menu-div" class="col-xs-1 col-sm-1 col-md-1 col-lg-1 col-xl-1"> |
143 | {% block sidebar %} | 143 | {% block sidebar %} |
144 | <ul id="sidebar-menu"> | 144 | <ul id="sidebar-menu"> |
145 | - <li class="item" id="subjects-link" data-toggle="tooltip" data-placement="right" title="{% trans "Subjects" %}"> | 145 | + <li class="item {{ subjects_menu_active }}" id="subjects-link" data-toggle="tooltip" data-placement="right" title="{% trans "Subjects" %}"> |
146 | <a href="{% url 'subjects:index' %}"> | 146 | <a href="{% url 'subjects:index' %}"> |
147 | <i class="fa fa-graduation-cap" aria-hidden="true"></i> | 147 | <i class="fa fa-graduation-cap" aria-hidden="true"></i> |
148 | </a> | 148 | </a> |
categories/templates/categories/home.html
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | 4 | ||
5 | {% block breadcrumbs %} | 5 | {% block breadcrumbs %} |
6 | {% clear_breadcrumbs %} | 6 | {% clear_breadcrumbs %} |
7 | - {% breadcrumb 'Home' 'categories:index' %} | 7 | + {% breadcrumb 'Home' 'subjects:home' %} |
8 | {% endblock %} | 8 | {% endblock %} |
9 | 9 | ||
10 | {% block style %} | 10 | {% block style %} |
categories/templates/categories/list.html
categories/views.py
@@ -110,6 +110,7 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat | @@ -110,6 +110,7 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat | ||
110 | context['settings_menu_active'] = "settings_menu_active" | 110 | context['settings_menu_active'] = "settings_menu_active" |
111 | else: | 111 | else: |
112 | context['template_extends'] = 'subjects/list.html' | 112 | context['template_extends'] = 'subjects/list.html' |
113 | + context['subjects_menu_active'] = 'subjects_menu_active'; | ||
113 | 114 | ||
114 | return context | 115 | return context |
115 | 116 | ||
@@ -198,6 +199,7 @@ class UpdateCategory(LogMixin, UpdateView): | @@ -198,6 +199,7 @@ class UpdateCategory(LogMixin, UpdateView): | ||
198 | context['settings_menu_active'] = "settings_menu_active" | 199 | context['settings_menu_active'] = "settings_menu_active" |
199 | else: | 200 | else: |
200 | context['template_extends'] = 'subjects/list.html' | 201 | context['template_extends'] = 'subjects/list.html' |
202 | + context['subjects_menu_active'] = 'subjects_menu_active'; | ||
201 | 203 | ||
202 | return context | 204 | return context |
203 | 205 |
subjects/templates/subjects/list.html
1 | -{% extends 'base.html' %} | 1 | +{% extends 'categories/home.html' %} |
2 | 2 | ||
3 | {% load static i18n permission_tags %} | 3 | {% load static i18n permission_tags %} |
4 | {% load django_bootstrap_breadcrumbs %} | 4 | {% load django_bootstrap_breadcrumbs %} |
@@ -28,10 +28,10 @@ | @@ -28,10 +28,10 @@ | ||
28 | <ul class="core-subjects-options"> | 28 | <ul class="core-subjects-options"> |
29 | {% if all %} | 29 | {% if all %} |
30 | <a href="{% url 'subjects:index' %}"><li >{% trans "My subjects" %}</li></a> | 30 | <a href="{% url 'subjects:index' %}"><li >{% trans "My subjects" %}</li></a> |
31 | - <a href="{% url 'subjects:index' 'all' %}" ><li class="active">{% trans "all subjects" %}</li></a> | 31 | + <a href="{% url 'subjects:index' 'all' %}" ><li class="active">{% trans "All subjects" %}</li></a> |
32 | {% else %} | 32 | {% else %} |
33 | <a href="{% url 'subjects:index' %}"><li class="active">{% trans "My subjects" %}</li></a> | 33 | <a href="{% url 'subjects:index' %}"><li class="active">{% trans "My subjects" %}</li></a> |
34 | - <a href="{% url 'subjects:index' 'all' %}" ><li>{% trans "all subjects" %}</li></a> | 34 | + <a href="{% url 'subjects:index' 'all' %}" ><li>{% trans "All subjects" %}</li></a> |
35 | {% endif %} | 35 | {% endif %} |
36 | 36 | ||
37 | </ul> | 37 | </ul> |
subjects/views.py
@@ -81,7 +81,7 @@ class IndexView(LoginRequiredMixin, ListView): | @@ -81,7 +81,7 @@ class IndexView(LoginRequiredMixin, ListView): | ||
81 | else: | 81 | else: |
82 | context['page_template'] = "categories/home_teacher_student.html" | 82 | context['page_template'] = "categories/home_teacher_student.html" |
83 | 83 | ||
84 | - context['title'] = _('Categories') | 84 | + |
85 | 85 | ||
86 | if self.request.is_ajax(): | 86 | if self.request.is_ajax(): |
87 | if self.request.user.is_staff: | 87 | if self.request.user.is_staff: |
@@ -93,34 +93,31 @@ class IndexView(LoginRequiredMixin, ListView): | @@ -93,34 +93,31 @@ class IndexView(LoginRequiredMixin, ListView): | ||
93 | 93 | ||
94 | def get_context_data(self, **kwargs): | 94 | def get_context_data(self, **kwargs): |
95 | context = super(IndexView, self).get_context_data(**kwargs) | 95 | context = super(IndexView, self).get_context_data(**kwargs) |
96 | - if self.request.user.is_staff: | ||
97 | - categories = self.get_queryset().order_by('name').filter(visible=True) | ||
98 | 96 | ||
99 | - context['all'] = False | 97 | + context['all'] = False |
98 | + context['title'] = _('My Subjects') | ||
100 | 99 | ||
101 | - if self.kwargs.get('option'): | ||
102 | - context['all'] = True | 100 | + if self.kwargs.get('option'): |
101 | + context['all'] = True | ||
102 | + context['title'] = _('All Subjects') | ||
103 | 103 | ||
104 | + if self.request.user.is_staff: | ||
105 | + categories = self.get_queryset().order_by('name').filter(visible=True) | ||
104 | else: | 106 | else: |
105 | if self.kwargs.get('option'): | 107 | if self.kwargs.get('option'): |
106 | categories = self.get_queryset().order_by('name').filter(visible=True) | 108 | categories = self.get_queryset().order_by('name').filter(visible=True) |
107 | - context['all'] = True | ||
108 | for category in categories: | 109 | for category in categories: |
109 | category.subjects = Subject.objects.filter(category= category) | 110 | category.subjects = Subject.objects.filter(category= category) |
110 | else: | 111 | else: |
111 | - context['all'] = False | ||
112 | categories = self.get_queryset().filter(visible=True) | 112 | categories = self.get_queryset().filter(visible=True) |
113 | for category in categories: | 113 | for category in categories: |
114 | category.subjects = Subject.objects.filter(category= category) | 114 | category.subjects = Subject.objects.filter(category= category) |
115 | 115 | ||
116 | categories = [category for category in categories if category.subjects.count() > 0 or self.request.user in category.coordinators.all()] | 116 | categories = [category for category in categories if category.subjects.count() > 0 or self.request.user in category.coordinators.all()] |
117 | #So I remove all categories that doesn't have the possibility for the user to be on | 117 | #So I remove all categories that doesn't have the possibility for the user to be on |
118 | - | ||
119 | - | ||
120 | - | ||
121 | - | ||
122 | 118 | ||
123 | context['categories'] = categories | 119 | context['categories'] = categories |
120 | + context['subjects_menu_active'] = 'subjects_menu_active'; | ||
124 | 121 | ||
125 | return context | 122 | return context |
126 | 123 | ||
@@ -142,8 +139,11 @@ class SubjectCreateView(CreateView): | @@ -142,8 +139,11 @@ class SubjectCreateView(CreateView): | ||
142 | def get_context_data(self, **kwargs): | 139 | def get_context_data(self, **kwargs): |
143 | context = super(SubjectCreateView, self).get_context_data(**kwargs) | 140 | context = super(SubjectCreateView, self).get_context_data(**kwargs) |
144 | context['slug'] = self.kwargs['slug'] | 141 | context['slug'] = self.kwargs['slug'] |
145 | - context['template_extends'] = 'categories/list.html' | 142 | + context['template_extends'] = 'subjects/list.html' |
143 | + context['subjects_menu_active'] = 'subjects_menu_active'; | ||
144 | + | ||
146 | return context | 145 | return context |
146 | + | ||
147 | def form_valid(self, form): | 147 | def form_valid(self, form): |
148 | 148 | ||
149 | self.object = form.save() | 149 | self.object = form.save() |