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,6 +79,7 @@ class AmadeusSettings(LoginRequiredMixin, HasRoleMixin, generic.CreateView): | ||
79 | def get_context_data(self, **kwargs): | 79 | def get_context_data(self, **kwargs): |
80 | context = super(AmadeusSettings, self).get_context_data(**kwargs) | 80 | context = super(AmadeusSettings, self).get_context_data(**kwargs) |
81 | context['page'] = self.kwargs.get('page') | 81 | context['page'] = self.kwargs.get('page') |
82 | + context['title'] = 'Settings' | ||
82 | if not self.request.method == 'POST': | 83 | if not self.request.method == 'POST': |
83 | try: | 84 | try: |
84 | setting = EmailBackend.objects.latest('id') | 85 | setting = EmailBackend.objects.latest('id') |
courses/templates/topic/index.html
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | </button> | 33 | </button> |
34 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | 34 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
35 | <li> | 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 | </li> | 37 | </li> |
38 | <li> | 38 | <li> |
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> | 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,6 +99,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): | ||
99 | list_courses = self.get_queryset().filter(students__in = [self.request.user]).order_by('name') | 99 | list_courses = self.get_queryset().filter(students__in = [self.request.user]).order_by('name') |
100 | 100 | ||
101 | context['categorys_courses'] = course_category(list_courses) | 101 | context['categorys_courses'] = course_category(list_courses) |
102 | + context['title'] = 'Courses' | ||
102 | return context | 103 | return context |
103 | 104 | ||
104 | class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView): | 105 | class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView): |
@@ -136,6 +137,7 @@ class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView): | @@ -136,6 +137,7 @@ class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView): | ||
136 | list_courses = self.get_queryset() | 137 | list_courses = self.get_queryset() |
137 | 138 | ||
138 | context['categorys_courses'] = course_category(list_courses) | 139 | context['categorys_courses'] = course_category(list_courses) |
140 | + context['title'] = 'All Courses' | ||
139 | 141 | ||
140 | return context | 142 | return context |
141 | 143 | ||
@@ -453,6 +455,11 @@ class IndexCatView(LoginRequiredMixin, generic.ListView): | @@ -453,6 +455,11 @@ class IndexCatView(LoginRequiredMixin, generic.ListView): | ||
453 | context_object_name = 'categories' | 455 | context_object_name = 'categories' |
454 | paginate_by = 10 | 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 | class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): | 463 | class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
457 | 464 | ||
458 | allowed_roles = ['professor', 'system_admin'] | 465 | allowed_roles = ['professor', 'system_admin'] |
@@ -467,6 +474,12 @@ class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): | @@ -467,6 +474,12 @@ class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): | ||
467 | messages.success(self.request, _('Category "%s" created successfully!')%(objeto)) | 474 | messages.success(self.request, _('Category "%s" created successfully!')%(objeto)) |
468 | return reverse_lazy('course:manage_cat') | 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 | class UpdateCatView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): | 483 | class UpdateCatView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
471 | 484 | ||
472 | allowed_roles = ['professor', 'system_admin'] | 485 | allowed_roles = ['professor', 'system_admin'] |
@@ -557,6 +570,7 @@ class SubjectsView(LoginRequiredMixin, LogMixin, generic.ListView): | @@ -557,6 +570,7 @@ class SubjectsView(LoginRequiredMixin, LogMixin, generic.ListView): | ||
557 | context['subject'] = subject | 570 | context['subject'] = subject |
558 | context['topics'] = Topic.objects.filter(subject = subject) | 571 | context['topics'] = Topic.objects.filter(subject = subject) |
559 | context['exercise'] = Exercise.objects.filter(topic__subject=subject) | 572 | context['exercise'] = Exercise.objects.filter(topic__subject=subject) |
573 | + context['title'] = subject.name | ||
560 | if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): | 574 | if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): |
561 | context['files'] = TopicFile.objects.filter(professor__name = self.request.user.name) | 575 | context['files'] = TopicFile.objects.filter(professor__name = self.request.user.name) |
562 | else: | 576 | else: |
@@ -645,6 +659,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): | @@ -645,6 +659,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): | ||
645 | context['students_activit'] = students_activit | 659 | context['students_activit'] = students_activit |
646 | context['materials'] = materials | 660 | context['materials'] = materials |
647 | context['form'] = ActivityForm | 661 | context['form'] = ActivityForm |
662 | + context['title'] = topic.name | ||
648 | 663 | ||
649 | return context | 664 | return context |
650 | 665 | ||
@@ -849,6 +864,7 @@ class UpdateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.Upda | @@ -849,6 +864,7 @@ class UpdateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.Upda | ||
849 | context['course'] = self.object.course | 864 | context['course'] = self.object.course |
850 | context['subject'] = self.object | 865 | context['subject'] = self.object |
851 | context['subjects'] = self.object.course.subjects.filter(Q(visible=True) | Q(professors__in=[self.request.user])) | 866 | context['subjects'] = self.object.course.subjects.filter(Q(visible=True) | Q(professors__in=[self.request.user])) |
867 | + context['title'] = self.object.name | ||
852 | if (has_role(self.request.user,'system_admin')): | 868 | if (has_role(self.request.user,'system_admin')): |
853 | context['subjects'] = self.object.course.subjects.all() | 869 | context['subjects'] = self.object.course.subjects.all() |
854 | return context | 870 | return context |
@@ -1027,7 +1043,7 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati | @@ -1027,7 +1043,7 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati | ||
1027 | allowed_roles = ['professor', 'system_admin'] | 1043 | allowed_roles = ['professor', 'system_admin'] |
1028 | login_url = reverse_lazy("core:home") | 1044 | login_url = reverse_lazy("core:home") |
1029 | redirect_field_name = 'next' | 1045 | redirect_field_name = 'next' |
1030 | - template_name = 'topic/replicate.html' | 1046 | + template_name = 'topic/replicate.htmTl' |
1031 | form_class = TopicForm | 1047 | form_class = TopicForm |
1032 | 1048 | ||
1033 | def get_success_url(self): | 1049 | def get_success_url(self): |
@@ -1041,6 +1057,7 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati | @@ -1041,6 +1057,7 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati | ||
1041 | context['subject'] = subject | 1057 | context['subject'] = subject |
1042 | context['subjects'] = subject.course.subjects.all() | 1058 | context['subjects'] = subject.course.subjects.all() |
1043 | context['topic'] = topic | 1059 | context['topic'] = topic |
1060 | + context['title'] = subject.name | ||
1044 | return context | 1061 | return context |
1045 | 1062 | ||
1046 | def form_valid(self, form): | 1063 | def form_valid(self, form): |
@@ -1095,6 +1112,7 @@ class ReplicateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, Notificat | @@ -1095,6 +1112,7 @@ class ReplicateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, Notificat | ||
1095 | context['course'] = course | 1112 | context['course'] = course |
1096 | context['subjects'] = course.subjects.filter(Q(visible=True) | Q(professors__in=[self.request.user])) | 1113 | context['subjects'] = course.subjects.filter(Q(visible=True) | Q(professors__in=[self.request.user])) |
1097 | context['subject'] = subject | 1114 | context['subject'] = subject |
1115 | + context['title'] = course.name | ||
1098 | if (has_role(self.request.user,'system_admin')): | 1116 | if (has_role(self.request.user,'system_admin')): |
1099 | context['subjects'] = course.subjects.all() | 1117 | context['subjects'] = course.subjects.all() |
1100 | return context | 1118 | return context |
users/views.py
@@ -45,6 +45,11 @@ class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): | @@ -45,6 +45,11 @@ class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): | ||
45 | 45 | ||
46 | return users | 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 | class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): | 53 | class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): |
49 | 54 | ||
50 | allowed_roles = ['system_admin'] | 55 | allowed_roles = ['system_admin'] |