Commit 36dafe0a7fe83708c11221951c8ab504bc2b7598

Authored by ailsoncgt
2 parents cf4a154a 281db0a0

Merge

amadeus/uploads/sistemas-de-informacao/algoritmo/topico-1/Riachuelo_Outubro.pdf 0 → 100644
No preview for this file type
app/templates/home.html
@@ -80,8 +80,9 @@ @@ -80,8 +80,9 @@
80 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> 80 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
81 {% if user|has_role:'student' or not user.is_staff %} 81 {% if user|has_role:'student' or not user.is_staff %}
82 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li> 82 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
  83 + <li><a href="{% url 'course:all_courses' %}">{% trans 'All Courses' %}</a></li>
83 {% endif %} 84 {% endif %}
84 - <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li> 85 + <li><a href="{% url 'core:guest' %}">{% trans 'Courses' %}</a></li>
85 {% if user|has_role:'system_admin' %} 86 {% if user|has_role:'system_admin' %}
86 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> 87 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
87 <li> <a href="{% url 'app:settings' %}">{% trans 'Settings' %}</a></li> 88 <li> <a href="{% url 'app:settings' %}">{% trans 'Settings' %}</a></li>
app/templates/home_student.html
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <ul class="nav nav-pills nav-stacked"> 24 <ul class="nav nav-pills nav-stacked">
25 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> 25 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
26 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> 26 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
27 - <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li> 27 + <li><a href="{% url 'course:all_courses' %}">{% trans 'All Courses' %}</a></li>
28 <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li> 28 <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li>
29 </ul> 29 </ul>
30 </div> 30 </div>
core/static/css/base/amadeus.css
@@ -18,7 +18,10 @@ @@ -18,7 +18,10 @@
18 overflow: auto; 18 overflow: auto;
19 width: 300px; 19 width: 300px;
20 } 20 }
21 - 21 +#NavBarSearch{
  22 + position: absolute;
  23 + left: 30%;
  24 + }
