Commit 8dfa451e35435a39e3e23c0ee6d7717b314681e4

Authored by Felipe Henrique de Almeida Bormann
1 parent df035675

added list categories on index and icons for notifications on cards

amadeus/static/css/base/amadeus.css
... ... @@ -22,8 +22,26 @@
22 22 #sidebar-menu > .item i {
23 23 margin-left: 15%;
24 24 }
  25 +
  26 +
25 27 /* side bar menu ends*/
26 28  
  29 +/* category app starts */
  30 +
  31 +.category-header > h4{
  32 + float:left;
  33 +}
  34 +
  35 +.category-header i{
  36 + color: white;
  37 + float:right;
  38 + font-size: 25px;
  39 + margin-left: 2%;
  40 +}
  41 +
  42 +
  43 +/* category app ends */
  44 +
27 45 .clearfix{
28 46 clear: both;
29 47 }
... ...
categories/templates/categories/category_card.html 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +{% load static i18n permission_tags %}
  2 +<div class="group course-card " id="course_{{course.slug}}">
  3 + <div class="panel panel-info">
  4 + <div class="panel-heading course">
  5 + <div class="row">
  6 + <div class="col-xs-6 col-md-6 titleTopic">
  7 + <a role="button" href="#">
  8 + <h4>{{course.name}}</h4>
  9 + </a>
  10 + </div>
  11 + {% if user|has_role:'professor' or user|has_role:'system_admin' %}
  12 + <div class="col-xs-6 col-md-6 divMoreActions" >
  13 + <div class="btn-group">
  14 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  15 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  16 + </button>
  17 + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">
  18 + <li><a href="#"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Replicate' %}</a></li>
  19 + <li><a href="#"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>{% trans 'Edit' %}</a></li>
  20 + <li><a href="#"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp;{% trans 'Remove' %}</a></li>
  21 + </ul>
  22 + </div>
  23 + </div>
  24 + {% elif user|has_role:'student' %}
  25 + {% if not request.user in course.students.all %}
  26 + <a onclick="subscribe($(this), '', {{ course.id}}, '{% trans 'Are you sure you want to subscribe to this course?' %}')"><button class="btn btn-sm btn-primary btn-raised pull-right">{% trans 'Subscribe' %}</button></a>
  27 + {% endif %}
  28 + {% endif %}
  29 + </div>
  30 + </div>
  31 + </div>
  32 +</div>
0 33 \ No newline at end of file
... ...
categories/templates/categories/home.html
... ... @@ -6,7 +6,7 @@
6 6  
7 7 {% block breadcrumbs %}
8 8 {% clear_breadcrumbs %}
9   - {% breadcrumb 'Home' 'app:index' %}
  9 + {% breadcrumb 'Home' 'categories:index' %}
10 10 {% endblock %}
11 11  
12 12  
... ...
categories/templates/categories/home_admin_content.html
1 1 {% load static i18n %}
2 2  
3   -{% for course in objects %}
  3 +{% for category in categories %}
4 4 <div class="panel panel-default courseHome">
5   - <br><h4>{{ course }}</h4>
  5 + <br><h4>{{ category }}</h4>
6 6 <a href="#" class="btn btn-outline-info">{% trans 'Edit' %}</a>
7 7 </div>
8 8 {% endfor %}
... ...
categories/templates/categories/home_teacher_student_content.html
... ... @@ -1,20 +0,0 @@
1   -{% load static i18n %}
2   -
3   -{% for notification in objects %}
4   -
5   -
6   - <div class="well timeLine">
7   -
8   - <div class="row">
9   - <div class="col-xs-2 col-md-1">
10   - <img class="imgTimeLine" src="{{ notification.actor.image_url }}">
11   - </div>
12   - <div class="col-xs-10 col-md-11">
13   - <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4>
14   - <p class="resource_inline">{{notification.message}} {% trans 'at' %} : <a href="#">{{ notification.action_resource.resource.name }}</a></p>
15   - <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p>
16   - </div>
17   - </div>
18   -</div>
19   -{% endfor %}
20   -
categories/templates/categories/list.html
1   -{% extends 'home.html' %}
  1 +{% extends 'categories/home.html' %}
2 2  
3 3 {% load static i18n permission_tags %}
4 4 {% load django_bootstrap_breadcrumbs %}
... ... @@ -10,7 +10,7 @@
10 10 {% block breadcrumbs %}
11 11  
12 12 {{ block.super }}
13   -{% breadcrumb 'categories' 'course:manage' %}
  13 +{% breadcrumb 'categories' 'categories:index' %}
14 14  
15 15 {% endblock %}
16 16  
... ... @@ -23,39 +23,38 @@
23 23 {% endfor %}
24 24 {% endif %}
25 25  
26   -<div class="col-md-12 cards-content">
27   - <form id="searchform" method="get" accept-charset="utf-8">
28   - <div class="input-group">
29   - <div class="form-group is-empty">
30   - <input type="text" class="form-control" placeholder="{% trans 'Search for categories' %}" name="q">
31   - </div>
32   - <span class="input-group-btn input-group-sm">
33   - <button type="submit" class="btn btn-fab btn-fab-mini">
34   - <i class="fa fa-search" aria-hidden="true"></i>
35   - </button>
36   - </span>
37   - </div>
38   - </form>
39   -</div>
  26 +
