Commit 561e06fb1ff26062fbcdfc1deb83fece90dd438e
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
18 changed files
with
222 additions
and
181 deletions
Show diff stats
core/forms.py
@@ -75,4 +75,5 @@ class RegisterUserForm(forms.ModelForm): | @@ -75,4 +75,5 @@ class RegisterUserForm(forms.ModelForm): | ||
75 | class Meta: | 75 | class Meta: |
76 | model = User | 76 | model = User |
77 | # exclude = ['is_staff', 'is_active'] | 77 | # exclude = ['is_staff', 'is_active'] |
78 | - fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image'] | ||
79 | \ No newline at end of file | 78 | \ No newline at end of file |
79 | + fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image', 'titration', | ||
80 | + 'year_titration', 'institution', 'curriculum',] | ||
80 | \ No newline at end of file | 81 | \ No newline at end of file |
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-01 17:57 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('core', '0002_auto_20161024_1559'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.AddField( | ||
16 | + model_name='log', | ||
17 | + name='component', | ||
18 | + field=models.TextField(default='', verbose_name='Component (Module / App)'), | ||
19 | + preserve_default=False, | ||
20 | + ), | ||
21 | + migrations.AddField( | ||
22 | + model_name='log', | ||
23 | + name='context', | ||
24 | + field=models.TextField(blank=True, verbose_name='Context'), | ||
25 | + ), | ||
26 | + ] |
core/models.py
@@ -101,10 +101,15 @@ class Notification(models.Model): | @@ -101,10 +101,15 @@ class Notification(models.Model): | ||
101 | return self.message | 101 | return self.message |
102 | 102 | ||
103 | class Log(models.Model): | 103 | class Log(models.Model): |
104 | - datetime = models.DateTimeField(_("Date and Time of action"), auto_now_add = True) | ||
105 | - user = models.ForeignKey(User, verbose_name = _('Actor')) | 104 | + component = models.TextField(_('Component (Module / App)')) |
105 | + context = models.TextField(_('Context'), blank = True) | ||
106 | action_resource = models.ForeignKey(Action_Resource, verbose_name = _('Action_Resource')) | 106 | action_resource = models.ForeignKey(Action_Resource, verbose_name = _('Action_Resource')) |
107 | + user = models.ForeignKey(User, verbose_name = _('Actor')) | ||
108 | + datetime = models.DateTimeField(_("Date and Time of action"), auto_now_add = True) | ||
107 | 109 | ||
108 | class Meta: | 110 | class Meta: |
109 | verbose_name = _('Log') | 111 | verbose_name = _('Log') |
110 | verbose_name_plural = _('Logs') | 112 | verbose_name_plural = _('Logs') |
113 | + | ||
114 | + def __str__(self): | ||
115 | + return self.message |
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; } |
@@ -426,4 +428,4 @@ ul, li { | @@ -426,4 +428,4 @@ ul, li { | ||
426 | /* Menu link remove radius */ | 428 | /* Menu link remove radius */ |
427 | .nav-pills > li > a { | 429 | .nav-pills > li > a { |
428 | border-radius: 0px; | 430 | border-radius: 0px; |
429 | -} | ||
430 | \ No newline at end of file | 431 | \ No newline at end of file |
432 | +} |
core/templates/base.html
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | 20 | ||
21 | <!-- Bootstrap and themes (material) --> | 21 | <!-- Bootstrap and themes (material) --> |
22 | <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}"> | 22 | <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}"> |
23 | - <link rel="stylesheet" type="text/css" href="{% static 'material/css/bootstrap-material-design.css' %}"> | 23 | + |
24 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/bootstrap-material-design.min.css' %}"> | 24 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/bootstrap-material-design.min.css' %}"> |
25 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.css' %}"> | 25 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.css' %}"> |
26 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.min.css' %}"> | 26 | <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.min.css' %}"> |
@@ -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> |
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
@@ -38,53 +38,64 @@ | @@ -38,53 +38,64 @@ | ||
38 | {% csrf_token %} | 38 | {% csrf_token %} |
39 | <legend>{% trans 'User Register' %}</legend> | 39 | <legend>{% trans 'User Register' %}</legend> |
40 | {% for field in form %} | 40 | {% for field in form %} |
41 | - <div class="row"> | ||
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);' %} | ||
65 | - | ||
66 | - {% elif field.auto_id == 'id_phone' %} | ||
67 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | 41 | + <div class="form-group is-empty {% if form.has_error %} has-error {% endif %} is-fileinput"> |
42 | + {% if field.field.required %} | ||
43 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}<span>*</span></label> | ||
68 | {% else %} | 44 | {% else %} |
69 | - {% render_field field class='form-control' %} | ||
70 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | 45 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> |
46 | + {% endif %} | ||
47 | + <div class="col-md-10"> | ||
48 | + {% if field.auto_id == 'id_birth_date' %} | ||
49 | + {% render_field field class='form-control input-sm date-picker' %} | ||
50 | + | ||
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_curriculum' %} | ||
63 | + {% render_field field class='form-control input-sm' %} | ||
64 | + <div class="input-group"> | ||
65 | + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Chose your file ...' %}"> | ||
66 | + <span class="input-group-btn input-group-sm"> | ||
67 | + <button type="button" class="btn btn-fab btn-fab-mini"> | ||
68 | + <i class="material-icons">attach_file</i> | ||
69 | + </button> | ||
70 | + </span> | ||
71 | + </div> | ||
72 | + {% elif field.auto_id == 'id_cpf' %} | ||
73 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | ||
74 | + | ||
75 | + {% elif field.auto_id == 'id_year_titration' %} | ||
76 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event);' %} | ||
77 | + | ||
78 | + {% elif field.auto_id == 'id_phone' %} | ||
79 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | ||
80 | + {% else %} | ||
81 | + {% render_field field class='form-control' %} | ||
82 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | ||
83 | + {% endif %} | ||
84 | + </div> | ||
85 | + | ||
86 | + {% if field.errors %} | ||
87 | + <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"> | ||
88 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
89 | + <span aria-hidden="true">×</span> | ||
90 | + </button> | ||
91 | + <ul> | ||
92 | + {% for error in field.errors %} | ||
93 | + <li>{{ error }}</li> | ||
94 | + {% endfor %} | ||
95 | + </ul> | ||
96 | + </div> | ||
71 | {% endif %} | 97 | {% endif %} |
72 | </div> | 98 | </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">×</span> | ||
78 | - </button> | ||
79 | - <ul> | ||
80 | - {% for error in field.errors %} | ||
81 | - <li>{{ error }}</li> | ||
82 | - {% endfor %} | ||
83 | - </ul> | ||
84 | - </div> | ||
85 | - {% endif %} | ||
86 | - </div> | ||
87 | - </div> | ||
88 | {% endfor %} | 99 | {% 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"> | 100 | <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" /> | 101 | <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-primary" /> |
core/urls.py
@@ -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 |
core/views.py
@@ -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/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/create.html
@@ -31,13 +31,12 @@ | @@ -31,13 +31,12 @@ | ||
31 | </div> | 31 | </div> |
32 | <div class="panel-body"> | 32 | <div class="panel-body"> |
33 | <ul class="nav nav-pills nav-stacked"> | 33 | <ul class="nav nav-pills nav-stacked"> |
34 | - <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li> | ||
35 | <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li> | 34 | <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li> |
36 | - <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li> | ||
37 | </ul> | 35 | </ul> |
38 | </div> | 36 | </div> |
39 | </div> | 37 | </div> |
40 | 38 | ||
39 | + | ||
41 | <div class="panel panel-primary navigation"> | 40 | <div class="panel panel-primary navigation"> |
42 | <div class="panel-heading"> | 41 | <div class="panel-heading"> |
43 | <h3 class="panel-title">{% trans 'Category' %}</h3> | 42 | <h3 class="panel-title">{% trans 'Category' %}</h3> |
courses/templates/category/index.html
@@ -32,9 +32,7 @@ | @@ -32,9 +32,7 @@ | ||
32 | </div> | 32 | </div> |
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> | ||
36 | <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li> | 35 | <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li> |
37 | - <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li> | ||
38 | </ul> | 36 | </ul> |
39 | </div> | 37 | </div> |
40 | </div> | 38 | </div> |
@@ -71,16 +69,15 @@ | @@ -71,16 +69,15 @@ | ||
71 | <div class="panel panel-info"> | 69 | <div class="panel panel-info"> |
72 | <div class="panel-heading" role="tab"> | 70 | <div class="panel-heading" role="tab"> |
73 | <div class="row"> | 71 | <div class="row"> |
74 | - <div class="col-xs-9 col-md-10 titleTopic"> | 72 | + <div class="col-xs-9 col-md-11 titleTopic"> |
75 | <h4 style="color:white; margin-left: 20px;">{{category}}</h4> | 73 | <h4 style="color:white; margin-left: 20px;">{{category}}</h4> |
76 | </div> | 74 | </div> |
77 | - | ||
78 | - <div class="col-xs-4 col-md-2" id="divMoreActions"> | 75 | + <div class="col-xs-4 col-md-1" id="divMoreActions"> |
79 | <div class="btn-group"> | 76 | <div class="btn-group"> |
80 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 77 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
81 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | 78 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
82 | </button> | 79 | </button> |
83 | - <ul class="dropdown-menu" aria-labelledby="moreActions"> | 80 | + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
84 | <li><a href="{% url 'course:update_cat' category.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Update' %}</a></li> | 81 | <li><a href="{% url 'course:update_cat' category.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Update' %}</a></li> |
85 | <li><a href="javascript:modal.get('{% url 'course:delete_cat' category.slug %}','#category','#modal_category');"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>{% trans 'Remover' %}</a></li> | 82 | <li><a href="javascript:modal.get('{% url 'course:delete_cat' category.slug %}','#category','#modal_category');"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>{% trans 'Remover' %}</a></li> |
86 | </ul> | 83 | </ul> |
courses/templates/course/create.html
1 | -{% extends 'course/view.html' %} | 1 | +{% extends 'home.html' %} |
2 | 2 | ||
3 | {% load static i18n %} | 3 | {% load static i18n %} |
4 | {% load widget_tweaks %} | 4 | {% load widget_tweaks %} |
@@ -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/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_student.html
@@ -32,32 +32,14 @@ | @@ -32,32 +32,14 @@ | ||
32 | </p> | 32 | </p> |
33 | 33 | ||
34 | </div> | 34 | </div> |
35 | - <div class="row"> | ||
36 | - <div class="col-xs-6 col-md-6"> | ||
37 | - <div class="resource_inline"> | ||
38 | - <h4>{% trans 'Material' %}</h4> | ||
39 | - </div> | ||
40 | - <ul> | ||
41 | - {% list_topic_file request topic %} | ||
42 | - {% list_topic_link request topic%} | ||
43 | - </ul> | ||
44 | - </div> | ||
45 | - <div class="col-xs-4 col-md-4"> | ||
46 | - <div class="resource_inline"> | ||
47 | - <h4>{% trans 'Activities' %}</h4> | ||
48 | - </div> | ||
49 | - <ul> | ||
50 | - {% list_topic_poll request topic %} | ||
51 | - {% list_topic_foruns request topic %} | ||
52 | - </ul> | ||
53 | - </div> | ||
54 | - </div> | ||
55 | </div> | 35 | </div> |
56 | </div> | 36 | </div> |
57 | </div> | 37 | </div> |
38 | + | ||
58 | </div> | 39 | </div> |
40 | + | ||
59 | {% professor_subject topic.subject user as professor_links %} | 41 | {% professor_subject topic.subject user as professor_links %} |
60 | - {% if professor_links %} | 42 | + {% if professor_links%} |
61 | {% include "links/create_link.html" %} | 43 | {% include "links/create_link.html" %} |
62 | {% include "links/delete_link.html" %} | 44 | {% include "links/delete_link.html" %} |
63 | {% endif %} | 45 | {% endif %} |
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/views.py
@@ -160,7 +160,7 @@ class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,gener | @@ -160,7 +160,7 @@ class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,gener | ||
160 | if has_role(self.request.user,'system_admin'): | 160 | if has_role(self.request.user,'system_admin'): |
161 | courses = Course.objects.all() | 161 | courses = Course.objects.all() |
162 | elif has_role(self.request.user,'professor'): | 162 | elif has_role(self.request.user,'professor'): |
163 | - courses = self.request.user.courses.all() | 163 | + courses = self.request.user.courses_student.all() |
164 | context['courses'] = courses | 164 | context['courses'] = courses |
165 | context['title'] = _("Create Course") | 165 | context['title'] = _("Create Course") |
166 | context['now'] = date.today() | 166 | context['now'] = date.today() |