Commit 9e2a7a8a5bea61edd39c4a463eef150e9989af26

Authored by ailsoncgt
2 parents a5fff4ca 0cf97b6b

Merge in master #230

core/forms.py
... ... @@ -75,4 +75,5 @@ class RegisterUserForm(forms.ModelForm):
75 75 class Meta:
76 76 model = User
77 77 # exclude = ['is_staff', 'is_active']
78   - fields = ['username', 'name', 'email', 'city', 'state', 'gender', 'cpf', 'birth_date', 'phone', 'image']
79 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 81 \ No newline at end of file
... ...
core/migrations/0003_auto_20161101_1457.py 0 → 100644
... ... @@ -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 101 return self.message
102 102  
103 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 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 110 class Meta:
109 111 verbose_name = _('Log')
110 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 18 overflow: auto;
19 19 width: 300px;
20 20 }
21   -
  21 +#NavBarSearch{
  22 + position: absolute;
  23 + left: 30%;
  24 + }
22 25 .user-notification-img{
23 26 width:40%;
24 27 }
... ... @@ -408,7 +411,6 @@ ul, li {
408 411 .dropdown-menu .pull-right {
409 412 right: 0;
410 413 }
411   - .editation{display: none}
412 414 .moreAccordion{ padding-left: 0px; padding-right: 0px;}
413 415 .moreAccordion div button{ padding-left: 0px; padding-right: 0px;}
414 416 .cards-content{ padding-left: 0px; padding-right: 0px; }
... ... @@ -418,7 +420,20 @@ ul, li {
418 420 .course, .subject, .topic{ padding-top: 0px; padding-bottom: 0px; }
419 421 .course-detail{padding-top: 10px; padding-bottom: 10px;}
420 422  
  423 +.course-card{
  424 + margin-bottom: 0.4% !important;
  425 +}
  426 +
  427 +.course-card-group{
  428 + margin-bottom: 1%;
  429 +}
  430 +
  431 +.category-course-link{
  432 + font-size: 24px;
  433 + color: black !important;
  434 +}
  435 +
421 436 /* Menu link remove radius */
422 437 .nav-pills > li > a {
423 438 border-radius: 0px;
424   -}
425 439 \ No newline at end of file
  440 +}
... ...
core/templates/base.html
... ... @@ -20,7 +20,7 @@
20 20  
21 21 <!-- Bootstrap and themes (material) -->
22 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 24 <link rel="stylesheet" type="text/css" href="{% static 'material/css/bootstrap-material-design.min.css' %}">
25 25 <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.css' %}">
26 26 <link rel="stylesheet" type="text/css" href="{% static 'material/css/ripples.min.css' %}">
... ... @@ -72,6 +72,19 @@
72 72 <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
73 73 </div>
74 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="glyphicon glyphicon-search" aria-hidden="true" style="color:#93C741"></i>
  83 + </button>
  84 + </span>
  85 + </div>
  86 + </form>
  87 + </div>
75 88 <ul class="nav navbar-nav navbar-right notifications">
76 89 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
77 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 3  
4 4 {% load i18n custom_filters %}
5 5 {% load static i18n %}
  6 +{% load pagination %}
6 7  
7 8 <html>
8 9 <head>
... ... @@ -106,6 +107,7 @@
106 107 </div>
107 108 <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
108 109 {% block breadcrumbs %}
  110 +
109 111 <div class="col-md-12">
110 112 <form id="searchform" action="{% url 'course:manage' %}" method="get" accept-charset="utf-8">
111 113 <div class="input-group">
... ... @@ -120,45 +122,34 @@
120 122 </form>
121 123 </div>
122 124  
123   - <div class="col-md-10">
124   - <div class="btn-group btn-group-justified btn-group-raised">
125   - <a href="?category=all" class="btn btn-raised btn-info">{% trans 'All' %}</a>
126   - {% for category in categories %}
127   - <a href="?category={{category.name}}" class="btn btn-raised btn-primary">{{category.name}}</a>
128   - {% endfor %}
129   - </div>
130   - </div>
131   -
132 125 {% endblock %}
133 126 {% block render_breadcrumbs %}{% endblock %}
134 127 <div>
135 128 </div>
136 129 <div class="col-xs-12 col-sm-12 col-md-10 col-lg-10 col-xl-12">
137 130 {% block content %}
138   - {% for course in courses %}
139   - <div class="panel panel-info panel_{{ course.id }}">
140   - <div class="panel-heading">
141   - <a href="{{ course.get_absolute_url }}" class="panel-title">{{course.name}}</a>
142   - {% if user|show_course_subscribe:course %}
143   - <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}', {{ course.id}}, '{% trans 'Are you sure you want to subscribe to this course?' %}')" class="btn btn-sm btn-primary btn-raised pull-right" style="margin-top:-4px">{% trans 'Subscribe' %}</a>
144   - {% endif %}
145   - </div>
146   -
147   - <div class="panel-body">
148   - <p><b>{% trans 'Course Name' %}: </b>{{course.name}}</p>
149   - <p><b>{% trans 'Begining' %}: </b>{{course.init_date}}</p>
150   - <p><b>{% trans 'End' %}: </b>{{course.end_date}}</p>
151   - <p><b>{% trans 'Professor' %}: </b>{{course.professors.name}}</p>
152   - <p>
153   - <b>{% trans 'Description' %}:</b>
154   - <i>
155   - {{course.content}}
156   - </i>
157   - </p>
158   - </div>
159   - </div>
160   - {% endfor %}
161 131  
  132 + <div class="col-md-12 cards-content">
  133 + {% for category in categorys_courses %}
  134 + <div class="panel-group">
  135 + <div class="panel panel-default">
  136 + <div class="panel-heading">
  137 + <h4 class="panel-title">
  138 + <a class="category-course-link" data-toggle="collapse" href="#{{category.slug}}">{{category.name}}</a>
  139 + </h4>
  140 +
  141 + </div>
  142 + <div id="{{category.slug}}" class="panel-collapse collapse">
  143 + {% for course in category.course_category.all %}
  144 + {%if course.public == True %}
  145 + {% include "course/course_card.html" %}
  146 + {% endif %}
  147 + {% endfor %}
  148 + </div>
  149 + </div>
  150 + </div>
  151 + {% endfor %}
  152 + </div>
