Commit 38b975450d4473ac727727f0f281bff0050e7f15
1 parent
f0122ea8
Exists in
master
and in
5 other branches
created course's category #142
Showing
3 changed files
with
29 additions
and
16 deletions
Show diff stats
courses/templates/category/create.html
1 | {% extends 'app/base.html' %} | 1 | {% extends 'app/base.html' %} |
2 | 2 | ||
3 | -{% load static i18n %} | 3 | +{% load static i18n permission_tags %} |
4 | {% load widget_tweaks %} | 4 | {% load widget_tweaks %} |
5 | 5 | ||
6 | {% block breadcrumbs %} | 6 | {% block breadcrumbs %} |
@@ -11,20 +11,37 @@ | @@ -11,20 +11,37 @@ | ||
11 | {% endblock %} | 11 | {% endblock %} |
12 | 12 | ||
13 | {% block sidebar %} | 13 | {% block sidebar %} |
14 | - <div class="list-group"> | ||
15 | - <a href="{% url 'course:manage_cat' %}" class="list-group-item"> | ||
16 | - {% trans 'Categories' %} | ||
17 | - </a> | 14 | + <div class="panel panel-primary navigation"> |
15 | + <div class="panel-heading"> | ||
16 | + <h5>{% trans 'Menu' %}</h5> | ||
17 | + </div> | ||
18 | + <div class="panel-body"> | ||
19 | + <ul class="nav nav-pills nav-stacked"> | ||
20 | + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> | ||
21 | + <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> | ||
22 | + </ul> | ||
23 | + </div> | ||
24 | + </div> | ||
25 | + | ||
26 | +{% if user|has_role:'professor, system_admin' %} | ||
27 | + | ||
28 | + <div class="panel panel-primary navigation"> | ||
29 | + <div class="panel-heading"> | ||
30 | + <h3 class="panel-title">Actions</h3> | ||
31 | + </div> | ||
32 | + <div class="panel-body"> | ||
33 | + <ul class="nav nav-pills nav-stacked"> | ||
34 | + <li><a href="javascript:void(0)">Replicate Course</a></li> | ||
35 | + <li><a href="{% url 'course:create' %}">Create Course</a></li> | ||
36 | + <li><a href="{% url 'course:create_cat' %}">Create Category</a></li> | ||
37 | + </ul> | ||
38 | + </div> | ||
18 | </div> | 39 | </div> |
40 | +{% endif %} | ||
41 | + | ||
19 | {% endblock %} | 42 | {% endblock %} |
20 | 43 | ||
21 | {% block content %} | 44 | {% block content %} |
22 | - <div class="alert alert-info alert-dismissible" role="alert"> | ||
23 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
24 | - <span aria-hidden="true">×</span> | ||
25 | - </button> | ||
26 | - <p>{% trans 'All fields are required' %}</p> | ||
27 | - </div> | ||
28 | 45 | ||
29 | <form method="post" action=""> | 46 | <form method="post" action=""> |
30 | {% csrf_token %} | 47 | {% csrf_token %} |
courses/templates/course/index.html
@@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
33 | <ul class="nav nav-pills nav-stacked"> | 33 | <ul class="nav nav-pills nav-stacked"> |
34 | <li><a href="javascript:void(0)">Replicate Course</a></li> | 34 | <li><a href="javascript:void(0)">Replicate Course</a></li> |
35 | <li><a href="{% url 'course:create' %}">Create Course</a></li> | 35 | <li><a href="{% url 'course:create' %}">Create Course</a></li> |
36 | + <li><a href="{% url 'course:create_cat' %}">Create Category</a></li> | ||
36 | </ul> | 37 | </ul> |
37 | </div> | 38 | </div> |
38 | </div> | 39 | </div> |
courses/views.py
@@ -216,11 +216,6 @@ class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): | @@ -216,11 +216,6 @@ class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): | ||
216 | form_class = CategoryCourseForm | 216 | form_class = CategoryCourseForm |
217 | success_url = reverse_lazy('course:manage_cat') | 217 | success_url = reverse_lazy('course:manage_cat') |
218 | 218 | ||
219 | - def render_to_response(self, context, **response_kwargs): | ||
220 | - messages.success(self.request, _('Category created successfully!')) | ||
221 | - | ||
222 | - return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine) | ||
223 | - | ||
224 | class UpdateCatView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): | 219 | class UpdateCatView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
225 | 220 | ||
226 | allowed_roles = ['professor', 'system_admin'] | 221 | allowed_roles = ['professor', 'system_admin'] |