Commit ede6717b9f8ae1da747151f1bde218f883e68496
1 parent
bfdd320f
Exists in
master
and in
5 other branches
all courses to admin
Showing
4 changed files
with
24 additions
and
8 deletions
Show diff stats
courses/templates/category/index.html
... | ... | @@ -80,11 +80,10 @@ |
80 | 80 | <td>{{ category }}</td> |
81 | 81 | <td>{{ category.slug }}</td> |
82 | 82 | <td class="text-center"> |
83 | - <a href="{% url 'course:view_cat' category.slug %}" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-eye-open"></span></a> | |
84 | - <a href="{% url 'course:update_cat' category.slug %}" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-edit"></span></a> | |
85 | - <a href="javascript:modal.get('{% url 'course:delete_cat' category.slug %}','#category','#modal_category');" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span></a> | |
86 | - | |
87 | - </td> | |
83 | + <a href="{% url 'course:view_cat' category.slug %}" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-eye-open"></span></a> | |
84 | + <a href="{% url 'course:update_cat' category.slug %}" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-edit"></span></a> | |
85 | + <a href="javascript:modal.get('{% url 'course:delete_cat' category.slug %}','#category','#modal_category');" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span></a> | |
86 | + </td> | |
88 | 87 | </tr> |
89 | 88 | {% endfor %} |
90 | 89 | {% else %} | ... | ... |
courses/templates/course/index.html
... | ... | @@ -41,6 +41,21 @@ |
41 | 41 | </ul> |
42 | 42 | </div> |
43 | 43 | </div> |
44 | + | |
45 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
46 | + | |
47 | + <div class="panel panel-primary navigation"> | |
48 | + <div class="panel-heading"> | |
49 | + <h3 class="panel-title">Category</h3> | |
50 | + </div> | |
51 | + <div class="panel-body"> | |
52 | + <ul class="nav nav-pills nav-stacked"> | |
53 | + <li><a href="{% url 'course:create_cat' %}">Create Category</a></li> | |
54 | + <li><a href="{% url 'course:manage_cat' %}">List Category</a></li> | |
55 | + </ul> | |
56 | + </div> | |
57 | + </div> | |
58 | + {% endif %} | |
44 | 59 | {% endblock %} |
45 | 60 | |
46 | 61 | {% block content %} |
... | ... | @@ -92,7 +107,7 @@ |
92 | 107 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
93 | 108 | </button> |
94 | 109 | <ul class="dropdown-menu" aria-labelledby="moreActions"> |
95 | - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> Replicate</a></li> | |
110 | + <li><a href="" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> Replicate</a></li> | |
96 | 111 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeCourse"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> |
97 | 112 | </ul> |
98 | 113 | </div> | ... | ... |
courses/templates/course/view.html
courses/views.py
... | ... | @@ -34,9 +34,12 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): |
34 | 34 | context = super(IndexView, self).get_context_data(**kwargs) |
35 | 35 | list_courses = None |
36 | 36 | categorys_courses = None |
37 | - if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): | |
37 | + if has_role(self.request.user,'professor'): | |
38 | 38 | list_courses = Course.objects.filter(Q(professors = True)|Q(professors__name = self.request.user.name)).order_by('name') |
39 | 39 | categorys_courses = CourseCategory.objects.filter(course_category__professors__name = self.request.user.name).distinct() |
40 | + elif has_role(self.request.user,'system_admin'): | |
41 | + list_courses = queryset.order_by('name') | |
42 | + categorys_courses = CourseCategory.objects.all() | |
40 | 43 | else: |
41 | 44 | list_courses = Course.objects.filter(Q(students = True)|Q(students__name = self.request.user.name)).order_by('name') |
42 | 45 | categorys_courses = CourseCategory.objects.filter(course_category__students__name = self.request.user.name).distinct() | ... | ... |