162 153 {% endblock %}
163 154 </div>
164 155 </div>
... ...
core/templates/register_user.html
... ... @@ -38,53 +38,64 @@
38 38 {% csrf_token %}
39 39 <legend>{% trans 'User Register' %}</legend>
40 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 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">&times;</span>
  90 + </button>
  91 + <ul>
  92 + {% for error in field.errors %}
  93 + <li>{{ error }}</li>
  94 + {% endfor %}
  95 + </ul>
  96 + </div>
71 97 {% endif %}
72 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">&times;</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 99 {% endfor %}
89 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 101 <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-primary" />
... ...
core/urls.py
... ... @@ -11,7 +11,7 @@ urlpatterns = [
11 11 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'),
12 12 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'),
13 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 16 #Reset Password
17 17  
... ...
core/views.py
... ... @@ -6,7 +6,7 @@ from .decorators import log_decorator
6 6 from django.contrib import messages
7 7 from django.shortcuts import render, redirect
8 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 10 from django.http import HttpResponse, JsonResponse
11 11 from django.core.mail import send_mail,BadHeaderError
12 12 from django.conf import settings
... ... @@ -120,9 +120,18 @@ def getNotifications(request):
120 120 data['amountGotten'] = amountGotten
121 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 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['categorys_courses'] = CourseCategory.objects.all()
  138 + return context
130 139 \ No newline at end of file
... ...
courses/static/js/topic_editation_presentation.js
  1 +$(document).ready(function(){
  2 + $(".editation").css('display','none');
  3 +});
1 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 14 \ No newline at end of file
... ...
courses/templates/category/create.html
... ... @@ -31,13 +31,12 @@
31 31 </div>
32 32 <div class="panel-body">
33 33 <ul class="nav nav-pills nav-stacked">
34   - <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li>
35 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 35 </ul>
38 36 </div>
39 37 </div>
40 38  
  39 +
41 40 <div class="panel panel-primary navigation">
42 41 <div class="panel-heading">
43 42 <h3 class="panel-title">{% trans 'Category' %}</h3>
... ...
courses/templates/category/index.html
... ... @@ -32,9 +32,7 @@
32 32 </div>
33 33 <div class="panel-body">
34 34 <ul class="nav nav-pills nav-stacked">
35   - <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li>
36 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 36 </ul>
39 37 </div>
40 38 </div>
... ... @@ -71,16 +69,15 @@
71 69 <div class="panel panel-info">
72 70 <div class="panel-heading" role="tab">
73 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 73 <h4 style="color:white; margin-left: 20px;">{{category}}</h4>
76 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 76 <div class="btn-group">
80 77 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
81 78 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
82 79 </button>
83   - <ul class="dropdown-menu" aria-labelledby="moreActions">
  80 + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">
84 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 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 83 </ul>
... ...
courses/templates/course/course_card.html
1 1 {% load static i18n permission_tags %}
2 2 {% load django_bootstrap_breadcrumbs %}
3   -<div class="group">
  3 +<div class="group course-card ">
4 4 <div class="panel panel-info">
5 5 <div class="panel-heading course">
6 6 <div class="row">
... ...
courses/templates/course/create.html
1   -{% extends 'course/view.html' %}
  1 +{% extends 'home.html' %}
2 2  
3 3 {% load static i18n %}
4 4 {% load widget_tweaks %}
... ... @@ -19,7 +19,7 @@
19 19 <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput">
20 20 <label for="{{ field.auto_id }}">{{ field.label }}</label>
21 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 23 {% elif field.auto_id == 'id_image' %}
24 24 {% render_field field class='form-control' %}
25 25 <div class="input-group">
... ...
courses/templates/course/index.html
... ... @@ -110,20 +110,30 @@
110 110  
111 111 </fieldset>
112 112 <div class="col-md-12 cards-content">
113   - {% if courses|length > 0 %}
114   - {% if request.GET.category == '' or aparece or request.GET.q == '' %}
115   - {% for course in list_courses %}
116   - {% include "course/course_card.html" %}
117   - {% endfor %}
118   - {% endif %}
119   - {% if request.GET.category or request.GET.q %}
120   - {% for course in courses %}
121   - {% include "course/course_card.html" %}
122   - {% endfor %}
123   - {% endif %}
124   - {% else %}
125   - {% trans 'No courses found' %}
126   - {% endif %}
  113 + {% for category in categorys_courses %}
  114 + <div class="panel-group course-card-group">
  115 + <div class="panel panel-default">
  116 + <div class="panel-heading">
  117 + <div class="row">
  118 + <div class="col-md-12">
  119 + <h4 class="panel-title">
  120 + <a class="category-course-link" data-toggle="collapse" href="#{{category.slug}}">{{category.name}}</a>
  121 + </h4>
  122 + </div>
  123 + </div>
  124 + </div>
  125 + <div id="{{category.slug}}" class="panel-collapse collapse">
  126 + {% for course in category.course_category.all %}
  127 + {% if user in course.students.all or user in course.professors.all or user|has_role:'system_admin' %}
  128 + {% include "course/course_card.html" %}
  129 + {% endif %}
  130 + {% endfor %}
  131 + </div>
  132 + </div>
  133 + </div>
  134 +
  135 +
  136 + {% endfor %}
127 137 </div>
128 138 <div class="col-md-12">
129 139 <nav aria-label="Page navigation">
... ...
courses/templates/subject/create.html
... ... @@ -11,8 +11,11 @@
11 11 {% for field in form %}
12 12 <div class="form-group {% if field.errors %} has-error{% endif %}">
13 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 19 <span class="help-block">{{ field.help_text }}</span>
17 20 </div>
18 21 {% endfor %}
... ... @@ -22,4 +25,12 @@
22 25 </form>
23 26 </div>
24 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 36 {% endblock content %}
... ...
courses/templates/subject/form_view_student.html
... ... @@ -32,32 +32,14 @@
32 32 </p>
33 33  
34 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 35 </div>
56 36 </div>
57 37 </div>
  38 +
58 39 </div>
  40 +
59 41 {% professor_subject topic.subject user as professor_links %}
60   - {% if professor_links %}
  42 + {% if professor_links%}
61 43 {% include "links/create_link.html" %}
62 44 {% include "links/delete_link.html" %}
63 45 {% endif %}
... ...
courses/templates/subject/form_view_teacher.html
... ... @@ -41,106 +41,73 @@
41 41 </div>
42 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 43 <div class="panel-body">
44   - <div class="presentation" id="presentation_{{topic.slug}}">
  44 + <div class="presentation_{{topic.slug}}">
45 45 <p>
46 46 <i>
47 47 {{topic.description|linebreaks}}
48 48 </i>
49 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 71 </div>
  72 + </div>
  73 + <div class="presentation_{{topic.slug}}">
64 74 <ul>
65 75 {% list_topic_file request topic %}
66 76 {% list_topic_link request topic%}
67 77 </ul>
68 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 80 <ul>
113 81 {% list_topic_file_edit request topic %}
114 82 {% list_topic_link_edit request topic%}
115 83 </ul>
116 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 97 </div>
130   - <ul>
131   - {% list_topic_poll request topic %}
132   - {% list_topic_foruns request topic %}
133   - </ul>
134 98 </div>
  99 + <ul>
  100 + {% list_topic_poll request topic %}
  101 + {% list_topic_foruns request topic %}
  102 + </ul>
135 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 109 </div>
142   - </div><!--EndEditation-->
143   -
  110 + </div>
144 111 </div>
145 112 </div>
146 113 </div>
... ...
courses/templates/subject/update.html
... ... @@ -12,7 +12,11 @@
12 12 <div class="form-group {% if field.errors %} has-error{% endif %}">
13 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 20 <span class="help-block">{{ field.help_text }}</span>
17 21 </div>
18 22 {% endfor %}
... ... @@ -22,4 +26,12 @@
22 26 </form>
23 27 </div>
24 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 37 {% endblock content %}
... ...
courses/views.py
... ... @@ -123,8 +123,8 @@ class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView):
123 123 list_courses = None
124 124 categorys_courses = None
125 125 list_courses = Course.objects.all().order_by('name')
126   - categorys_courses = CourseCategory.objects.all().distinct().order_by('name')
127   -
  126 + #categorys_courses = CourseCategory.objects.all().distinct().order_by('name')
  127 + categorys_courses = CourseCategory.objects.all()