22 .user-notification-img{ 25 .user-notification-img{
23 width:40%; 26 width:40%;
24 } 27 }
@@ -408,7 +411,6 @@ ul, li { @@ -408,7 +411,6 @@ ul, li {
408 .dropdown-menu .pull-right { 411 .dropdown-menu .pull-right {
409 right: 0; 412 right: 0;
410 } 413 }
411 - .editation{display: none}  
412 .moreAccordion{ padding-left: 0px; padding-right: 0px;} 414 .moreAccordion{ padding-left: 0px; padding-right: 0px;}
413 .moreAccordion div button{ padding-left: 0px; padding-right: 0px;} 415 .moreAccordion div button{ padding-left: 0px; padding-right: 0px;}
414 .cards-content{ padding-left: 0px; padding-right: 0px; } 416 .cards-content{ padding-left: 0px; padding-right: 0px; }
@@ -421,4 +423,4 @@ ul, li { @@ -421,4 +423,4 @@ ul, li {
421 /* Menu link remove radius */ 423 /* Menu link remove radius */
422 .nav-pills > li > a { 424 .nav-pills > li > a {
423 border-radius: 0px; 425 border-radius: 0px;
424 -}  
425 \ No newline at end of file 426 \ No newline at end of file
  427 +}
core/templates/base.html
@@ -72,6 +72,19 @@ @@ -72,6 +72,19 @@
72 <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a> 72 <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
73 </div> 73 </div>
74 <div class="navbar-collapse collapse navbar-responsive-collapse"> 74 <div class="navbar-collapse collapse navbar-responsive-collapse">
  75 + <div class="col-md-5 cards-content" id= 'NavBarSearch'>
  76 + <form id="SearchForm" action="#" method="get" accept-charset="utf-8">
  77 + <div class="input-group">
  78 + <div class="form-group is-empty" >
  79 + <input type="text" class="form-control" placeholder="{% trans 'Search Files (.pdf, others) and/or activities' %}" name="search"></div>
  80 + <span class="input-group-btn input-group-sm">
  81 + <button type="submit" class="btn btn-fab btn-fab-mini">
  82 + <i class="fa fa-search" aria-hidden="true"></i>
  83 + </button>
  84 + </span>
  85 + </div>
  86 + </form>
  87 + </div>
75 <ul class="nav navbar-nav navbar-right notifications"> 88 <ul class="nav navbar-nav navbar-right notifications">
76 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> 89 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
77 <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a> 90 <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
@@ -111,8 +124,9 @@ @@ -111,8 +124,9 @@
111 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> 124 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
112 {% if user|has_role:'student' or not user.is_staff %} 125 {% if user|has_role:'student' or not user.is_staff %}
113 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li> 126 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
114 - <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li> 127 + <li><a href="{% url 'core:all_courses' %}">{% trans 'All Courses' %}</a></li>
115 {% endif %} 128 {% endif %}
  129 + <li><a href="{% url 'core:guest' %}">{% trans 'Courses' %}</a></li>
116 {% if user|has_role:'system_admin' %} 130 {% if user|has_role:'system_admin' %}
117 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> 131 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
118 {% endif %} 132 {% endif %}
core/templates/guest.html
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 3
4 {% load i18n custom_filters %} 4 {% load i18n custom_filters %}
5 {% load static i18n %} 5 {% load static i18n %}
  6 +{% load pagination %}
6 7
7 <html> 8 <html>
8 <head> 9 <head>
@@ -159,6 +160,7 @@ @@ -159,6 +160,7 @@
159 </div> 160 </div>
160 {% endfor %} 161 {% endfor %}
161 162
  163 + {% pagination request paginator page_obj %}
162 {% endblock %} 164 {% endblock %}
163 </div> 165 </div>
164 </div> 166 </div>
core/templates/register_user.html
@@ -6,6 +6,10 @@ @@ -6,6 +6,10 @@
6 {% block nav %} 6 {% block nav %}
7 {% endblock %} 7 {% endblock %}
8 8
  9 +{% block sidebar %}
  10 +
  11 +{% endblock sidebar %}
  12 +
9 13
10 {% block content %} 14 {% block content %}
11 {% if messages %} 15 {% if messages %}
@@ -19,85 +23,81 @@ @@ -19,85 +23,81 @@
19 {% endfor %} 23 {% endfor %}
20 {% endif %} 24 {% endif %}
21 <div class="row"> 25 <div class="row">
22 - <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">  
23 - <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">  
24 - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">  
25 - </div>  
26 - </div> 26 + <div class="col-lg-offset-4 col-lg-8 col-md-offset-4 col-md-8 col-xs-offset-4 col-xs-8 col-sm-offset-4 col-sm-8">
  27 + <div class="col-lg-8 col-md-8 col-xs-8 col-sm-8">
  28 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus" id="logo">
  29 + </div>
  30 + </div>
27 </div> 31 </div>
28 32
29 <div class="row"> 33 <div class="row">
30 - <div class="col-md-6 col-md-offset-4 col-sm-6 col-sm-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-3"> 34 + <div class="col-lg-8 col-lg-offset-3 col-md-8 col-md-offset-3 col-sm-8 col-sm-offset-3 col-xs-8 col-xs-offset-3">
31 <div class="card"> 35 <div class="card">
32 - <div class="card-content">  
33 <div class="card-body"> 36 <div class="card-body">
34 - <form class="form-horizontal" name="registerForm" method="post" id="register-user" enctype="multipart/form-data"> 37 + <form class="form-horizontal" name="registerForm" method="post" action="" enctype="multipart/form-data">
35 {% csrf_token %} 38 {% csrf_token %}
36 - <h2>{% trans 'User Register' %}</h2>  
37 - <hr> 39 + <legend>{% trans 'User Register' %}</legend>
  40 + {% for field in form %}
38 <div class="row"> 41 <div class="row">
39 - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">  
40 - {% for field in form %}  
41 - <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput block-register-inline">  
42 - {% if field.field.required %}  
43 - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}<span>*</span></label>  
44 - {% else %}  
45 - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label>  
46 - {% endif %}  
47 - <div class="col-md-10 col-md-offset-2 col-lg-10 col-lg-offset-2 col-sm-10  
48 - col-sm-offset-2 col-xs-10 col-xs-offset-2">  
49 - {% if field.auto_id == 'id_birth_date' %}  
50 - {% render_field field class='form-control input-sm date-picker' %}  
51 - <span id="helpBlock" class="help-block">{{ field.help_text }}</span>  
52 - {% elif field.auto_id == 'id_image' %}  
53 - {% render_field field class='form-control input-sm' %}  
54 - <div class="input-group">  
55 - <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">  
56 - <span class="input-group-btn input-group-sm">  
57 - <button type="button" class="btn btn-fab btn-fab-mini">  
58 - <i class="material-icons">attach_file</i>  
59 - </button>  
60 - </span>  
61 - </div>  
62 - {% elif field.auto_id == 'id_cpf' %}  
63 - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %}  
64 -  
65 - {% elif field.auto_id == 'id_phone' %}  
66 - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %}  
67 - {% else %}  
68 - {% render_field field class='form-control' %}  
69 - <span id="helpBlock" class="help-block">{{ field.help_text }}</span>  
70 - {% endif %}  
71 - </div> 42 + <div class="form-group is-empty {% if form.has_error %} has-error {% endif %} is-fileinput">
  43 + {% if field.field.required %}
  44 + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}<span>*</span></label>
  45 + {% else %}
  46 + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label>
  47 + {% endif %}
  48 + <div class="col-md-10">
  49 + {% if field.auto_id == 'id_birth_date' %}
  50 + {% render_field field class='form-control input-sm date-picker' %}
  51 +
  52 + <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
  53 + {% elif field.auto_id == 'id_image' %}
  54 + {% render_field field class='form-control input-sm' %}
  55 + <div class="input-group">
  56 + <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">
  57 + <span class="input-group-btn input-group-sm">
  58 + <button type="button" class="btn btn-fab btn-fab-mini">
  59 + <i class="material-icons">attach_file</i>
  60 + </button>
  61 + </span>
  62 + </div>
  63 + {% elif field.auto_id == 'id_cpf' %}
  64 + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %}
72 65
73 - {% if field.errors %}  
74 - <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert">  
75 - <button type="button" class="close" data-dismiss="alert" aria-label="Close">  
76 - <span aria-hidden="true">&times;</span>  
77 - </button>  
78 - <ul>  
79 - {% for error in field.errors %}  
80 - <li>{{ error }}</li>  
81 - {% endfor %}  
82 - </ul>  
83 - </div>  
84 - {% endif %}  
85 - </div> 66 + {% elif field.auto_id == 'id_phone' %}
  67 + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %}
  68 + {% else %}
  69 + {% render_field field class='form-control' %}
  70 + <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
  71 + {% endif %}
  72 + </div>
  73 +
  74 + {% if field.errors %}
  75 + <div class="alert alert-danger alert-dismissible col-md-offset-1 col-md-10 col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10" role="alert">
  76 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  77 + <span aria-hidden="true">&times;</span>
  78 + </button>
  79 + <ul>
  80 + {% for error in field.errors %}
  81 + <li>{{ error }}</li>
