Commit a35a580e437d0a139314422b49ef40632604cb26
1 parent
aa9c5b4a
Exists in
master
and in
5 other branches
Adding page title [Issue #429]
Showing
4 changed files
with
26 additions
and
2 deletions
Show diff stats
app/views.py
... | ... | @@ -79,6 +79,7 @@ class AmadeusSettings(LoginRequiredMixin, HasRoleMixin, generic.CreateView): |
79 | 79 | def get_context_data(self, **kwargs): |
80 | 80 | context = super(AmadeusSettings, self).get_context_data(**kwargs) |
81 | 81 | context['page'] = self.kwargs.get('page') |
82 | + context['title'] = 'Settings' | |
82 | 83 | if not self.request.method == 'POST': |
83 | 84 | try: |
84 | 85 | setting = EmailBackend.objects.latest('id') | ... | ... |
courses/templates/topic/index.html
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | </button> |
34 | 34 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
35 | 35 | <li> |
36 | - <a href="javascript:void(0)"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a> | |
36 | + <a href="{% url 'course:replicate_topic' topic.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a> | |
37 | 37 | </li> |
38 | 38 | <li> |
39 | 39 | <a href="{% url 'course:update_subject' subject.slug %}" data-toggle="modal" data-target="#editSubject"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a> | ... | ... |
courses/views.py
... | ... | @@ -99,6 +99,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): |
99 | 99 | list_courses = self.get_queryset().filter(students__in = [self.request.user]).order_by('name') |
100 | 100 | |
101 | 101 | context['categorys_courses'] = course_category(list_courses) |
102 | + context['title'] = 'Courses' | |
102 | 103 | return context |
103 | 104 | |
104 | 105 | class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView): |
... | ... | @@ -136,6 +137,7 @@ class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView): |
136 | 137 | list_courses = self.get_queryset() |
137 | 138 | |
138 | 139 | context['categorys_courses'] = course_category(list_courses) |
140 | + context['title'] = 'All Courses' | |
139 | 141 | |
140 | 142 | return context |
141 | 143 | |
... | ... | @@ -453,6 +455,11 @@ class IndexCatView(LoginRequiredMixin, generic.ListView): |
453 | 455 | context_object_name = 'categories' |
454 | 456 | paginate_by = 10 |
455 | 457 | |
458 | + def get_context_data (self, **kwargs): | |
459 | + context = super(IndexCatView, self).get_context_data(**kwargs) | |
460 | + context['title'] = 'Categories' | |
461 | + return context | |
462 | + | |
456 | 463 | class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
457 | 464 | |
458 | 465 | allowed_roles = ['professor', 'system_admin'] |
... | ... | @@ -467,6 +474,12 @@ class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
467 | 474 | messages.success(self.request, _('Category "%s" created successfully!')%(objeto)) |
468 | 475 | return reverse_lazy('course:manage_cat') |
469 | 476 | |
477 | + def get_context_data (self, **kwargs): | |
478 | + context = super(CreateCatView, self).get_context_data(**kwargs) | |
479 | + context['title'] = 'Create Category' | |
480 | + | |
481 | + return context | |
482 | + | |
470 | 483 | class UpdateCatView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
471 | 484 | |
472 | 485 | allowed_roles = ['professor', 'system_admin'] |
... | ... | @@ -557,6 +570,7 @@ class SubjectsView(LoginRequiredMixin, LogMixin, generic.ListView): |
557 | 570 | context['subject'] = subject |
558 | 571 | context['topics'] = Topic.objects.filter(subject = subject) |
559 | 572 | context['exercise'] = Exercise.objects.filter(topic__subject=subject) |
573 | + context['title'] = subject.name | |
560 | 574 | if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): |
561 | 575 | context['files'] = TopicFile.objects.filter(professor__name = self.request.user.name) |
562 | 576 | else: |
... | ... | @@ -645,6 +659,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): |
645 | 659 | context['students_activit'] = students_activit |
646 | 660 | context['materials'] = materials |
647 | 661 | context['form'] = ActivityForm |
662 | + context['title'] = topic.name | |
648 | 663 | |
649 | 664 | return context |
650 | 665 | |
... | ... | @@ -849,6 +864,7 @@ class UpdateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.Upda |
849 | 864 | context['course'] = self.object.course |
850 | 865 | context['subject'] = self.object |
851 | 866 | context['subjects'] = self.object.course.subjects.filter(Q(visible=True) | Q(professors__in=[self.request.user])) |
867 | + context['title'] = self.object.name | |
852 | 868 | if (has_role(self.request.user,'system_admin')): |
853 | 869 | context['subjects'] = self.object.course.subjects.all() |
854 | 870 | return context |
... | ... | @@ -1027,7 +1043,7 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati |
1027 | 1043 | allowed_roles = ['professor', 'system_admin'] |
1028 | 1044 | login_url = reverse_lazy("core:home") |
1029 | 1045 | redirect_field_name = 'next' |
1030 | - template_name = 'topic/replicate.html' | |
1046 | + template_name = 'topic/replicate.htmTl' | |
1031 | 1047 | form_class = TopicForm |
1032 | 1048 | |
1033 | 1049 | def get_success_url(self): |
... | ... | @@ -1041,6 +1057,7 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati |
1041 | 1057 | context['subject'] = subject |
1042 | 1058 | context['subjects'] = subject.course.subjects.all() |
1043 | 1059 | context['topic'] = topic |
1060 | + context['title'] = subject.name | |
1044 | 1061 | return context |
1045 | 1062 | |
1046 | 1063 | def form_valid(self, form): |
... | ... | @@ -1095,6 +1112,7 @@ class ReplicateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, Notificat |
1095 | 1112 | context['course'] = course |
1096 | 1113 | context['subjects'] = course.subjects.filter(Q(visible=True) | Q(professors__in=[self.request.user])) |
1097 | 1114 | context['subject'] = subject |
1115 | + context['title'] = course.name | |
1098 | 1116 | if (has_role(self.request.user,'system_admin')): |
1099 | 1117 | context['subjects'] = course.subjects.all() |
1100 | 1118 | return context | ... | ... |
users/views.py
... | ... | @@ -45,6 +45,11 @@ class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): |
45 | 45 | |
46 | 46 | return users |
47 | 47 | |
48 | + def get_context_data (self, **kwargs): | |
49 | + context = super(UsersListView, self).get_context_data(**kwargs) | |
50 | + context['title'] = 'Manage Users' | |
51 | + return context | |
52 | + | |
48 | 53 | class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): |
49 | 54 | |
50 | 55 | allowed_roles = ['system_admin'] | ... | ... |