128 128 paginator = Paginator(list_courses, self.paginate_by)
129 129 page = self.request.GET.get('page')
130 130  
... ... @@ -160,7 +160,7 @@ class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,gener
160 160 if has_role(self.request.user,'system_admin'):
161 161 courses = Course.objects.all()
162 162 elif has_role(self.request.user,'professor'):
163   - courses = self.request.user.courses.all()
  163 + courses = self.request.user.courses_student.all()
164 164 context['courses'] = courses
165 165 context['title'] = _("Create Course")
166 166 context['now'] = date.today()
... ...
files/templates/files/create_file.html
... ... @@ -47,7 +47,7 @@
47 47 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
48 48 {% endif %}
49 49 </div>
50   -
  50 +
51 51 {% if field.errors %}
52 52 <div class="alert alert-danger alert-dismissible clearfix" role="alert">
53 53 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
... ... @@ -71,7 +71,7 @@
71 71  
72 72 <div class="form-group">
73 73 <div class="col-md-12">
74   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
  74 + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
75 75 <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button>
76 76 </div>
77 77 </div>
... ... @@ -85,7 +85,7 @@
85 85 </div>
86 86  
87 87 {% block script_file %}
88   -
  88 +
89 89 {# // <script src="{% static 'js/file.js' %}"></script> #}
90 90 <script type="text/javascript">
91 91 $("#form-file").submit(function(event) {
... ...
files/templates/files/delete_file.html
... ... @@ -31,7 +31,7 @@
31 31 </div>
32 32 <div class="form-group">
33 33 <div class="col-md-12">
34   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
  34 + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
35 35 <button class="btn btn-raised btn-primary" type="submit">{% trans 'Delete' %}</button>
36 36 </div>
37 37 </div>
... ... @@ -45,7 +45,7 @@
45 45 </div>
46 46  
47 47 {% block script_file %}
48   -
  48 +
49 49 {# // <script src="{% static 'js/file.js' %}"></script> #}
50 50 <script type="text/javascript">
51 51 $("#form-delete-file").submit(function(event) {
... ...
files/templates/files/update_file.html
... ... @@ -52,7 +52,7 @@
52 52 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
53 53 {% endif %}
54 54 </div>
55   -
  55 +
56 56 {% if field.errors %}
57 57 <div class="alert alert-danger alert-dismissible clearfix" role="alert">
58 58 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
... ... @@ -76,7 +76,7 @@
76 76  
77 77 <div class="form-group">
78 78 <div class="col-md-12">
79   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
  79 + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
80 80 <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button>
81 81 </div>
82 82 </div>
... ... @@ -90,7 +90,7 @@
90 90 </div>
91 91  
92 92 {% block script_file %}
93   -
  93 +
94 94 {# // <script src="{% static 'js/file.js' %}"></script> #}
95 95 <script type="text/javascript">
96 96 $("#form-update-file").submit(function(event) {
... ...
forum/templates/forum/forum_view.html
... ... @@ -17,7 +17,7 @@
17 17 {% else %}
18 18 <li class="active">{{ forum.name }}</li>
19 19 {% endif %}
20   -
  20 +
21 21 </ol>
22 22 {% endblock %}
23 23  
... ... @@ -33,7 +33,7 @@
33 33 </ul>
34 34 </div>
35 35 </div>
36   -
  36 +
37 37 {% if request.user|has_role:'system_admin' or request.user|has_role:'professor' and request.user in forum.topic.subject.professors.all %}
38 38 <div class="panel panel-primary navigation">
39 39 <div class="panel-heading">
... ... @@ -121,7 +121,7 @@
121 121 </section>
122 122 </div>
123 123 <div class="modal-footer">
124   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans 'Close' %}</button>
  124 + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans 'Close' %}</button>
125 125 <button type="button" onclick="$('#forum_create').submit();" class="btn btn-primary btn-raised">{% trans 'Update' %}</button>
126 126 </div>
127 127 </div>
... ...
links/static/links.js
... ... @@ -1,8 +0,0 @@
1   -function get_modal_link(url, id,div_content){
2   - $.get(url, function (data) {
3   - $(div_content).empty();
4   - $(div_content).append(data);
5   - $(id).modal('show');
6   - });
7   -
8   -}
links/templates/links/create_link.html
1 1 {% load widget_tweaks i18n %}
2   -
3 2 <!--MODAL CREATE LINK-->
4 3 <div class="modal fade" id="createLinksModal" tabindex="-1" role="dialog" aria-labelledby="createLink">
5 4 <div class="modal-dialog" role="document">
... ... @@ -33,7 +32,7 @@
33 32 </div>
34 33 {% endfor %}
35 34 <div class="form-group">
36   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Cancel" %}</button>
  35 + <button type="button" class="btn btn-raised btn-default " data-dismiss="modal">{% trans "Cancel" %}</button>
37 36 <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button>
38 37 </div>
39 38 <!-- .end Card -->
... ...
links/templates/links/delete_link.html
... ... @@ -21,7 +21,7 @@
21 21 </div>
22 22 <div class="form-group">
23 23 <div class="col-md-12">
24   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
  24 + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
25 25 <button class="btn btn-raised btn-primary" type="submit">{% trans 'Delete' %}</button>
26 26 </div>
27 27 </div>
... ...
links/templates/links/update_link.html
... ... @@ -36,7 +36,7 @@
36 36 {% endif %}
37 37 {% endfor %}
38 38 <div class="form-group">
39   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Cancel" %}</button>
  39 + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Cancel" %}</button>
40 40 <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button>
41 41 </div>
42 42 <!-- .end Card -->
... ...
links/templates/links/view_link.html
... ... @@ -14,7 +14,7 @@
14 14 <div class="card-block">
15 15 <b class="card-title">{{link.name}}</b><p></p>
16 16 <p class="card-text"> </p><p>{{link.link_description}}</p>
17   - <a href="{{ link.link_url }}" class="btn btn-primary">{% trans 'Read more' %}</a>
  17 + <a href="{{ link.link_url }}" class="btn btn-raised btn-primary">{% trans 'Read more' %}</a>
18 18 </div>
19 19 </article>
20 20 <!-- .end Card -->
... ...
poll/templates/poll/create.html
... ... @@ -151,7 +151,7 @@
151 151 <div class="modal-footer">
152 152  
153 153 <!-- Don't remove that!!! -->
154   - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
  154 + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
155 155 {% block button_save %}
156 156 <!-- Put curtom buttons here!!! -->
157 157 <button type="submite" id="button" form="form" class="btn btn-primary btn-raised">{% trans "Create" %}</button>
... ...
users/templates/users/profile.html
... ... @@ -45,9 +45,11 @@
45 45 <div class="row">
46 46 <div class="col-md-4">
47 47 {% if user.image %}
48   - <div style="background-image: url('{{ user.image.url }}'); background-size: 100% 100%; background-repeat: no-repeat; margin-left: 8em;" alt="photoUser" class="img-circle img-responsive img-list-user"></div>
  48 + <div style="width: 200px; overflow:hidden; margin-left: 8em;">
  49 + <img src="{{ user.image.url }}" class="img-circle img-responsive img-list-user" >
  50 + </div>
49 51 {% else %}
50   - {% if usser.gender == 'M' %}
  52 + {% if user.gender == 'M' %}
51 53 <img src="{% static 'img/male_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;">
52 54 {% else %}
53 55 <img src="{% static 'img/female_avatar.png' %}" alt="Avatar" class="img-circle img-responsive img-list-user" style="margin-left: 8em;">
... ...