86 {% endfor %} 82 {% endfor %}
87 - <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 col-lg-offset-1 text-center">  
88 - <input type="submit" value="{% trans 'Save' %}" class="btn btn-success btn-raised" />  
89 - </div>  
90 - <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 text-center">  
91 - <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Cancel' %}</a>  
92 - </div> 83 + </ul>
93 </div> 84 </div>
  85 + {% endif %}
  86 + </div>
94 </div> 87 </div>
  88 + {% endfor %}
  89 + <div class="col-md-offset-2 col-md-6 col-sm-offset-2 col-sm-6 col-xs-6 col-xs-offset-2 col-xs-6">
  90 + <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-primary" />
  91 + </div>
  92 + <div class=" col-md-4 col-sm-4 col-xs-4">
  93 + <a href="{% url 'core:home' %}" class=" btn btn-danger btn-raised" >{% trans 'Cancel' %}</a>
  94 + </div>
  95 +
95 </form> 96 </form>
96 </div> 97 </div>
97 - </div>  
98 </div> 98 </div>
99 </div> 99 </div>
100 </div> 100 </div>
101 - 101 +
102 <br clear="all" /> 102 <br clear="all" />
103 {% endblock %} 103 {% endblock %}
@@ -11,7 +11,7 @@ urlpatterns = [ @@ -11,7 +11,7 @@ urlpatterns = [
11 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'), 11 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'),
12 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'), 12 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'),
13 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'), 13 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'),
14 - url(r'^guest/$', views.guest, name='guest'), 14 + url(r'^guest/$', views.GuestView.as_view(), name='guest'),
15 15
16 #Reset Password 16 #Reset Password
17 17
@@ -6,7 +6,7 @@ from .decorators import log_decorator @@ -6,7 +6,7 @@ from .decorators import log_decorator
6 from django.contrib import messages 6 from django.contrib import messages
7 from django.shortcuts import render, redirect 7 from django.shortcuts import render, redirect
8 from django.template.loader import render_to_string 8 from django.template.loader import render_to_string
9 -from django.views.generic import CreateView, UpdateView 9 +from django.views.generic import CreateView, UpdateView, ListView
10 from django.http import HttpResponse, JsonResponse 10 from django.http import HttpResponse, JsonResponse
11 from django.core.mail import send_mail,BadHeaderError 11 from django.core.mail import send_mail,BadHeaderError
12 from django.conf import settings 12 from django.conf import settings
@@ -120,9 +120,18 @@ def getNotifications(request): @@ -120,9 +120,18 @@ def getNotifications(request):
120 data['amountGotten'] = amountGotten 120 data['amountGotten'] = amountGotten
121 return JsonResponse(data) 121 return JsonResponse(data)
122 122
123 -def guest (request):  
124 - context = {  
125 - 'courses': Course.objects.filter(public=True),  
126 - 'categories': CourseCategory.objects.all(),  
127 - }  
128 - return render(request, 'guest.html', context)  
129 \ No newline at end of file 123 \ No newline at end of file
  124 +
  125 +class GuestView (ListView):
  126 +
  127 + template_name = 'guest.html'
  128 + context_object_name = 'courses'
  129 + paginate_by = 10
  130 +
  131 + def get_queryset(self):
  132 + return Course.objects.filter(public=True)
  133 +
  134 +
  135 + def get_context_data (self, **kwargs):
  136 + context = super(GuestView, self).get_context_data(**kwargs)
  137 + context['categories'] = CourseCategory.objects.all()
  138 + return context