40 27 <!-- Code for listing categories -->
41 28 <div class="col-md-12 cards-content">
42   - {% for category in categorys_categories %}
  29 + {% for category in categories %}
43 30 <div class="panel-group course-card-group">
44   - <div class="panel panel-default">
  31 + <div class="panel panel-info">
45 32 <div class="panel-heading">
46 33 <div class="row">
47   - <div class="col-md-12">
  34 + <div class="col-md-12 category-header">
48 35 <h4 class="panel-title">
49 36 <a class="category-course-link" data-toggle="collapse" href="#{{category.slug}}">{{category.name}}</a>
50 37 </h4>
  38 +
  39 +
  40 + <a href=""><i class="fa fa-list" aria-hidden="true"></i></a>
  41 + <a href=""><i class="fa fa-envelope-o" aria-hidden="true"></i></a>
  42 +
  43 + <a href=""><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></a>
  44 +
  45 + <a href=""><i class="fa fa-bar-chart" aria-hidden="true"></i></a>
51 46 </div>
52 47 </div>
53 48 </div>
  49 + {% comment %}
  50 +
  51 +
54 52 <div id="{{category.slug}}" class="panel-collapse collapse">
55   - {% for course in category.course_category %}
56   - {% include "course/course_card.html" %}
  53 + {% for subject in subjects %}
  54 + {% include "categories/category_card.html" %}
57 55 {% endfor %}
58 56 </div>
  57 + {% endcomment %}
59 58 </div>
60 59 </div>
61 60 {% endfor %}
... ...
categories/templates/categories/notifications_timeline.html 0 → 100755
... ... @@ -0,0 +1,20 @@
  1 +{% load static i18n %}
  2 +
  3 +{% for notification in objects %}
  4 +
  5 +
  6 + <div class="well timeLine">
  7 +
  8 + <div class="row">
  9 + <div class="col-xs-2 col-md-1">
  10 + <img class="imgTimeLine" src="{{ notification.actor.image_url }}">
  11 + </div>
  12 + <div class="col-xs-10 col-md-11">
  13 + <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4>
  14 + <p class="resource_inline">{{notification.message}} {% trans 'at' %} : <a href="#">{{ notification.action_resource.resource.name }}</a></p>
  15 + <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p>
  16 + </div>
  17 + </div>
  18 +</div>
  19 +{% endfor %}
  20 +
... ...
categories/views.py
... ... @@ -16,7 +16,7 @@ class IndexView(LoginRequiredMixin, ListView):
16 16 login_url = reverse_lazy("users:login")
17 17 redirect_field_name = 'next'
18 18 queryset = Category.objects.all()
19   - template_name = 'categories/home.html'
  19 + template_name = 'categories/list.html'
20 20 context_object_name = 'categories'
21 21  
22 22  
... ... @@ -30,15 +30,15 @@ class IndexView(LoginRequiredMixin, ListView):
30 30 if self.request.user.is_staff:
31 31 context['page_template'] = "categories/home_admin_content.html"
32 32 else:
33   - context['page_template'] = "categories/home_teacher_student_content.html"
  33 + context['page_template'] = "categories/home_teacher_student.html"
34 34  
35 35 context['title'] = _('Home')
36 36  
37 37 if self.request.is_ajax():
38 38 if self.request.user.is_staff:
39   - self.template_name = "home_admin_content.html"
  39 + self.template_name = "categories/home_admin_content.html"
40 40 else:
41   - self.template_name = "home_teacher_student_content.html"
  41 + self.template_name = "categories/home_teacher_student_content.html"
42 42  
43 43 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs)
44 44  
... ... @@ -46,19 +46,19 @@ class IndexView(LoginRequiredMixin, ListView):
46 46 context = super(IndexView, self).get_context_data(**kwargs)
47 47 list_categories = None
48 48 if has_role(self.request.user,'system_admin'):
49   - list_categories = self.get_queryset().order_by('name')
50   - # categorys_categories = CourseCategory.objects.all()
  49 + categories = self.get_queryset().order_by('name')
  50 +
51 51 elif has_role(self.request.user,'professor'):
52 52 pass
53 53 #list_categories = self.get_queryset().filter(professors__in = [self.request.user]).order_by('name')
54 54 # categorys_categories = CourseCategory.objects.filter(course_category__professors__name = self.request.user.name).distinct()
55 55 elif has_role(self.request.user, 'student'):
56   - pass
57   - #list_categories = self.get_queryset().filter(students__in = [self.request.user]).order_by('name')
  56 + categories = self.get_queryset().order_by('name')
58 57  
59 58  
60 59 context['title'] = _('Categories')
61   -
  60 + context['categories'] = categories
  61 +
62 62 return context
63 63  
64 64 class CreateCategory(HasRoleMixin, CreateView):
... ...