diff --git a/amadeus/static/css/base/amadeus.css b/amadeus/static/css/base/amadeus.css index 956fd99..4675d40 100755 --- a/amadeus/static/css/base/amadeus.css +++ b/amadeus/static/css/base/amadeus.css @@ -22,8 +22,26 @@ #sidebar-menu > .item i { margin-left: 15%; } + + /* side bar menu ends*/ +/* category app starts */ + +.category-header > h4{ + float:left; +} + +.category-header i{ + color: white; + float:right; + font-size: 25px; + margin-left: 2%; +} + + +/* category app ends */ + .clearfix{ clear: both; } diff --git a/categories/templates/categories/category_card.html b/categories/templates/categories/category_card.html new file mode 100644 index 0000000..a372ed0 --- /dev/null +++ b/categories/templates/categories/category_card.html @@ -0,0 +1,32 @@ +{% load static i18n permission_tags %} +
+
+
+
+ + {% if user|has_role:'professor' or user|has_role:'system_admin' %} + + {% elif user|has_role:'student' %} + {% if not request.user in course.students.all %} + + {% endif %} + {% endif %} +
+
+
+
\ No newline at end of file diff --git a/categories/templates/categories/home.html b/categories/templates/categories/home.html index 4a28119..5890cb9 100755 --- a/categories/templates/categories/home.html +++ b/categories/templates/categories/home.html @@ -6,7 +6,7 @@ {% block breadcrumbs %} {% clear_breadcrumbs %} - {% breadcrumb 'Home' 'app:index' %} + {% breadcrumb 'Home' 'categories:index' %} {% endblock %} diff --git a/categories/templates/categories/home_admin_content.html b/categories/templates/categories/home_admin_content.html index 0ac29ac..215f93b 100755 --- a/categories/templates/categories/home_admin_content.html +++ b/categories/templates/categories/home_admin_content.html @@ -1,8 +1,8 @@ {% load static i18n %} -{% for course in objects %} +{% for category in categories %}
-

{{ course }}

+

{{ category }}

{% trans 'Edit' %}
{% endfor %} diff --git a/categories/templates/categories/home_teacher_student_content.html b/categories/templates/categories/home_teacher_student_content.html deleted file mode 100755 index c98ccb3..0000000 --- a/categories/templates/categories/home_teacher_student_content.html +++ /dev/null @@ -1,20 +0,0 @@ -{% load static i18n %} - -{% for notification in objects %} - - -
- -
-
- -
-
-

{{ notification.actor.username }}

-

{{notification.message}} {% trans 'at' %} : {{ notification.action_resource.resource.name }}

-

{{ notification.datetime|timesince }} {% trans "ago" %}

-
-
-
-{% endfor %} - diff --git a/categories/templates/categories/list.html b/categories/templates/categories/list.html index 8f55800..21694d7 100755 --- a/categories/templates/categories/list.html +++ b/categories/templates/categories/list.html @@ -1,4 +1,4 @@ -{% extends 'home.html' %} +{% extends 'categories/home.html' %} {% load static i18n permission_tags %} {% load django_bootstrap_breadcrumbs %} @@ -10,7 +10,7 @@ {% block breadcrumbs %} {{ block.super }} -{% breadcrumb 'categories' 'course:manage' %} +{% breadcrumb 'categories' 'categories:index' %} {% endblock %} @@ -23,39 +23,38 @@ {% endfor %} {% endif %} -
-
-
-
- -
- - - -
-
-
+
- {% for category in categorys_categories %} + {% for category in categories %}
-
+
-
+

{{category.name}}

+ + + + + + + +
+ {% comment %} + +
- {% for course in category.course_category %} - {% include "course/course_card.html" %} + {% for subject in subjects %} + {% include "categories/category_card.html" %} {% endfor %}
+ {% endcomment %}
{% endfor %} diff --git a/categories/templates/categories/notifications_timeline.html b/categories/templates/categories/notifications_timeline.html new file mode 100755 index 0000000..c98ccb3 --- /dev/null +++ b/categories/templates/categories/notifications_timeline.html @@ -0,0 +1,20 @@ +{% load static i18n %} + +{% for notification in objects %} + + +
+ +
+
+ +
+
+

{{ notification.actor.username }}

+

{{notification.message}} {% trans 'at' %} : {{ notification.action_resource.resource.name }}

+

{{ notification.datetime|timesince }} {% trans "ago" %}

+
+
+
+{% endfor %} + diff --git a/categories/views.py b/categories/views.py index ae96c8a..c4e314f 100644 --- a/categories/views.py +++ b/categories/views.py @@ -16,7 +16,7 @@ class IndexView(LoginRequiredMixin, ListView): login_url = reverse_lazy("users:login") redirect_field_name = 'next' queryset = Category.objects.all() - template_name = 'categories/home.html' + template_name = 'categories/list.html' context_object_name = 'categories' @@ -30,15 +30,15 @@ class IndexView(LoginRequiredMixin, ListView): if self.request.user.is_staff: context['page_template'] = "categories/home_admin_content.html" else: - context['page_template'] = "categories/home_teacher_student_content.html" + context['page_template'] = "categories/home_teacher_student.html" context['title'] = _('Home') if self.request.is_ajax(): if self.request.user.is_staff: - self.template_name = "home_admin_content.html" + self.template_name = "categories/home_admin_content.html" else: - self.template_name = "home_teacher_student_content.html" + self.template_name = "categories/home_teacher_student_content.html" return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) @@ -46,19 +46,19 @@ class IndexView(LoginRequiredMixin, ListView): context = super(IndexView, self).get_context_data(**kwargs) list_categories = None if has_role(self.request.user,'system_admin'): - list_categories = self.get_queryset().order_by('name') - # categorys_categories = CourseCategory.objects.all() + categories = self.get_queryset().order_by('name') + elif has_role(self.request.user,'professor'): pass #list_categories = self.get_queryset().filter(professors__in = [self.request.user]).order_by('name') # categorys_categories = CourseCategory.objects.filter(course_category__professors__name = self.request.user.name).distinct() elif has_role(self.request.user, 'student'): - pass - #list_categories = self.get_queryset().filter(students__in = [self.request.user]).order_by('name') + categories = self.get_queryset().order_by('name') context['title'] = _('Categories') - + context['categories'] = categories + return context class CreateCategory(HasRoleMixin, CreateView): -- libgit2 0.21.2