courses/static/js/course.js
@@ -70,7 +70,7 @@ function delete_course(url, course, message, return_url) { @@ -70,7 +70,7 @@ function delete_course(url, course, message, return_url) {
70 }); 70 });
71 }); 71 });
72 } 72 }
73 -/* 73 +/*
74 * 74 *
75 * Function to load create course's form 75 * Function to load create course's form
76 * 76 *
courses/static/js/topic_editation_presentation.js
  1 +$(document).ready(function(){
  2 + $(".editation").css('display','none');
  3 +});
1 function show_editation(id_topic){ 4 function show_editation(id_topic){
2 - $("#presentation_"+ id_topic).css('display','none');  
3 - $("#editation_"+ id_topic).css('display','block');  
4 -} 5 + $(".presentation_"+ id_topic).css('display','none');
  6 + $(".editation_"+ id_topic).css('display','block');
  7 +};
  8 + function show_presentation(id_topic){
  9 + $(".editation_"+ id_topic).css('display','none');
  10 + $(".presentation_"+ id_topic).css('display','block');
  11 +};
  12 +
5 13
6 -function show_presentation(id_topic){  
7 - $("#editation_"+ id_topic).css('display','none');  
8 - $("#presentation_"+ id_topic).css('display','block');  
9 -}  
10 \ No newline at end of file 14 \ No newline at end of file
courses/templates/category/index.html
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 <div class="panel-body"> 33 <div class="panel-body">
34 <ul class="nav nav-pills nav-stacked"> 34 <ul class="nav nav-pills nav-stacked">
35 <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li> 35 <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li>
36 - <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li> 36 + <li><a href="{% url 'course:creates' %}">{% trans 'Create Course' %}</a></li>
37 <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li> 37 <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>
38 </ul> 38 </ul>
39 </div> 39 </div>
courses/templates/course/course_card.html
@@ -24,6 +24,10 @@ @@ -24,6 +24,10 @@
24 </ul> 24 </ul>
25 </div> 25 </div>
26 </div> 26 </div>
  27 + {% elif user|has_role:'student' %}
  28 + {% if not request.user in course.students.all %}
  29 + <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}', {{ 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>
  30 + {% endif %}
27 {% endif %} 31 {% endif %}
28 </div> 32 </div>
29 </div> 33 </div>
courses/templates/course/create.html
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput"> 19 <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput">
20 <label for="{{ field.auto_id }}">{{ field.label }}</label> 20 <label for="{{ field.auto_id }}">{{ field.label }}</label>
21 {% if field.auto_id == 'id_init_register_date' or field.auto_id == 'id_end_register_date' or field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date'%} 21 {% if field.auto_id == 'id_init_register_date' or field.auto_id == 'id_end_register_date' or field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date'%}
22 - <input type="date" class="form-control"name="{{field.name}}" value="{% if field.value.year %}{{field.value|date:'Y-m-d'}}{% else %}{{field.value}}{% endif %}" min="{{now|date:'Y-m-d'}}"> 22 + <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'Y-m-d'}}">
23 {% elif field.auto_id == 'id_image' %} 23 {% elif field.auto_id == 'id_image' %}
24 {% render_field field class='form-control' %} 24 {% render_field field class='form-control' %}
25 <div class="input-group"> 25 <div class="input-group">
courses/templates/course/index.html
@@ -21,8 +21,9 @@ @@ -21,8 +21,9 @@
21 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> 21 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
22 {% if user|has_role:'student' or not user.is_staff %} 22 {% if user|has_role:'student' or not user.is_staff %}
23 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li> 23 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
24 - <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li> 24 + <li><a href="{% url 'course:all_courses' %}">{% trans 'All Courses' %}</a></li>
25 {% endif %} 25 {% endif %}
  26 + <li><a href="{% url 'core:guest' %}">{% trans 'Courses' %}</a></li>
26 {% if user|has_role:'system_admin' %} 27 {% if user|has_role:'system_admin' %}
27 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> 28 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
28 {% endif %} 29 {% endif %}
@@ -43,18 +44,41 @@ @@ -43,18 +44,41 @@
43 </div> 44 </div>
44 45
45 {% if user|has_role:'professor' or user|has_role:'system_admin' %} 46 {% if user|has_role:'professor' or user|has_role:'system_admin' %}
46 - <div class="panel panel-primary">  
47 - <div class="panel-heading">  
48 - <h3 class="panel-title">{% trans 'Category' %}</h3> 47 + <div class="panel panel-primary">
  48 + <div class="panel-heading">
  49 + <h3 class="panel-title">{% trans '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' %}">{% trans 'Create Category' %}</a></li>
  54 + <li><a href="{% url 'course:manage_cat' %}">{% trans 'List Category' %}</a></li>
  55 + </ul>
  56 + </div>
49 </div> 57 </div>
50 - <div class="panel-body">  
51 - <ul class="nav nav-pills nav-stacked">  
52 - <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>  
53 - <li><a href="{% url 'course:manage_cat' %}">{% trans 'List Category' %}</a></li>  
54 - </ul> 58 + {% endif %}
  59 + <div class="panel-group" id="accordion">
  60 + <div class="panel panel-primary">
  61 + <div class="panel-heading">
  62 + <h4 class="panel-title">
  63 + <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
  64 + </span>{% trans 'Categorys' %}</a>
  65 + </h4>
  66 + </div>
  67 + <div id="collapseOne" class="panel-collapse collapse in">
  68 + <div class="panel-body">
  69 + <table class="table">
  70 + {% for category in categorys_courses %}
  71 + <tr>
  72 + <td>
  73 + <a href="?category={{category.name}}">{{category.name}}</a>
  74 + </td>
  75 + </tr>
  76 + {% endfor %}
  77 + </table>
  78 + </div>
  79 + </div>
  80 + </div>
55 </div> 81 </div>
56 - </div>  
57 - {% endif %}  
58 82
59 {% endblock %} 83 {% endblock %}
60 84
@@ -84,7 +108,6 @@ @@ -84,7 +108,6 @@
84 </form> 108 </form>
85 </div> 109 </div>
86 110
87 -  
88 </fieldset> 111 </fieldset>
89 <div class="col-md-12 cards-content"> 112 <div class="col-md-12 cards-content">
90 {% if courses|length > 0 %} 113 {% if courses|length > 0 %}
courses/templates/subject/create.html
@@ -11,8 +11,11 @@ @@ -11,8 +11,11 @@
11 {% for field in form %} 11 {% for field in form %}
12 <div class="form-group {% if field.errors %} has-error{% endif %}"> 12 <div class="form-group {% if field.errors %} has-error{% endif %}">
13 <label for="{{ field.auto_id }}" class="control-label label-static"> {{ field.label }}</label> 13 <label for="{{ field.auto_id }}" class="control-label label-static"> {{ field.label }}</label>
14 -  
15 - {% render_field field class='form-control' placeholder=field.label%} 14 + {% if field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date'%}
  15 + <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}">
  16 + {% else %}
  17 + {% render_field field class='form-control' placeholder=field.label%}
  18 + {% endif %}
16 <span class="help-block">{{ field.help_text }}</span> 19 <span class="help-block">{{ field.help_text }}</span>
17 </div> 20 </div>
18 {% endfor %} 21 {% endfor %}
@@ -22,4 +25,12 @@ @@ -22,4 +25,12 @@
22 </form> 25 </form>
23 </div> 26 </div>
24 </div> 27 </div>
  28 +
  29 + <script type="text/javascript">
  30 + var locale = navigator.language || navigator.userLanguage;
  31 +
  32 + $('.date-picker').datepicker({
  33 + language: locale,
  34 + });
  35 + </script>
25 {% endblock content %} 36 {% endblock content %}
courses/templates/subject/form_view_teacher.html
@@ -41,106 +41,73 @@ @@ -41,106 +41,73 @@
41 </div> 41 </div>
42 <div class="panel-collapse collapseTopic-{{topic.slug}} topic_{{ topic.id }} collapse in" role="tabpanel" aria-labelledby="heading_{{topic.id}}" aria-expanded="true" aria-hidden="false"> 42 <div class="panel-collapse collapseTopic-{{topic.slug}} topic_{{ topic.id }} collapse in" role="tabpanel" aria-labelledby="heading_{{topic.id}}" aria-expanded="true" aria-hidden="false">
43 <div class="panel-body"> 43 <div class="panel-body">
44 - <div class="presentation" id="presentation_{{topic.slug}}"> 44 + <div class="presentation_{{topic.slug}}">
45 <p> 45 <p>
46 <i> 46 <i>
47 {{topic.description|linebreaks}} 47 {{topic.description|linebreaks}}
48 </i> 48 </i>
49 </p> 49 </p>
50 - <div class="row">  
51 - <div class="col-xs-6 col-md-6">  
52 - <div class="resource_inline">  
53 - <h4>{% trans 'Material' %}</h4>  
54 - </div>  
55 - <div class="resource_inline">  
56 - <div class="dropdown">  
57 - <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>  
58 - <ul class="dropdown-menu" aria-labelledby="dLabel">  
59 - <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">{% trans 'Create a Link' %}</a></li>  
60 - <li><a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')">{% trans "Create a file" %}</a></li>  
61 - </ul>  
62 - </div> 50 + </div>
  51 + <div class="form-group editation editation_{{topic.slug}}">
  52 + <label class="control-label" for="focusedInput2">{% trans 'Name Topic' %}</label>
  53 + <input type="text" class="form-control" value="{{topic}}">
  54 + </div>
  55 + <div class="form-group editation editation_{{topic.slug}}">
  56 + <label class="control-label" for="focusedInput2">{% trans 'Description' %}</label>
  57 + <textarea class="form-control" rows="3" id="textArea">{{topic.description}}</textarea>
  58 + </div>
  59 + <div class="row">
  60 + <div class="col-xs-6 col-md-6">
  61 + <div class="resource_inline">
  62 + <h4>{% trans 'Material' %}</h4>
  63 + </div>
  64 + <div class="resource_inline">
  65 + <div class="dropdown">
  66 + <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
  67 + <ul class="dropdown-menu" aria-labelledby="dLabel">
  68 + <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">{% trans 'Create a Link' %}</a></li>
  69 + <li><a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')">{% trans "Create a file" %}</a></li>
  70 + </ul>
63 </div> 71 </div>
  72 + </div>
  73 + <div class="presentation_{{topic.slug}}">
64 <ul> 74 <ul>
65 {% list_topic_file request topic %} 75 {% list_topic_file request topic %}
66 {% list_topic_link request topic%} 76 {% list_topic_link request topic%}
67 </ul> 77 </ul>
68 </div> 78 </div>
69 - <div class="col-xs-4 col-md-4">  
70 - <div class="resource_inline">  
71 - <h4>{% trans 'Activities' %}</h4>  
72 - </div>  
73 - <div class="resource_inline">  
74 - <div class="dropdown">  
75 - <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>  
76 - <ul class="dropdown-menu" aria-labelledby="dLabel">  
77 - <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}</a></li>  
78 - <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans 'Create Poll' %}</a></li>  
79 - </ul>  
80 - </div>  
81 - </div>  
82 - <ul>  
83 - {% list_topic_poll request topic %}  
84 - {% list_topic_foruns request topic %}  
85 - </ul>  
86 - </div>  
87 - </div>  
88 - </div><!--EndPresentation-->  
89 - <div class="editation topic_{{ topic.id }}" id="editation_{{topic.slug}}">  
90 - <div class="form-group">  
91 - <label class="control-label" for="focusedInput2">{% trans 'Name Topic' %}</label>  
92 - <input type="text" class="form-control" value="{{topic}}">  
93 - </div>  
94 - <div class="form-group">  
95 - <label class="control-label" for="focusedInput2">{% trans 'Description' %}</label>  
96 - <textarea class="form-control" rows="3" id="textArea">{{topic.description}}</textarea>  
97 - </div>  
98 - <div class="row">  
99 - <div class=" col-xs-6 col-md-4">  
100 - <div class="resource_inline">  
101 - <h4>{% trans 'Material' %}</h4>  
102 - </div>  
103 - <div class="resource_inline">  
104 - <div class="dropdown">  
105 - <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>  
106 - <ul class="dropdown-menu" aria-labelledby="dLabel">  
107 - <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">{% trans 'Create a Link' %}</a></li>  
108 - <li><a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')">{% trans "Create a file" %}</a></li>  
109 - </ul>  
110 - </div>  
111 - </div> 79 + <div class="editation editation_{{topic.slug}}">
112 <ul> 80 <ul>
113 {% list_topic_file_edit request topic %} 81 {% list_topic_file_edit request topic %}
114 {% list_topic_link_edit request topic%} 82 {% list_topic_link_edit request topic%}
115 </ul> 83 </ul>
116 </div> 84 </div>
117 - <div class="col-xs-4 col-md-offset-1 col-md-4">  
118 - <div class="resource_inline">  
119 - <h4>{% trans 'Activities' %}</h4>  
120 - </div>  
121 - <div class="resource_inline">  
122 - <div class="dropdown">  
123 - <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>  
124 - <ul class="dropdown-menu" aria-labelledby="dLabel">  
125 - <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}</a></li>  
126 - <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans 'Create Poll' %}</a></li>  
127 - </ul>  
128 - </div> 85 + </div>
  86 + <div class="col-xs-4 col-md-4">
  87 + <div class="resource_inline">
  88 + <h4>{% trans 'Activities' %}</h4>
  89 + </div>
  90 + <div class="resource_inline">
  91 + <div class="dropdown">
  92 + <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
  93 + <ul class="dropdown-menu" aria-labelledby="dLabel">
  94 + <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}</a></li>
  95 + <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans 'Create Poll' %}</a></li>
  96 + </ul>
129 </div> 97 </div>
130 - <ul>  
131 - {% list_topic_poll request topic %}  
132 - {% list_topic_foruns request topic %}  
133 - </ul>  
134 </div> 98 </div>
  99 + <ul>
  100 + {% list_topic_poll request topic %}
  101 + {% list_topic_foruns request topic %}
  102 + </ul>
135 </div> 103 </div>
136 - <div class="form-group">  
137 - <div class="col-md-10">  
138 - <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-default">{% trans 'Cancel' %}</a>  
139 - <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a>  
140 - </div> 104 + </div>
  105 + <div class="form-group editation editation_{{topic.slug}}">
  106 + <div class="col-md-10">
  107 + <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-default">{% trans 'Cancel' %}</a>
  108 + <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a>
141 </div> 109 </div>
142 - </div><!--EndEditation-->  
143 - 110 + </div>
144 </div> 111 </div>
145 </div> 112 </div>
146 </div> 113 </div>
courses/templates/subject/update.html
@@ -12,7 +12,11 @@ @@ -12,7 +12,11 @@
12 <div class="form-group {% if field.errors %} has-error{% endif %}"> 12 <div class="form-group {% if field.errors %} has-error{% endif %}">
13 <label for="{{ field.auto_id }}" class="control-label label-static"> {{ field.label }}</label> 13 <label for="{{ field.auto_id }}" class="control-label label-static"> {{ field.label }}</label>
14 14
15 - {% render_field field class='form-control' placeholder=field.label%} 15 + {% if field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date'%}
  16 + <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}">
  17 + {% else %}
  18 + {% render_field field class='form-control' placeholder=field.label%}
  19 + {% endif %}
16 <span class="help-block">{{ field.help_text }}</span> 20 <span class="help-block">{{ field.help_text }}</span>
17 </div> 21 </div>
18 {% endfor %} 22 {% endfor %}
@@ -22,4 +26,12 @@ @@ -22,4 +26,12 @@
22 </form> 26 </form>
23 </div> 27 </div>
24 </div> 28 </div>
  29 +
  30 + <script type="text/javascript">
  31 + var locale = navigator.language || navigator.userLanguage;
  32 +
  33 + $('.date-picker').datepicker({
  34 + language: locale,
  35 + });
  36 + </script>
25 {% endblock content %} 37 {% endblock content %}
courses/templates/topic/file_material_view.html 0 → 100644
@@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
  1 +{% extends 'subject/index.html' %}
  2 +
  3 +{% load static i18n permission_tags widget_tweaks %}
  4 +
  5 +{% block breadcrumbs %}
  6 +
  7 + <ol class="breadcrumb">
  8 + <li><a href="">{% trans 'Home' %}</a></li>
  9 + <li><a href="">{{ subject }}</a></li>
  10 + <li class="active">{% trans 'Manage Topic' %}</li>
  11 + <li class="active">{{ topic.name }}</li>
  12 + </ol>
  13 +{% endblock %}
  14 +
  15 +
  16 +{% block content %}
  17 +
  18 +<div class="col-md-12">
  19 + <div><div class="well">
  20 + <div class="row">
  21 + <div class="col-md-offset-2 col-md-9">
  22 + <h2 class="resource_inline"><b>Book 1</b></h2>
  23 + </div>
  24 + <div class="col-md-offset-2 col-md-8">
  25 + <a href="{{ file.file_url }}">{{ file.url }}</a>
  26 + </div>
  27 + </div>
  28 +</div></div>
  29 + <div><div class="well">
  30 + <div class="row">
  31 + <div class="list-group">
  32 + <div class="list-group-item">
  33 + <div class="form-group is-empty">
  34 + <div class="row">
  35 + <div class="col-md-1">
  36 + <span class="input-group-btn">
  37 + <button type="button" class="btn btn-fab btn-fab-mini">
  38 + <i class="material-icons">send</i>
  39 + </button>
  40 + </span>
  41 + </div>
  42 + <div class="col-md-10">
  43 + <input type="text" id="addon3a" class="form-control" placeholder="Add Comment">
  44 + </div>
  45 + </div>
  46 + </div>
  47 + </div>
  48 + </div>
  49 + </div>
  50 +</div>
  51 +<div class="well timeLine">
  52 + <div class="row">
  53 + <div class="col-xs-2 col-md-1">
  54 + <img class="imgTimeLine" src="http://localhost:8080/assets/img/images/team-avatar-2.jpg">
  55 + </div>
  56 + <div class="col-xs-10 col-md-11">
  57 + <i class="fa fa-flag-o" aria-hidden="true"></i>
  58 + <a href="#"><h4 class="resource_inline"><b>Beltrano Camargo</b></h4></a>
  59 + <p class="timePost"><i>Há 11 horas</i></p>
  60 + <!--ListComents -->
  61 + <div class="list-group">
  62 + <div class="list-group-item">
  63 + <div class="row-picture">
  64 + <img class="circle" src="http://localhost:8080/assets/img/images/team-avatar-1.jpg" alt="icon">
  65 + </div>
  66 + <div class="row-content">
  67 + <h4 class="list-group-item-heading">Sicrano da Silva</h4>
  68 + <div class="least-content">11 horas</div>
  69 +
  70 + <p class="list-group-item-text">Quais capítulos devo estudar?</p>
  71 + </div>
  72 + </div>
  73 + <div class="list-group-separator"></div>
  74 + <div class="list-group-item">
  75 + <div class="row-picture">
  76 + <img class="circle" src="http://localhost:8080/assets/img/images/team-avatar-2.jpg" alt="icon">
  77 + </div>
  78 + <div class="row-content">
  79 + <h4 class="list-group-item-heading">Beltrano Camargo</h4>
  80 + <div class="least-content">11 horas</div>
  81 +
  82 + <p class="list-group-item-text">capítulos 5 e 6</p>
  83 + </div>
  84 + </div>
  85 + <div class="list-group-separator"></div>
  86 + <div class="list-group">
  87 + <div class="list-group-item">
  88 + <div class="form-group is-empty">
  89 + <div class="row">
  90 + <div class="col-md-1 col-md-offset-1">
  91 + <span class="input-group-btn">
  92 + <button type="button" class="btn btn-fab btn-fab-mini">
  93 + <i class="material-icons">send</i>
  94 + </button>
  95 + </span>
  96 + </div>
  97 + <div class="col-md-10">
  98 + <input type="text" id="addon3a" class="form-control" placeholder="Add Comment">
  99 + </div>
  100 + </div>
  101 + </div>
  102 + </div>
  103 + </div>
  104 + </div>
  105 + <!-- endListComents -->
  106 + </div>
  107 + </div>
  108 +</div></div>
  109 + </div>
  110 +{% endblock %}
0 \ No newline at end of file 111 \ No newline at end of file
courses/templates/topic/list_file.html
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 <div id="list-topic{{ topic.id }}-files"> 3 <div id="list-topic{{ topic.id }}-files">
4 {% for file in files %} 4 {% for file in files %}
5 - <li id="file_{{ file.slug }}"><i class="material-icons">{{ file.file_type.icon }}</i> <a href="{{ file.file_url.url }}" target="_blank">{{ file.name }}</a></li> 5 + <li id="file_{{ file.slug }}"><i class="material-icons">{{ file.file_type.icon }}</i> <a href="{% url 'course:file_material_view' file.slug %}" target="_blank">{{ file.name }}</a></li>
6 {% endfor %} 6 {% endfor %}
7 </div> 7 </div>
8 8
courses/urls.py
@@ -3,6 +3,7 @@ from django.conf.urls import url, include @@ -3,6 +3,7 @@ from django.conf.urls import url, include
3 from . import views 3 from . import views
4 urlpatterns = [ 4 urlpatterns = [
5 url(r'^$', views.IndexView.as_view(), name='manage'), 5 url(r'^$', views.IndexView.as_view(), name='manage'),
  6 + url(r'^all-courses/$', views.AllCoursesView.as_view(), name='all_courses'),
6 url(r'^create/$', views.CreateCourseView.as_view(), name='create'), 7 url(r'^create/$', views.CreateCourseView.as_view(), name='create'),
7 url(r'^replicate_course/(?P<slug>[\w_-]+)/$', views.ReplicateCourseView.as_view(), name='replicate_course'), 8 url(r'^replicate_course/(?P<slug>[\w_-]+)/$', views.ReplicateCourseView.as_view(), name='replicate_course'),
8 url(r'^edit/(?P<slug>[\w_-]+)/$', views.UpdateCourseView.as_view(), name='update'), 9 url(r'^edit/(?P<slug>[\w_-]+)/$', views.UpdateCourseView.as_view(), name='update'),
@@ -27,6 +28,7 @@ urlpatterns = [ @@ -27,6 +28,7 @@ urlpatterns = [
27 url(r'^exam/', include('exam.urls', namespace = 'exam')), 28 url(r'^exam/', include('exam.urls', namespace = 'exam')),
28 url(r'^files/', include('files.urls', namespace = 'file')), 29 url(r'^files/', include('files.urls', namespace = 'file')),
29 url(r'^upload-material/$', views.UploadMaterialView.as_view(), name='upload_material'), 30 url(r'^upload-material/$', views.UploadMaterialView.as_view(), name='upload_material'),
  31 + url(r'^subjects/file-material-view/(?P<slug>[\w_-]+)/$', views.FileMaterialView.as_view(), name='file_material_view'),
30 url(r'^links/',include('links.urls',namespace = 'links')), 32 url(r'^links/',include('links.urls',namespace = 'links')),
31 url(r'^(?P<slug>[\w_-]+)/', include([ 33 url(r'^(?P<slug>[\w_-]+)/', include([
32 url(r'^$', views.CourseView.as_view(), name='view'), 34 url(r'^$', views.CourseView.as_view(), name='view'),
courses/views.py
@@ -13,7 +13,6 @@ import operator @@ -13,7 +13,6 @@ import operator
13 from functools import reduce 13 from functools import reduce
14 from rolepermissions.verifications import has_object_permission 14 from rolepermissions.verifications import has_object_permission
15 from django.http import HttpResponseRedirect, JsonResponse 15 from django.http import HttpResponseRedirect, JsonResponse
16 -  
17 from .forms import CourseForm, UpdateCourseForm, CategoryCourseForm, SubjectForm,TopicForm,ActivityForm 16 from .forms import CourseForm, UpdateCourseForm, CategoryCourseForm, SubjectForm,TopicForm,ActivityForm
18 from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity, CategorySubject 17 from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity, CategorySubject
19 from core.mixins import NotificationMixin 18 from core.mixins import NotificationMixin
@@ -32,7 +31,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): @@ -32,7 +31,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
32 queryset = Course.objects.all() 31 queryset = Course.objects.all()
33 template_name = 'course/index.html' 32 template_name = 'course/index.html'
34 context_object_name = 'courses' 33 context_object_name = 'courses'
35 - paginate_by = 5 34 + paginate_by = 10
36 aparece = True 35 aparece = True
37 36
38 37
@@ -67,7 +66,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): @@ -67,7 +66,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
67 elif has_role(self.request.user,'system_admin'): 66 elif has_role(self.request.user,'system_admin'):
68 list_courses = queryset.order_by('name') 67 list_courses = queryset.order_by('name')
69 categorys_courses = CourseCategory.objects.all() 68 categorys_courses = CourseCategory.objects.all()
70 - else: 69 + elif has_role(self.request.user, 'student'):
71 list_courses = Course.objects.filter(Q(students = True)|Q(students__name = self.request.user.name)).order_by('name') 70 list_courses = Course.objects.filter(Q(students = True)|Q(students__name = self.request.user.name)).order_by('name')
72 categorys_courses = CourseCategory.objects.filter(course_category__students__name = self.request.user.name).distinct() 71 categorys_courses = CourseCategory.objects.filter(course_category__students__name = self.request.user.name).distinct()
73 72
@@ -86,6 +85,61 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): @@ -86,6 +85,61 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
86 context['aparece'] = self.aparece 85 context['aparece'] = self.aparece
87 86
88 return context 87 return context
  88 +
  89 +class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView):
  90 +
  91 + login_url = reverse_lazy("core:home")
  92 + redirect_field_name = 'next'
  93 + queryset = Course.objects.all()
  94 + template_name = 'course/index.html'
  95 + context_object_name = 'courses'
  96 + paginate_by = 5
  97 + aparece = True
  98 +
  99 +
  100 + def get_queryset(self):
  101 + result = super(AllCoursesView, self).get_queryset()
  102 +
  103 + course_search = self.request.GET.get('q', None)
  104 + category_search = self.request.GET.get('category', None)
  105 + if course_search:
  106 + self.aparece = False
  107 + query_list = course_search.split()
  108 + result = result.filter(
  109 + reduce(operator.and_,
  110 + (Q(name__icontains=q) for q in query_list))
  111 + )
  112 + if category_search:
  113 + self.aparece = False
  114 + query_list = category_search.split()
  115 + result = result.filter(
  116 + reduce(operator.and_,
  117 + (Q(category__name=category) for category in query_list))
  118 + )
  119 + return result
  120 +
  121 + def get_context_data(self, **kwargs):
  122 + context = super(AllCoursesView, self).get_context_data(**kwargs)
  123 + list_courses = None
  124 + categorys_courses = None
  125 + list_courses = Course.objects.all().order_by('name')
  126 + categorys_courses = CourseCategory.objects.all().distinct().order_by('name')
  127 +
  128 + paginator = Paginator(list_courses, self.paginate_by)
  129 + page = self.request.GET.get('page')
  130 +
  131 + try:
  132 + list_courses = paginator.page(page)
  133 + except PageNotAnInteger:
  134 + list_courses = paginator.page(1)
  135 + except EmptyPage:
  136 + list_courses = paginator.page(paginator.num_pages)
  137 +
  138 + context['list_courses'] = list_courses
  139 + context['categorys_courses'] = categorys_courses
  140 + context['aparece'] = self.aparece
  141 +
  142 + return context
89 143
90 class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,generic.edit.CreateView): 144 class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,generic.edit.CreateView):
91 145
@@ -658,3 +712,12 @@ class IndexSubjectCategoryView(LoginRequiredMixin, generic.ListView): @@ -658,3 +712,12 @@ class IndexSubjectCategoryView(LoginRequiredMixin, generic.ListView):
658 context = super(IndexSubjectCategoryView, self).get_context_data(**kwargs) 712 context = super(IndexSubjectCategoryView, self).get_context_data(**kwargs)
659 context['subject_categories'] = SubjectCategory.objects.all() 713 context['subject_categories'] = SubjectCategory.objects.all()
660 return context 714 return context
  715 +
  716 +class FileMaterialView(LoginRequiredMixin, generic.DetailView):
  717 +
  718 + allowed_roles = ['professor', 'system_admin', 'student']
  719 + login_url = reverse_lazy("core:home")
  720 + redirect_field_name = 'next'
  721 + model = Material
  722 + context_object_name = 'file'
  723 + template_name = 'topic/file_material_view.html'
661 \ No newline at end of file 724 \ No newline at end of file
users/templates/users/profile.html
@@ -59,7 +59,12 @@ @@ -59,7 +59,12 @@
59 <tbody> 59 <tbody>
60 <tr> 60 <tr>
61 <td>{% trans "Status" %}:</td> 61 <td>{% trans "Status" %}:</td>
62 - <td></td> 62 + {% if user %}
  63 + <td> {% trans "Online" %}</td>
  64 + {% else %}
  65 + <td> {% trans "OffLine" %}</td>
  66 + {% endif %}
  67 +
63 </tr> 68 </tr>
64 <tr> 69 <tr>
65 <td>{% trans "Name" %}:</td> 70 <td>{% trans "Name" %}:</td>
@@ -96,7 +101,7 @@ @@ -96,7 +101,7 @@
96 <td>{{user.cpf}}</td> 101 <td>{{user.cpf}}</td>
97 102
98 {% else %} 103 {% else %}
99 - <td>{% trans "doesn't posssess CPF" %}</td> 104 + <td>{% trans "doesn't possess CPF" %}</td>
100 {% endif %} 105 {% endif %}
101 106
102 </tr> 107 </tr>
@@ -105,7 +110,7 @@ @@ -105,7 +110,7 @@
105 {% if user.phone %} 110 {% if user.phone %}
106 <td>{{user.phone}}</td> 111 <td>{{user.phone}}</td>
107 {% else %} 112 {% else %}
108 - <td>{% trans "doesn't posssess Phone" %}</td> 113 + <td>{% trans "doesn't possess Phone" %}</td>
109 {% endif %} 114 {% endif %}
110 115
111 </tr> 116 </tr>