Commit 7fdca97e34bff174a5e7ab499daa3d80ce96a063

Authored by Matheus Lins
1 parent 0256201a

list course #57

amadeus/settings.py
@@ -47,6 +47,7 @@ INSTALLED_APPS = [ @@ -47,6 +47,7 @@ INSTALLED_APPS = [
47 'app', 47 'app',
48 'courses', 48 'courses',
49 'users', 49 'users',
  50 + 'forum',
50 ] 51 ]
51 52
52 MIDDLEWARE_CLASSES = [ 53 MIDDLEWARE_CLASSES = [
@@ -78,8 +79,8 @@ TEMPLATES = [ @@ -78,8 +79,8 @@ TEMPLATES = [
78 'django.contrib.auth.context_processors.auth', 79 'django.contrib.auth.context_processors.auth',
79 'django.contrib.messages.context_processors.messages', 80 'django.contrib.messages.context_processors.messages',
80 81
81 - # 'core.context_processors.notifications',  
82 - # 'courses.context_processors.courses', 82 + 'core.context_processors.notifications',
  83 + 'courses.context_processors.courses',
83 ], 84 ],
84 }, 85 },
85 }, 86 },
@@ -143,6 +144,10 @@ USE_TZ = True @@ -143,6 +144,10 @@ USE_TZ = True
143 144
144 STATIC_URL = '/static/' 145 STATIC_URL = '/static/'
145 146
  147 +STATICFILES_DIRS = [
  148 + os.path.join(BASE_DIR, "static"),
  149 +]
  150 +
146 # Files 151 # Files
147 MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'uploads') 152 MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'uploads')
148 MEDIA_URL = '/uploads/' 153 MEDIA_URL = '/uploads/'
@@ -165,6 +170,16 @@ LOGS_URL = 'logs/' @@ -165,6 +170,16 @@ LOGS_URL = 'logs/'
165 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' 170 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
166 DEFAULT_FROM_EMAIL = 'admin@admin.com' 171 DEFAULT_FROM_EMAIL = 'admin@admin.com'
167 172
  173 +# Messages
  174 +from django.contrib.messages import constants as messages_constants
  175 +MESSAGE_TAGS = {
  176 + messages_constants.DEBUG: 'debug',
  177 + messages_constants.INFO: 'info',
  178 + messages_constants.SUCCESS: 'success',
  179 + messages_constants.WARNING: 'warning',
  180 + messages_constants.ERROR: 'danger',
  181 +}
  182 +
168 183
169 try: 184 try:
170 from .local_settings import * 185 from .local_settings import *
amadeus/urls.py
@@ -23,6 +23,7 @@ urlpatterns = [ @@ -23,6 +23,7 @@ urlpatterns = [
23 url(r'^home/', include('app.urls', namespace = 'app')), 23 url(r'^home/', include('app.urls', namespace = 'app')),
24 url(r'^course/', include('courses.urls', namespace = 'course')), 24 url(r'^course/', include('courses.urls', namespace = 'course')),
25 url(r'^users/', include('users.urls', namespace = 'users')), 25 url(r'^users/', include('users.urls', namespace = 'users')),
  26 + url(r'^forum/', include('forum.urls', namespace = 'forum')),
26 url(r'^admin/', admin.site.urls), 27 url(r'^admin/', admin.site.urls),
27 url(r'^', include('core.urls', namespace = 'core')), 28 url(r'^', include('core.urls', namespace = 'core')),
28 ] 29 ]
app/locale/he_il/LC_MESSAGES/django.po 0 → 100644
@@ -0,0 +1,178 @@ @@ -0,0 +1,178 @@
  1 +# SOME DESCRIPTIVE TITLE.
  2 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  3 +# This file is distributed under the same license as the PACKAGE package.
  4 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5 +#
  6 +#, fuzzy
  7 +msgid ""
  8 +msgstr ""
  9 +"Project-Id-Version: PACKAGE VERSION\n"
  10 +"Report-Msgid-Bugs-To: \n"
  11 +"POT-Creation-Date: 2016-09-16 02:41-0300\n"
  12 +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  13 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  14 +"Language-Team: LANGUAGE <LL@li.org>\n"
  15 +"Language: \n"
  16 +"MIME-Version: 1.0\n"
  17 +"Content-Type: text/plain; charset=UTF-8\n"
  18 +"Content-Transfer-Encoding: 8bit\n"
  19 +
  20 +#: app/templates/app/base.html:10
  21 +msgid "The Project"
  22 +msgstr ""
  23 +
  24 +#: app/templates/app/base.html:11
  25 +msgid "CCTE Group"
  26 +msgstr ""
  27 +
  28 +#: app/templates/app/base.html:14
  29 +msgid "Hi"
  30 +msgstr ""
  31 +
  32 +#: app/templates/app/base.html:16
  33 +msgid "See Profile"
  34 +msgstr ""
  35 +
  36 +#: app/templates/app/base.html:17
  37 +msgid "Settings"
  38 +msgstr ""
  39 +
  40 +#: app/templates/app/base.html:18
  41 +msgid "Logout"
  42 +msgstr ""
  43 +
  44 +#: app/templates/app/index.html:6
  45 +msgid "You have:"
  46 +msgstr ""
  47 +
  48 +#: app/templates/app/index.html:10 app/templates/home.html:88
  49 +msgid "Pending Tasks"
  50 +msgstr ""
  51 +
  52 +#: app/templates/app/index.html:14
  53 +msgid "Users Online"
  54 +msgstr ""
  55 +
  56 +#: app/templates/app/index.html:20
  57 +msgid "You can:"
  58 +msgstr ""
  59 +
  60 +#: app/templates/app/index.html:24 app/templates/home_professor.html:25
  61 +msgid "Create Course"
  62 +msgstr ""
  63 +
  64 +#: app/templates/app/index.html:29 app/templates/home.html:93
  65 +msgid "Manage Users"
  66 +msgstr ""
  67 +
  68 +#: app/templates/app/index.html:33 app/templates/home.html:96
  69 +msgid "Manage Courses"
  70 +msgstr ""
  71 +
  72 +#: app/templates/app/index.html:37
  73 +msgid "Gerenciar Categorias"
  74 +msgstr ""
  75 +
  76 +#: app/templates/app/index.html:45
  77 +msgid "Your course(s):"
  78 +msgstr ""
  79 +
  80 +#: app/templates/app/index.html:46
  81 +msgid "No courses subscribed yet"
  82 +msgstr ""
  83 +
  84 +#: app/templates/app/index.html:56
  85 +msgid "Search course:"
  86 +msgstr ""
  87 +
  88 +#: app/templates/app/index.html:62
  89 +msgid "Search"
  90 +msgstr ""
  91 +
  92 +#: app/templates/app/index.html:67
  93 +msgid "Most popular keywords:"
  94 +msgstr ""
  95 +
  96 +#: app/templates/home.html:86
  97 +msgid "Home"
  98 +msgstr ""
  99 +
  100 +#: app/templates/home.html:87 app/templates/home_student.html:25
  101 +msgid "Profile"
  102 +msgstr ""
  103 +
  104 +#: app/templates/home.html:90
  105 +msgid "My courses"
  106 +msgstr ""
  107 +
  108 +#: app/templates/home.html:105 app/templates/home_professor.html:33
  109 +msgid "Courses"
  110 +msgstr ""
  111 +
  112 +#: app/templates/home.html:131
  113 +msgid "No pending tasks at the moment."
  114 +msgstr ""
  115 +
  116 +#: app/templates/home_admin_content.html:10
  117 +msgid "Students"
  118 +msgstr ""
  119 +
  120 +#: app/templates/home_admin_content.html:11
  121 +msgid "Beginning"
  122 +msgstr ""
  123 +
  124 +#: app/templates/home_admin_content.html:12
  125 +msgid "End"
  126 +msgstr ""
  127 +
  128 +#: app/templates/home_admin_content.html:15
  129 +msgid "Edit"
  130 +msgstr ""
  131 +
  132 +#: app/templates/home_professor.html:20 app/templates/home_student.html:21
  133 +msgid "Menu"
  134 +msgstr ""
  135 +
  136 +#: app/templates/home_professor.html:24
  137 +msgid "Pending tasks"
  138 +msgstr ""
  139 +
  140 +#: app/templates/home_professor.html:26
  141 +msgid "Manage Course"
  142 +msgstr ""
  143 +
  144 +#: app/templates/home_professor.html:43
  145 +msgid "Students:"
  146 +msgstr ""
  147 +
  148 +#: app/templates/home_professor.html:44
  149 +msgid "Beginning:"
  150 +msgstr ""
  151 +
  152 +#: app/templates/home_professor.html:45
  153 +msgid "End:"
  154 +msgstr ""
  155 +
  156 +#: app/templates/home_professor.html:52
  157 +msgid "You didn't create any course yet."
  158 +msgstr ""
  159 +
  160 +#: app/templates/home_professor.html:58 app/templates/home_student.html:73
  161 +msgid "Goals"
  162 +msgstr ""
  163 +
  164 +#: app/templates/home_student.html:26
  165 +msgid "My Courses"
  166 +msgstr ""
  167 +
  168 +#: app/templates/home_student.html:27
  169 +msgid "Google accounts"
  170 +msgstr ""
  171 +
  172 +#: app/templates/home_student.html:34
  173 +msgid "Notifications"
  174 +msgstr ""
  175 +
  176 +#: app/templates/home_student.html:76
  177 +msgid "Favorites"
  178 +msgstr ""
app/templates/home_admin_content.html
@@ -12,6 +12,6 @@ @@ -12,6 +12,6 @@
12 <li>{% trans 'End' %}: {{ course.end_date }}</li> 12 <li>{% trans 'End' %}: {{ course.end_date }}</li>
13 </ul> 13 </ul>
14 </div> 14 </div>
15 - <button type="button" class="btn btn-outline-info">{% trans 'Edit' %}</button> 15 + <a href="{% url 'course:update' course.slug %}" class="btn btn-outline-info">{% trans 'Edit' %}</a>
16 </div> 16 </div>
17 {% endfor %} 17 {% endfor %}
18 \ No newline at end of file 18 \ No newline at end of file
@@ -42,7 +42,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): @@ -42,7 +42,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
42 else: 42 else:
43 self.template_name = "home_teacher_student_content.html" 43 self.template_name = "home_teacher_student_content.html"
44 44
45 - #super(AppIndex, self).createNotification("testando notificacao de login", resource_name="home", resource_link="/") 45 + super(AppIndex, self).createNotification("testando notificacao de login", resource_name="home", resource_link="/")
46 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) 46 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs)
47 47
48 48
core/context_processors.py
@@ -3,9 +3,8 @@ from .models import Notification @@ -3,9 +3,8 @@ from .models import Notification
3 def notifications(request): 3 def notifications(request):
4 context = {} 4 context = {}
5 context['notifications'] = None 5 context['notifications'] = None
6 - if not request.user is None:  
7 - if request.user.is_authenticated:  
8 - return {  
9 - 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime')  
10 - } 6 + if request.user.is_authenticated:
  7 + return {
  8 + 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime')
  9 + }
11 return context 10 return context
core/locale/he_il/LC_MESSAGES/django.po 0 → 100644
@@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
  1 +# SOME DESCRIPTIVE TITLE.
  2 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  3 +# This file is distributed under the same license as the PACKAGE package.
  4 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5 +#
  6 +#, fuzzy
  7 +msgid ""
  8 +msgstr ""
  9 +"Project-Id-Version: PACKAGE VERSION\n"
  10 +"Report-Msgid-Bugs-To: \n"
  11 +"POT-Creation-Date: 2016-09-16 02:41-0300\n"
  12 +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  13 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  14 +"Language-Team: LANGUAGE <LL@li.org>\n"
  15 +"Language: \n"
  16 +"MIME-Version: 1.0\n"
  17 +"Content-Type: text/plain; charset=UTF-8\n"
  18 +"Content-Transfer-Encoding: 8bit\n"
  19 +
  20 +#: core/templates/base.html:97
  21 +msgid "Log out"
  22 +msgstr ""
  23 +
  24 +#: core/templates/index.html:38
  25 +msgid "Username"
  26 +msgstr ""
  27 +
  28 +#: core/templates/index.html:44
  29 +msgid "Password"
  30 +msgstr ""
  31 +
  32 +#: core/templates/index.html:52
  33 +msgid "Remember Email"
  34 +msgstr ""
  35 +
  36 +#: core/templates/index.html:61
  37 +msgid "Guest"
  38 +msgstr ""
  39 +
  40 +#: core/templates/index.html:64 core/templates/register_user.html:71
  41 +msgid "Login"
  42 +msgstr ""
  43 +
  44 +#: core/templates/index.html:73
  45 +msgid "Sign Up"
  46 +msgstr ""
  47 +
  48 +#: core/templates/register_user.html:29
  49 +msgid "User Register"
  50 +msgstr ""
  51 +
  52 +#: core/templates/register_user.html:68
  53 +msgid "Save"
  54 +msgstr ""
  55 +
  56 +#: core/templates/remember_password.html:27
  57 +msgid "E-mail"
  58 +msgstr ""
  59 +
  60 +#: core/templates/remember_password.html:31
  61 +msgid "Registration"
  62 +msgstr ""
  63 +
  64 +#: core/templates/remember_password.html:35
  65 +msgid "Send"
  66 +msgstr ""
core/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-20 13:57 2 +# Generated by Django 1.10 on 2016-09-22 05:46
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import autoslug.fields 5 import autoslug.fields
@@ -25,8 +25,8 @@ class Migration(migrations.Migration): @@ -25,8 +25,8 @@ class Migration(migrations.Migration):
25 ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), 25 ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')),
26 ], 26 ],
27 options={ 27 options={
28 - 'verbose_name_plural': 'Actions',  
29 'verbose_name': 'Action', 28 'verbose_name': 'Action',
  29 + 'verbose_name_plural': 'Actions',
30 }, 30 },
31 ), 31 ),
32 migrations.CreateModel( 32 migrations.CreateModel(
@@ -36,8 +36,8 @@ class Migration(migrations.Migration): @@ -36,8 +36,8 @@ class Migration(migrations.Migration):
36 ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')), 36 ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')),
37 ], 37 ],
38 options={ 38 options={
39 - 'verbose_name_plural': 'Action_Resources',  
40 'verbose_name': 'Action_Resource', 39 'verbose_name': 'Action_Resource',
  40 + 'verbose_name_plural': 'Action_Resources',
41 }, 41 },
42 ), 42 ),
43 migrations.CreateModel( 43 migrations.CreateModel(
@@ -49,8 +49,8 @@ class Migration(migrations.Migration): @@ -49,8 +49,8 @@ class Migration(migrations.Migration):
49 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), 49 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')),
50 ], 50 ],
51 options={ 51 options={
52 - 'verbose_name_plural': 'Logs',  
53 'verbose_name': 'Log', 52 'verbose_name': 'Log',
  53 + 'verbose_name_plural': 'Logs',
54 }, 54 },
55 ), 55 ),
56 migrations.CreateModel( 56 migrations.CreateModel(
@@ -65,8 +65,8 @@ class Migration(migrations.Migration): @@ -65,8 +65,8 @@ class Migration(migrations.Migration):
65 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')), 65 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')),
66 ], 66 ],
67 options={ 67 options={
68 - 'verbose_name_plural': 'Notifications',  
69 'verbose_name': 'Notification', 68 'verbose_name': 'Notification',
  69 + 'verbose_name_plural': 'Notifications',
70 }, 70 },
71 ), 71 ),
72 migrations.CreateModel( 72 migrations.CreateModel(
@@ -79,8 +79,8 @@ class Migration(migrations.Migration): @@ -79,8 +79,8 @@ class Migration(migrations.Migration):
79 ('url', models.CharField(default='', max_length=100, verbose_name='URL')), 79 ('url', models.CharField(default='', max_length=100, verbose_name='URL')),
80 ], 80 ],
81 options={ 81 options={
82 - 'verbose_name_plural': 'Resources',  
83 'verbose_name': 'Resource', 82 'verbose_name': 'Resource',
  83 + 'verbose_name_plural': 'Resources',
84 }, 84 },
85 ), 85 ),
86 migrations.AddField( 86 migrations.AddField(
core/static/css/base/amadeus.css
@@ -70,6 +70,10 @@ ul { @@ -70,6 +70,10 @@ ul {
70 70
71 /*CSS TIMELINE*/ 71 /*CSS TIMELINE*/
72 72
  73 +.panel-title{ /*Because we use an outer a tag*/
  74 + color: rgba(255,255,255,.84);
  75 +}
  76 +
73 .bubble { 77 .bubble {
74 width: 100%; 78 width: 100%;
75 padding: .5em 1em; 79 padding: .5em 1em;
@@ -218,13 +222,8 @@ ul { @@ -218,13 +222,8 @@ ul {
218 transition-timing-function: ease-in; } 222 transition-timing-function: ease-in; }
219 223
220 224
221 -h3 {  
222 - font-size: 1.2em;  
223 - font-weight: bold;  
224 - font-family: 'Lato';  
225 - display: inline-block;  
226 - margin-bottom: .2em;  
227 - color: #95a5a6; } 225 +
  226 +.icon-more-horiz {margin-top: 0px; margin-bottom: 0px; padding-left: 0px;}
228 227
229 .retweet { 228 .retweet {
230 position: absolute; 229 position: absolute;
@@ -272,3 +271,35 @@ a.alert_message:hover{color : grey} @@ -272,3 +271,35 @@ a.alert_message:hover{color : grey}
272 .accordion_list { 271 .accordion_list {
273 background: #e0e0e0; 272 background: #e0e0e0;
274 } 273 }
  274 +
  275 +body .container .jumbotron-inverse, body .container .well-inverse, body .container-fluid .jumbotron-inverse, body .container-fluid .well-inverse {
  276 + background-color: white;
  277 +}
  278 +.forum_collapse {
  279 + color: #000;
  280 +}
  281 +.forum_collapse:hover, .forum_collapse:focus {
  282 + text-decoration: none;
  283 + color: #000;
  284 +}
  285 +
  286 +.timeline.post {
  287 + border-top-left-radius: 8px;
  288 + border-top-right-radius: 8px;
  289 + padding-bottom: 0px;
  290 + -webkit-padding-start: 0px !important;
  291 + width: 100%;
  292 +}
  293 +.timeline.post a {
  294 + color: #000;
  295 +}
  296 +.timeline.post li {
  297 + padding: 10px;
  298 + border-bottom: 1px solid #fff;
  299 +}
  300 +.timeline.post li:last-child {
  301 + border: none;
  302 +}
  303 +.timeline.post h3 {
  304 + margin-top: 5px;
  305 +}
275 \ No newline at end of file 306 \ No newline at end of file
core/static/css/base/header.css
@@ -10,15 +10,25 @@ @@ -10,15 +10,25 @@
10 10
11 .logo{ 11 .logo{
12 height:100%; 12 height:100%;
13 - margin-left: 30%;  
14 } 13 }
15 14
16 .link{ 15 .link{
17 - transition-duration: 0.5s; 16 + text-decoration: none;
  17 + position: relative;
18 } 18 }
19 19
20 -.link:hover{  
21 - transform:scale(1.1); 20 +.link:after{
  21 + content: '';
  22 + position: absolute;
  23 + bottom: 0;
  24 + left: 0;
  25 + width: 0%;
  26 + border-bottom: 2px solid;
  27 + transition: 0.4s;
  28 +}
  29 +
  30 +.link:hover:after{
  31 + width: 100%;
22 } 32 }
23 33
24 .notification-count{ 34 .notification-count{
core/static/img/topo-amadeus-white.png 0 → 100644

990 Bytes

core/static/js/base/amadeus.js 0 → 100644
@@ -0,0 +1,129 @@ @@ -0,0 +1,129 @@
  1 +function campoNumerico(campo, evento){
  2 + var codTecla;
  3 + var tamanho;
  4 +
  5 + if( document.all ) {// Internet Explorer
  6 + codTecla = evento.keyCode;
  7 + } else if( document.layers ) { // Nestcape
  8 + codTecla = evento.which;
  9 + }
  10 + else if( evento) { // Firefox
  11 + codTecla = evento.which;
  12 + }
  13 + if( (codTecla > 47 && codTecla < 58) || codTecla==8 || codTecla == 0){
  14 + return true;
  15 + } else {
  16 + evento.returnValue = false;
  17 + return false;
  18 + }
  19 +}
  20 +
  21 +function formatarCpf(campo, evento){
  22 + var codTecla;
  23 + var tamanho;
  24 + if( document.all ) { // Internet Explorer
  25 + codTecla = evento.keyCode;
  26 + } else if( document.layers ) { // Nestcape
  27 + codTecla = evento.which;
  28 + }
  29 + else if( evento ) { // Firefox
  30 + codTecla = evento.which;
  31 + }
  32 + tamanho = campo.value.length;
  33 + if( (codTecla > 47 && codTecla < 58) || codTecla== 8 || codTecla == 0){
  34 + if(tamanho < 14 ){
  35 + if( tamanho == 3 && codTecla != 8 && codTecla != 0){
  36 + campo.value = campo.value + ".";
  37 + }else if( tamanho == 7 && codTecla != 8 && codTecla != 0){
  38 + campo.value = campo.value + ".";
  39 + }else if( tamanho == 11 && codTecla != 8 && codTecla != 0){
  40 + campo.value = campo.value + "-";
  41 + }
  42 + }else{
  43 + evento.returnValue = false;
  44 + }
  45 + return true;
  46 + } else {
  47 + return false;
  48 + }
  49 + return false;
  50 +}
  51 +
  52 +function validarCpfSemAlert(campo,nome,idElementoMensagemErro){
  53 + //alert("teste");
  54 + cpf = campo.value;
  55 +
  56 + cpf = cpf.replace(".","");
  57 + cpf = cpf.replace("-","");
  58 + cpf = cpf.replace(".","");
  59 + retorno = true;
  60 +
  61 + if(trim(cpf).length > 0){
  62 + //alert("teste2");
  63 + cpfstr= '';
  64 + temp = cpf + '';
  65 +
  66 + cpfstr = temp.substring(0,3);
  67 + cpfstr = cpfstr + temp.substring(3,6);
  68 + cpfstr = cpfstr + temp.substring(6,9);
  69 + cpfstr = cpfstr + temp.substring(9,11);
  70 +
  71 +
  72 +
  73 + retorno = false;
  74 + if(cpf != null){
  75 + //alert("teste3");
  76 + soma = 0;
  77 + digito1 = 0;
  78 + digito2 = 0;
  79 + for(i = 0; i < 9; i = i + 1) {
  80 + soma = soma + ((parseInt(cpf.substring(i,i+1)))*(11-(i+1)));
  81 + }
  82 + soma = soma % 11;
  83 + if (soma == 0 || soma == 1) {
  84 + digito1 = 0;
  85 + } else {
  86 + digito1 = 11 - soma;
  87 + }
  88 + soma = 0;
  89 +
  90 + for(i = 0; i < 9; i = i + 1) {
  91 + soma = soma + ((parseInt(cpf.substring(i,i+1)))*(12-(i+1)));
  92 + }
  93 + soma = soma + (digito1*2);
  94 + soma = soma % 11;
  95 + if (soma == 0 || soma == 1) {
  96 + digito2 = 0;
  97 + }
  98 + else{
  99 + digito2 = 11 - soma;
  100 + }
  101 + digito = digito1 +''+ digito2;
  102 +
  103 +
  104 + //alert(cpfstr.substring(9,11));
  105 + if(digito == (cpfstr.substring(9,11))){
  106 + retorno = true;
  107 + } else{
  108 + //alert("teste4");
  109 + retorno = false;
  110 +
  111 + }
  112 + } else {
  113 + retorno = false;
  114 + }
  115 + }else{
  116 + retorno = false;
  117 + }
  118 + //alert(retorno);
  119 + if(retorno == false){
  120 + //alert('E-mail informado invalido! Por favor, especifique um E-mail válido para o campo \"' + nome + '\".');
  121 + document.getElementById(idElementoMensagemErro).style.display = '';
  122 + campo.focus();
  123 + return false;
  124 + }else{
  125 + document.getElementById(idElementoMensagemErro).style.display = 'none';
  126 + return true;
  127 + }
  128 + return retorno;
  129 +}
0 \ No newline at end of file 130 \ No newline at end of file
core/templates/base.html
@@ -32,28 +32,25 @@ @@ -32,28 +32,25 @@
32 </script> 32 </script>
33 <script src="{% static 'js/base/header.js'%}"></script> 33 <script src="{% static 'js/base/header.js'%}"></script>
34 <!--Javascript block for specific-app ones --> 34 <!--Javascript block for specific-app ones -->
35 - 35 +
36 </head> 36 </head>
37 <body> 37 <body>
38 <div class="container-fluid"> 38 <div class="container-fluid">
39 {% block nav %} 39 {% block nav %}
40 <div class="row"> 40 <div class="row">
41 - <div class="container-fluid">  
42 - <div class="row">  
43 <div class="navbar navbar-default"> 41 <div class="navbar navbar-default">
44 - <div class="container-fluid">  
45 <div class="navbar-header"> 42 <div class="navbar-header">
46 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> 43 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
47 <span class="icon-bar"></span> 44 <span class="icon-bar"></span>
48 <span class="icon-bar"></span> 45 <span class="icon-bar"></span>
49 <span class="icon-bar"></span> 46 <span class="icon-bar"></span>
50 </button> 47 </button>
51 - <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus.png' %}" alt="Logo"/></a> 48 + <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
52 </div> 49 </div>
53 <div class="navbar-collapse collapse navbar-responsive-collapse"> 50 <div class="navbar-collapse collapse navbar-responsive-collapse">
54 <ul class="nav navbar-nav navbar-right notifications"> 51 <ul class="nav navbar-nav navbar-right notifications">
55 - <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">  
56 - <a class="dropdown-toggle" data-toggle="dropdown"> <span class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell-o" aria-hidden="true"></i></a> 52 + <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
  53 + <a class="dropdown-toggle" data-toggle="dropdown"> <span class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
57 <ul id="notification-dropdown" class="dropdown-menu"> 54 <ul id="notification-dropdown" class="dropdown-menu">
58 <li class="dropdown-header">Notifications</li> 55 <li class="dropdown-header">Notifications</li>
59 {% for notification in notifications %} 56 {% for notification in notifications %}
@@ -78,7 +75,7 @@ @@ -78,7 +75,7 @@
78 <i class="material-icons">folder</i> 75 <i class="material-icons">folder</i>
79 </div> 76 </div>
80 <div class="row-content"> 77 <div class="row-content">
81 - 78 +
82 <div class="least-content pull-right">{{ notification.datetime }}</div> 79 <div class="least-content pull-right">{{ notification.datetime }}</div>
83 80
84 <p class="list-group-item-text">{{ notification.message }}</p> 81 <p class="list-group-item-text">{{ notification.message }}</p>
@@ -92,54 +89,46 @@ @@ -92,54 +89,46 @@
92 </ul> 89 </ul>
93 </li> 90 </li>
94 91
95 - <li class="link" data-toggle="tooltip" data-placement="bottom" title data-original-title="messages"> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li>  
96 - <li class="link"> <a href="{% url 'users:profile' %}">{{ user }}</a></li>  
97 - <li class="link"> <a href="{% url 'core:logout' %}">{% trans 'Log out' %}</a></li> 92 + <li data-toggle="tooltip" data-placement="bottom" title data-original-title="{% trans 'messages' %}"> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li>
  93 + <li > <a class="link" href="{% url 'users:profile' %}">{{ user }}</a></li>
  94 + <li data-toggle="tooltip" data-placement="bottom" title data-original-title="log out"> <a href="{% url 'core:logout' %}"><i class="fa fa-sign-out" aria-hidden="true"></i></a></li>
98 </ul> 95 </ul>
99 </div> 96 </div>
100 - </div>  
101 </div> 97 </div>
102 - </div>  
103 - </div>  
104 </div> 98 </div>
105 {% endblock %} 99 {% endblock %}
106 100
107 <div class="row"> 101 <div class="row">
108 - <div class="container-fluid">  
109 - <div class="row">  
110 - <div class="col-xs-* col-sm-* col-md-2"> 102 + <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
111 {% block sidebar %} 103 {% block sidebar %}
112 104
113 {% endblock %} 105 {% endblock %}
114 </div> 106 </div>
115 107
116 - <div class="col-xs-* col-sm-* col-md-10"> 108 + <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
117 {% block breadcrumbs %} 109 {% block breadcrumbs %}
118 110
119 {% endblock %} 111 {% endblock %}
120 - 112 +
121 {% block render_breadcrumbs %} 113 {% block render_breadcrumbs %}
122 114
123 {% endblock %} 115 {% endblock %}
  116 + <div class="row">
  117 + <div class="col-xs-9 col-sm-9 col-md-9 col-lg-9 col-xl-9">
  118 + {% block content %}
124 119
125 - <div class="row">  
126 - <div class="container-fluid">  
127 - <div class="col-xs-* col-sm-* col-md-8">  
128 - {% block content %} 120 + {% endblock %}
  121 + </div>
129 122
130 - {% endblock %}  
131 - </div> 123 + <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 col-xl-3">
  124 + {% block rightbar %}
  125 +
  126 + {% endblock rightbar %}
  127 + </div>
  128 + </div>
  129 + </div>
132 130
133 - <div class="col-xs-* col-sm-* col-md-4">  
134 - {% block rightbar %}  
135 131
136 - {% endblock rightbar %}  
137 - </div>  
138 - </div>  
139 - </div>  
140 - </div>  
141 - </div>  
142 - </div>  
143 </div> 132 </div>
144 </div> 133 </div>
145 134
core/templates/index.html
@@ -11,9 +11,9 @@ @@ -11,9 +11,9 @@
11 11
12 {% block content %} 12 {% block content %}
13 <div class="row"> 13 <div class="row">
14 - <div class="col-md-4 col-md-offset-4"> 14 + <div class="col-sm-4 col-sm-offset-4 col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4">
15 <div class="row"> 15 <div class="row">
16 - <div class="col-md-offset-2 col-md-8"> 16 + <div class="col-sm-8 col-sm-offset-2 col-md-offset-2 col-md-8 col-xs-8 col-xs-offset-2 col-lg-offset-2 col-lg-8 col-xl-offset-2 col-xl-8">
17 </br> 17 </br>
18 </br> 18 </br>
19 <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> 19 <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 </div> 28 </div>
29 29
30 <div class="row "> 30 <div class="row ">
31 - <div class="col-md-8 col-md-offset-2 col-sm-6 col-sm-offset-3"> 31 + <div class="col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
32 {% if message %} 32 {% if message %}
33 <div class="alert alert-danger alert-dismissible" role="alert"> 33 <div class="alert alert-danger alert-dismissible" role="alert">
34 <button type="button" class="close" data-dismiss="alert" aria-label="Close"> 34 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
@@ -45,18 +45,18 @@ @@ -45,18 +45,18 @@
45 <form id="form-login" class="form-group" method="post" action=""> 45 <form id="form-login" class="form-group" method="post" action="">
46 {% csrf_token %} 46 {% csrf_token %}
47 <div class="form-group is-empty"> 47 <div class="form-group is-empty">
48 - <label for="inputEmail" class="col-md-4 control-label"> {% trans 'Username' %}</label>  
49 - <div class="col-md-8"> 48 + <label for="inputEmail" class="col-md-4 col-xs-4 col-sm-4 col-lg-4 control-label"> {% trans 'Username' %}</label>
  49 + <div class="col-md-8 col-xs-8 col-lg-8 col-sm-8">
50 <input form="form-login" type="text" name="username" class="form-control" id="inputEmail" placeholder="Username" value="{% if username %}{{username}}{% endif %}"> 50 <input form="form-login" type="text" name="username" class="form-control" id="inputEmail" placeholder="Username" value="{% if username %}{{username}}{% endif %}">
51 </div> 51 </div>
52 </div> 52 </div>
53 <div class="form-group is-empty"> 53 <div class="form-group is-empty">
54 - <label for="inputPassword" class="col-md-4 control-label"> {% trans 'Password' %}</label>  
55 - <div class="col-md-8"> 54 + <label for="inputPassword" class="col-md-4 col-xs-4 col-lg-4 col-sm-4 control-label"> {% trans 'Password' %}</label>
  55 + <div class="col-md-8 col-xs-8 col-lg-8 col-sm-8">
56 <input form="form-login" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password"> 56 <input form="form-login" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password">
57 </div> 57 </div>
58 </div> 58 </div>
59 - <div class="col-md-10"> 59 + <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10">
60 <div class="checkbox"> 60 <div class="checkbox">
61 <label> 61 <label>
62 <input form="form-login" type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Remember Email' %} 62 <input form="form-login" type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Remember Email' %}
@@ -66,25 +66,21 @@ @@ -66,25 +66,21 @@
66 </form> 66 </form>
67 {# </div> #} 67 {# </div> #}
68 {# <div class="row"> #} 68 {# <div class="row"> #}
69 - <div class="col-md-10"> 69 + <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10">
70 <a href="{% url 'core:remember_password' %}">Forgot your password?</a> 70 <a href="{% url 'core:remember_password' %}">Forgot your password?</a>
71 </div> 71 </div>
72 {# </div> #} 72 {# </div> #}
73 {# <div class="row"> #} 73 {# <div class="row"> #}
74 - <div class="col-md-6 col-xs-6 text-center"> 74 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-6 text-center">
75 <button type="button" class="btn btn-flat" formaction="#" style="position: initial;">{% trans 'Guest' %}</button> 75 <button type="button" class="btn btn-flat" formaction="#" style="position: initial;">{% trans 'Guest' %}</button>
76 </div> 76 </div>
77 - <div class="col-md-6 col-xs-6 text-center"> 77 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-6 text-center">
78 <button type="submite" class="btn btn-flat btn-success" form="form-login" style="position: initial;">{% trans 'Login' %}</button> 78 <button type="submite" class="btn btn-flat btn-success" form="form-login" style="position: initial;">{% trans 'Login' %}</button>
79 </div> 79 </div>
80 {# </div> #} 80 {# </div> #}
81 </div> 81 </div>
82 </div> 82 </div>
83 - </div>  
84 - </div>  
85 - <div class="row">  
86 - <div class="col-lg-offset-2 col-lg-8 col-md-8 col-md-offset-2 col-sm-6 col-sm-offset-3">  
87 - <a class="btn btn-raised btn-primary btn-lg btn-block" href="{% url 'core:register' %}">{% trans 'Sign Up' %} </a> 83 + <a class="btn btn-raised btn-primary btn-block" href="{% url 'core:register' %}">{% trans 'Sign Up' %} </a>
88 </div> 84 </div>
89 </div> 85 </div>
90 </div> 86 </div>
core/templates/register_user.html
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 </span> 45 </span>
46 </div> 46 </div>
47 {% else %} 47 {% else %}
48 - {% render_field field class='form-control input-sm' %} 48 + {% render_field field class='form-control' %}
49 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 49 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
50 {% endif %} 50 {% endif %}
51 </div> 51 </div>
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
68 <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> 68 <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" />
69 </div> 69 </div>
70 <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> 70 <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2">
71 - <a href="{% url 'core:home' %}" class="btn btn-sm btn-success" >{% trans 'Login' %}</a> 71 + <a href="{% url 'core:home' %}" class="btn btn-sm btn-success" >{% trans 'Register' %}</a>
72 </div> 72 </div>
73 73
74 </form> 74 </form>
core/templates/remember_password.html
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 {% block content%} 3 {% block content%}
4 4
5 <div class="row"> 5 <div class="row">
6 - <div class="col-md-4 col-md-offset-4"> 6 + <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4">
7 <div class="row"> 7 <div class="row">
8 - <div class="col-md-offset-2 col-md-8"> 8 + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8">
9 </br> 9 </br>
10 </br> 10 </br>
11 <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> 11 <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 </div> 14 </div>
15 </div> 15 </div>
16 <div class="row "> 16 <div class="row ">
17 - <div class="col-lg-9 col-lg-offset-2"> 17 + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2">
18 {% if success %} 18 {% if success %}
19 <div class="alert alert-success alert-dismissible" role="alert"> 19 <div class="alert alert-success alert-dismissible" role="alert">
20 <button type="button" class="close" data-dismiss="alert" aria-label="Close"> 20 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
@@ -36,23 +36,19 @@ @@ -36,23 +36,19 @@
36 {% endif %} 36 {% endif %}
37 <div class="card"> 37 <div class="card">
38 <div class="card-block"> 38 <div class="card-block">
39 - <div class="col-md-12"> 39 + <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12 col-xl-12">
40 <form class="form-group " method="post" action=""> 40 <form class="form-group " method="post" action="">
41 {% csrf_token %} 41 {% csrf_token %}
42 <div class="form-group is-empty"> 42 <div class="form-group is-empty">
43 <label for="inputEmail" class="ccontrol-label"> {% trans 'E-mail' %}</label> 43 <label for="inputEmail" class="ccontrol-label"> {% trans 'E-mail' %}</label>
44 - {# <div class="col-md-8"> #}  
45 <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{email}}"{% endif %}> 44 <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{email}}"{% endif %}>
46 - {# </div> #}  
47 </div> 45 </div>
48 <div class="form-group is-empty"> 46 <div class="form-group is-empty">
49 <label for="inputRegistration" class="control-label"> {% trans 'Registration' %} </label> 47 <label for="inputRegistration" class="control-label"> {% trans 'Registration' %} </label>
50 - {# <div class="col-md-8"> #}  
51 - <input name="registration" type="text" class="col-md-4 form-control" id="inputRegistration" placeholder="Registration" {% if registration %}value="{{registration}}"{% endif %}>  
52 - {# </div> #} 48 + <input name="registration" type="text" class="col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4 form-control" id="inputRegistration" placeholder="Registration" {% if registration %}value="{{registration}}"{% endif %}>
53 </div> 49 </div>
54 - <div class="col-lg-offset-4 col-lg-4">  
55 - <button type="submite" class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Send' %}</button> 50 + <div class="col-lg-offset-4 col-lg-4 col-xs-offset-4 col-xs-4 col-sm-offset-4 col-sm-4 col-md-offset-4 col-md-4 col-xl-offset-4 col-xl-4">
  51 + <button type="submite" class="btn btn-raised btn-primary btn-block">{% trans 'Send' %}</button>
56 52
57 </div> 53 </div>
58 </form> 54 </form>
courses/locale/he_il/LC_MESSAGES/django.po 0 → 100644
@@ -0,0 +1,229 @@ @@ -0,0 +1,229 @@
  1 +# SOME DESCRIPTIVE TITLE.
  2 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  3 +# This file is distributed under the same license as the PACKAGE package.
  4 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5 +#
  6 +#, fuzzy
  7 +msgid ""
  8 +msgstr ""
  9 +"Project-Id-Version: PACKAGE VERSION\n"
  10 +"Report-Msgid-Bugs-To: \n"
  11 +"POT-Creation-Date: 2016-09-16 02:41-0300\n"
  12 +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  13 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  14 +"Language-Team: LANGUAGE <LL@li.org>\n"
  15 +"Language: \n"
  16 +"MIME-Version: 1.0\n"
  17 +"Content-Type: text/plain; charset=UTF-8\n"
  18 +"Content-Transfer-Encoding: 8bit\n"
  19 +
  20 +#: courses/templates/category/create.html:8
  21 +#: courses/templates/category/delete.html:7
  22 +#: courses/templates/category/index.html:7
  23 +#: courses/templates/category/update.html:8
  24 +#: courses/templates/category/view.html:7
  25 +#: courses/templates/course/create.html:8
  26 +#: courses/templates/course/delete.html:7 courses/templates/course/home.html:8
  27 +#: courses/templates/course/update.html:8
  28 +#: courses/templates/course/view.html:39
  29 +#: courses/templates/subject/index.html:8
  30 +msgid "Home"
  31 +msgstr ""
  32 +
  33 +#: courses/templates/category/create.html:9
  34 +#: courses/templates/category/delete.html:18
  35 +#: courses/templates/category/index.html:18
  36 +#: courses/templates/category/view.html:18
  37 +msgid "Create Category"
  38 +msgstr ""
  39 +
  40 +#: courses/templates/category/create.html:16
  41 +#: courses/templates/category/delete.html:15
  42 +#: courses/templates/category/index.html:15
  43 +#: courses/templates/category/update.html:16
  44 +#: courses/templates/category/view.html:15
  45 +msgid "Categories"
  46 +msgstr ""
  47 +
  48 +#: courses/templates/category/create.html:26
  49 +#: courses/templates/category/update.html:26
  50 +#: courses/templates/course/create.html:26
  51 +#: courses/templates/course/update.html:32
  52 +msgid "All fields are required"
  53 +msgstr ""
  54 +
  55 +#: courses/templates/category/create.html:51
  56 +#: courses/templates/category/update.html:51
  57 +#: courses/templates/course/create.html:51
  58 +#: courses/templates/course/update.html:57
  59 +msgid "Save"
  60 +msgstr ""
  61 +
  62 +#: courses/templates/category/delete.html:8
  63 +#: courses/templates/category/index.html:8
  64 +msgid "Manage Categories"
  65 +msgstr ""
  66 +
  67 +#: courses/templates/category/delete.html:26
  68 +#: courses/templates/subject/delete.html:11
  69 +msgid "Are you sure you want to delete the category"
  70 +msgstr ""
  71 +
  72 +#: courses/templates/category/delete.html:27
  73 +#: courses/templates/course/delete.html:28
  74 +#: courses/templates/subject/delete.html:12
  75 +msgid "Yes"
  76 +msgstr ""
  77 +
  78 +#: courses/templates/category/delete.html:28
  79 +#: courses/templates/course/delete.html:29
  80 +#: courses/templates/subject/delete.html:13
  81 +msgid "No"
  82 +msgstr ""
  83 +
  84 +#: courses/templates/category/index.html:38
  85 +msgid "Name"
  86 +msgstr ""
  87 +
  88 +#: courses/templates/category/index.html:39
  89 +msgid "Slug"
  90 +msgstr ""
  91 +
  92 +#: courses/templates/category/index.html:40
  93 +msgid "Actions"
  94 +msgstr ""
  95 +
  96 +#: courses/templates/category/index.html:59
  97 +msgid "No categories found"
  98 +msgstr ""
  99 +
  100 +#: courses/templates/category/update.html:9
  101 +#: courses/templates/category/view.html:21
  102 +msgid "Edit Category"
  103 +msgstr ""
  104 +
  105 +#: courses/templates/category/view.html:24
  106 +msgid "Remove Category"
  107 +msgstr ""
  108 +
  109 +#: courses/templates/category/view.html:32
  110 +msgid "Name:"
  111 +msgstr ""
  112 +
  113 +#: courses/templates/category/view.html:33
  114 +msgid "Slug:"
  115 +msgstr ""
  116 +
  117 +#: courses/templates/course/create.html:9
  118 +#: courses/templates/course/delete.html:18
  119 +#: courses/templates/course/filtered.html:11
  120 +#: courses/templates/course/index.html:19
  121 +msgid "Create Course"
  122 +msgstr ""
  123 +
  124 +#: courses/templates/course/create.html:16
  125 +#: courses/templates/course/delete.html:15
  126 +#: courses/templates/course/filtered.html:8
  127 +#: courses/templates/course/home.html:16
  128 +#: courses/templates/course/index.html:16
  129 +#: courses/templates/course/update.html:16
  130 +#: courses/templates/course/view.html:48
  131 +msgid "Courses"
  132 +msgstr ""
  133 +
  134 +#: courses/templates/course/delete.html:27
  135 +msgid "Are you sure you want to delete the couse"
  136 +msgstr ""
  137 +
  138 +#: courses/templates/course/filtered.html:19
  139 +#: courses/templates/course/index.html:27
  140 +msgid "Categories:"
  141 +msgstr ""
  142 +
  143 +#: courses/templates/course/home.html:9
  144 +msgid "Home Course"
  145 +msgstr ""
  146 +
  147 +#: courses/templates/course/index.html:81
  148 +msgid "students tops"
  149 +msgstr ""
  150 +
  151 +#: courses/templates/course/index.html:87
  152 +msgid "Subscribe Period:"
  153 +msgstr ""
  154 +
  155 +#: courses/templates/course/index.html:89
  156 +msgid "Period:"
  157 +msgstr ""
  158 +
  159 +#: courses/templates/course/index.html:105
  160 +msgid "No courses found"
  161 +msgstr ""
  162 +
  163 +#: courses/templates/course/update.html:9
  164 +msgid "Edit Course"
  165 +msgstr ""
  166 +
  167 +#: courses/templates/course/update.html:19
  168 +msgid "Manage Modules"
  169 +msgstr ""
  170 +
  171 +#: courses/templates/course/update.html:22
  172 +msgid "Participants"
  173 +msgstr ""
  174 +
  175 +#: courses/templates/course/view.html:40
  176 +msgid "Profile"
  177 +msgstr ""
  178 +
  179 +#: courses/templates/course/view.html:62
  180 +msgid "Subjects"
  181 +msgstr ""
  182 +
  183 +#: courses/templates/course/view.html:85
  184 +msgid "Professor"
  185 +msgstr ""
  186 +
  187 +#: courses/templates/course/view.html:88
  188 +msgid "Description"
  189 +msgstr ""
  190 +
  191 +#: courses/templates/course/view.html:110
  192 +#: courses/templates/subject/index.html:78
  193 +msgid "Pending Stuffs"
  194 +msgstr ""
  195 +
  196 +#: courses/templates/course/view.html:113
  197 +msgid "No pending tasks at the moment."
  198 +msgstr ""
  199 +
  200 +#: courses/templates/subject/create.html:20
  201 +#: courses/templates/topic/create.html:20
  202 +msgid "Create"
  203 +msgstr ""
  204 +
  205 +#: courses/templates/subject/form_view_teacher.html:10
  206 +#: courses/templates/subject/index.html:47
  207 +msgid "edit"
  208 +msgstr ""
  209 +
  210 +#: courses/templates/subject/index.html:10
  211 +msgid "Manage Subjects"
  212 +msgstr ""
  213 +
  214 +#: courses/templates/subject/index.html:34
  215 +msgid "Create Subject"
  216 +msgstr ""
  217 +
  218 +#: courses/templates/subject/index.html:52
  219 +msgid "delete"
  220 +msgstr ""
  221 +
  222 +#: courses/templates/subject/index.html:71
  223 +msgid "Create Topic"
  224 +msgstr ""
  225 +
  226 +#: courses/templates/subject/update.html:20
  227 +#: courses/templates/topic/update.html:20
  228 +msgid "Update"
  229 +msgstr ""
courses/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-20 13:57 2 +# Generated by Django 1.10 on 2016-09-22 05:46
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import autoslug.fields 5 import autoslug.fields
@@ -13,8 +13,8 @@ class Migration(migrations.Migration): @@ -13,8 +13,8 @@ class Migration(migrations.Migration):
13 initial = True 13 initial = True
14 14
15 dependencies = [ 15 dependencies = [
16 - ('core', '0001_initial'),  
17 migrations.swappable_dependency(settings.AUTH_USER_MODEL), 16 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  17 + ('core', '0001_initial'),
18 ] 18 ]
19 19
20 operations = [ 20 operations = [
@@ -37,8 +37,8 @@ class Migration(migrations.Migration): @@ -37,8 +37,8 @@ class Migration(migrations.Migration):
37 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), 37 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')),
38 ], 38 ],
39 options={ 39 options={
40 - 'verbose_name': 'Category',  
41 'verbose_name_plural': 'Categories', 40 'verbose_name_plural': 'Categories',
  41 + 'verbose_name': 'Category',
42 }, 42 },
43 ), 43 ),
44 migrations.CreateModel( 44 migrations.CreateModel(
@@ -61,9 +61,9 @@ class Migration(migrations.Migration): @@ -61,9 +61,9 @@ class Migration(migrations.Migration):
61 ('students', models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), 61 ('students', models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
62 ], 62 ],
63 options={ 63 options={
64 - 'verbose_name': 'Course',  
65 'verbose_name_plural': 'Courses', 64 'verbose_name_plural': 'Courses',
66 'ordering': ('create_date', 'name'), 65 'ordering': ('create_date', 'name'),
  66 + 'verbose_name': 'Course',
67 }, 67 },
68 ), 68 ),
69 migrations.CreateModel( 69 migrations.CreateModel(
@@ -91,9 +91,9 @@ class Migration(migrations.Migration): @@ -91,9 +91,9 @@ class Migration(migrations.Migration):
91 ('professors', models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), 91 ('professors', models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')),
92 ], 92 ],
93 options={ 93 options={
94 - 'verbose_name': 'Subject',  
95 'verbose_name_plural': 'Subjects', 94 'verbose_name_plural': 'Subjects',
96 'ordering': ('create_date', 'name'), 95 'ordering': ('create_date', 'name'),
  96 + 'verbose_name': 'Subject',
97 }, 97 },
98 ), 98 ),
99 migrations.CreateModel( 99 migrations.CreateModel(
@@ -110,9 +110,9 @@ class Migration(migrations.Migration): @@ -110,9 +110,9 @@ class Migration(migrations.Migration):
110 ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), 110 ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')),
111 ], 111 ],
112 options={ 112 options={
113 - 'verbose_name': 'Topic',  
114 'verbose_name_plural': 'Topics', 113 'verbose_name_plural': 'Topics',
115 'ordering': ('create_date', 'name'), 114 'ordering': ('create_date', 'name'),
  115 + 'verbose_name': 'Topic',
116 }, 116 },
117 ), 117 ),
118 migrations.AddField( 118 migrations.AddField(
courses/templates/course/index.html
@@ -52,50 +52,75 @@ @@ -52,50 +52,75 @@
52 52
53 {% if courses|length > 0 %} 53 {% if courses|length > 0 %}
54 {% for course in courses %} 54 {% for course in courses %}
55 - <div class="row well well-inverse">  
56 - <div class="col-md-2">  
57 - {% if course.image %}  
58 - <img src="{{ course.image.url }}" class="img-responsive" />  
59 - {% else %}  
60 - <img src="" class="img-responsive" />  
61 - {% endif %}  
62 - </div> 55 + <div class="col-md-12">
  56 + <div class="panel panel-info">
  57 + <!--{% if course.image %}
  58 + <img src="{{ course.image_url }}" class="img-responsive" />
  59 + {% else %}
  60 + <img src="" class="img-responsive" />
  61 + {% endif %} -->
  62 + <div class="panel-heading">
  63 + <h3 class="panel-title">Course</h3>
  64 + <span class="label label-info">{{ course.category }}</span>
  65 + <span class="label label-warning">{{ course.max_students }} {% trans 'students tops' %}</span>
  66 + </div>
  67 + <div class="panel-body">
  68 + <p><b>Course Name: </b>{{ course.name }}</p>
  69 + <p><b>Duration (in semesters): </b>09</p>
  70 + <p><b>Coordinator: </b>Alan Turing</p>
  71 + <p>
  72 + <b>Description:</b>
  73 + <i>
  74 + "Lorem ipsum dolor sit amet, consecctetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
  75 + </i>
  76 + </p>
  77 +
  78 + {% if user|has_role:'professor, system_admin' %}
  79 + <a href="{% url 'course:update' course.slug %}" class="btn btn-sm btn-primary">
  80 + <span class="glyphicon glyphicon-edit"></span>
  81 + </a>
  82 + <a href="{% url 'course:delete' course.slug %}" class="btn btn-sm btn-danger">
  83 + <span class="glyphicon glyphicon-trash"></span>
  84 + </a>
  85 + {% endif %}
  86 +
  87 + <a href="course_detail_student.html" class="btn btn-raised btn-default center-block">View Course</a>
  88 +
  89 + </div>
  90 + </div>
  91 + </div>
  92 + <div class="row">
63 <div class="col-md-10"> 93 <div class="col-md-10">
64 <div class="row"> 94 <div class="row">
65 - <div class="col-md-12"> 95 + <!--<div class="col-md-12">
66 <div class="pull-right"> 96 <div class="pull-right">
67 <a href="{% url 'course:view' course.slug %}" class="btn btn-sm btn-info"> 97 <a href="{% url 'course:view' course.slug %}" class="btn btn-sm btn-info">
68 <span class="glyphicon glyphicon-eye-open"></span> 98 <span class="glyphicon glyphicon-eye-open"></span>
69 </a> 99 </a>
70 - {% if user|has_role:'professor, system_admin' %}  
71 - <a href="{% url 'course:update' course.slug %}" class="btn btn-sm btn-primary">  
72 - <span class="glyphicon glyphicon-edit"></span>  
73 - </a>  
74 - <a href="{% url 'course:delete' course.slug %}" class="btn btn-sm btn-danger">  
75 - <span class="glyphicon glyphicon-trash"></span>  
76 - </a>  
77 - {% endif %} 100 +
78 </div> 101 </div>
79 <h4> 102 <h4>
80 <a href="{% url 'course:view' course.slug %}"> 103 <a href="{% url 'course:view' course.slug %}">
81 {{ course }} 104 {{ course }}
82 </a> 105 </a>
83 </h4> 106 </h4>
84 - <span class="label label-info">{{ course.category }}</span>  
85 - <span class="label label-warning">{{ course.max_students }} {% trans 'students tops' %}</span> 107 +
86 <small> 108 <small>
87 <em>{{ course.objectivies|linebreaks }}</em> 109 <em>{{ course.objectivies|linebreaks }}</em>
88 </small> 110 </small>
89 </div> 111 </div>
90 - <div class="col-md-12"> 112 + <div class="col-md-12">
91 <strong>{% trans 'Subscribe Period:' %} </strong> <em>de</em> <u>{{ course.init_register_date }}</u> <em>até</em> <u>{{ course.end_register_date }}</u> 113 <strong>{% trans 'Subscribe Period:' %} </strong> <em>de</em> <u>{{ course.init_register_date }}</u> <em>até</em> <u>{{ course.end_register_date }}</u>
92 <br /> 114 <br />
93 <strong>{% trans 'Period:' %} </strong> <em>de</em> <u>{{ course.init_date }}</u> <em>até</em> <u>{{ course.end_date }}</u> 115 <strong>{% trans 'Period:' %} </strong> <em>de</em> <u>{{ course.init_date }}</u> <em>até</em> <u>{{ course.end_date }}</u>
94 - </div> 116 + </div> -->
95 </div> 117 </div>
96 </div> 118 </div>
97 </div> 119 </div>
  120 +
98 {% endfor %} 121 {% endfor %}
  122 +
  123 +
99 <nav aria-label="Page navigation"> 124 <nav aria-label="Page navigation">
100 <ul class="pagination"> 125 <ul class="pagination">
101 {% for page_number in paginator.page_range %} 126 {% for page_number in paginator.page_range %}
courses/templates/course/update.html
1 {% extends 'course/view.html' %} 1 {% extends 'course/view.html' %}
2 2
3 {% load static i18n %} 3 {% load static i18n %}
4 -{% load widget_tweaks %} 4 +{% load widget_tweaks django_bootstrap_breadcrumbs %}
5 5
6 {% block breadcrumbs %} 6 {% block breadcrumbs %}
7 - <ol class="breadcrumb">  
8 - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li>  
9 - <li class="active">{% trans 'Edit Course' %}</li>  
10 - </ol> 7 + {{ block.super }}
  8 + {% breadcrumb 'Update' 'course:update' %}
11 {% endblock %} 9 {% endblock %}
12 {% block content %} 10 {% block content %}
13 11
courses/templates/course/view.html
@@ -59,26 +59,71 @@ @@ -59,26 +59,71 @@
59 {% endblock %} 59 {% endblock %}
60 60
61 {% block content %} 61 {% block content %}
62 -<h3>{% trans "Subjects" %}</h3> 62 +
  63 +<div class="panel panel-info">
  64 + <div class="panel-heading">
  65 + <div class="row">
  66 + <div class="col-xs-10 col-md-11">
  67 + <h3 class="panel-title">{{course.name}}</h3>
  68 + </div>
  69 + <div class="col-xs-2 col-md-1">
  70 + {% if user|has_role:'professor, system_admin' %}
  71 +
  72 + <div class="btn-group icon-more-horiz">
  73 + <button class="btn btn-default btn-xs dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  74 + <i class="material-icons">more_horiz</i>
  75 + </button>
  76 + <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
  77 + <li><a href="javascript:void(0)"><i class="material-icons">create</i> Edit</a></li>
  78 + <li><a href="javascript:void(0)"><i class="material-icons">delete_sweep</i> Remove</a></li>
  79 + </ul>
  80 +
  81 + </div>
  82 + {% endif %}
  83 + </div>
  84 + </div>
  85 + </div>
  86 + <div class="panel-body">
  87 + <p><b>Course Name: </b>{{course.name}}</p>
  88 + <p><b>Duration (in semesters): </b></p>
  89 + {% for professor in course.professors.all %}
  90 + <p><b>Professor: </b>{{professor.name}}</p>
  91 + {% endfor %}
  92 +
  93 + <p>
  94 + <b>Description:</b>
  95 + <i>
  96 + {{course.content}}
  97 + </i>
  98 + </p>
  99 +
  100 + </div>
  101 +</div>
  102 +
  103 +
63 {% for subject in subjects %} 104 {% for subject in subjects %}
64 <div class="panel panel-info"> 105 <div class="panel panel-info">
65 <div class="panel-heading"> 106 <div class="panel-heading">
66 <div class="row"> 107 <div class="row">
67 <a href="{% url 'course:view_subject' subject.slug %}"> 108 <a href="{% url 'course:view_subject' subject.slug %}">
68 - <div class="col-md-10"> 109 + <div class="col-md-11">
69 110
70 <h3 class="panel-title">{{subject}}</h3> 111 <h3 class="panel-title">{{subject}}</h3>
71 112
72 </div> 113 </div>
73 </a> 114 </a>
74 - <div class="col-md-2 text-right"> 115 + <div class="col-md-1 text-right">
75 {% if user|has_role:'professor, system_admin' %} 116 {% if user|has_role:'professor, system_admin' %}
76 - <a href="{% url 'course:update_subject' subject.slug %}" style="padding: 3px; margin: 3px;" class="btn btn-sm btn-default">  
77 - <span class="glyphicon glyphicon-edit"></span>  
78 - </a>  
79 - <a href="{% url 'course:delete_subject' subject.slug %}" style="padding: 3px; margin: 3px;" class="btn btn-sm btn-danger">  
80 - <span class="glyphicon glyphicon-trash"></span>  
81 - </a> 117 + <div class="btn-group icon-more-horiz">
  118 + <button class="btn btn-default btn-xs dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  119 + <i class="material-icons">more_horiz</i>
  120 + </button>
  121 + <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
  122 + <li><a href="{% url 'course:update_subject' subject.slug %}"><i class="material-icons">create</i> {% trans "Edit" %}</a></li>
  123 + <li><a href="{% url 'course:delete_subject' subject.slug %}"><i class="material-icons">delete_sweep</i> {% trans "Remove" %}</a></li>
  124 + </ul>
  125 +
  126 + </div>
82 {% endif %} 127 {% endif %}
83 </div> 128 </div>
84 </div> 129 </div>
courses/templates/subject/form_view_student.html
1 {% load i18n %} 1 {% load i18n %}
2 2
3 <div class="panel panel-default"> 3 <div class="panel panel-default">
4 - <a href="{% url 'course:view_topic' topic.slug %}">  
5 - <div class="panel-heading">  
6 - <div class="row">  
7 - <div class="col-md-9 col-sm-9">  
8 - <h3>{{topic}}</h3>  
9 - </div>  
10 - </div>  
11 - </div>  
12 - </a>  
13 - </div>  
14 -  
15 - <div class="panel-body">  
16 - <p>{{topic.description|linebreaks}}</p>  
17 - </div> 4 + <a href="{% url 'course:view_topic' topic.slug %}">
  5 + <div class="panel-heading">
  6 + <div class="row">
  7 + <div class="col-md-9 col-sm-9">
  8 + <h3>{{topic}}</h3>
  9 + </div>
  10 + </div>
  11 + </div>
  12 + </a>
18 </div> 13 </div>
  14 +<div class="panel-body">
  15 + <p>{{topic.description|linebreaks}}</p>
  16 +</div>
19 \ No newline at end of file 17 \ No newline at end of file
courses/templates/subject/form_view_teacher.html
1 -{% load i18n %} 1 +{% load static i18n %}
  2 +
  3 +{% block javascript %}
  4 + <script type="text/javascript" src="{% static 'js/forum.js' %}"></script>
  5 +{% endblock %}
2 6
3 <div class="panel panel-default"> 7 <div class="panel panel-default">
4 - <a href="{% url 'course:view_topic' topic.slug %}">  
5 - <div class="panel-heading">  
6 - <div class="row">  
7 - <div class="col-md-9 col-sm-9">  
8 - <h3>{{topic}}</h3>  
9 - </div>  
10 - <div class="col-md-3 col-sm-3">  
11 - <a href="{% url 'course:update_topic' topic.slug%}" class="btn">{% trans "edit" %}</a>  
12 - </div> 8 + <a href="{% url 'course:view_topic' topic.slug %}">
  9 + <div class="panel-heading">
  10 + <div class="row">
  11 + <div class="col-md-9 col-sm-9">
  12 + <h3>{{ topic }}</h3>
  13 + </div>
  14 + <div class="col-md-3 col-sm-3">
  15 + <a href="{% url 'course:update_topic' topic.slug%}" class="btn">{% trans "edit" %}</a>
  16 + </div>
  17 + </div>
  18 + </div>
  19 + </a>
  20 + <div class="panel-body">
  21 + <p>{{ topic.description|linebreaks }}</p>
  22 + <a href="javascript:showForum('{% url 'forum:index' %}', '{{topic.slug}}')">Forum</a>
13 </div> 23 </div>
14 - </div>  
15 - </a>  
16 - <div class="panel-body">  
17 - <p>{{topic.description|linebreaks}}</p>  
18 - </div>  
19 </div> 24 </div>
  25 +
  26 +<div class="modal fade" id="forumModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  27 + <div class="modal-dialog" role="document">
  28 + <div class="modal-content">
  29 + <div class="modal-header">
  30 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  31 + <h4 class="modal-title" id="myModalLabel">
  32 + <button type="button" class="btn btn-primary btn-sm" onclick="getForm('{% url 'forum:create' %}');"><i class="fa fa-plus"></i> {% trans 'Create Forum' %}</button>
  33 + </h4>
  34 + </div>
  35 + <div class="modal-body">
  36 + <div class="forum_form" style="display:none">
  37 + </div>
  38 + <div class="forum_topics">
  39 + </div>
  40 + </div>
  41 + </div>
  42 + </div>
  43 +</div>
20 \ No newline at end of file 44 \ No newline at end of file
courses/templates/subject/index.html
@@ -41,37 +41,39 @@ @@ -41,37 +41,39 @@
41 {% endblock %} 41 {% endblock %}
42 42
43 {% block content %} 43 {% block content %}
44 - <div class="panel panel-info">  
45 - <div class="panel-heading"> 44 + <div class="panel panel-info">
  45 + <div class="panel-heading">
46 <div class="row"> 46 <div class="row">
47 - <div class="col-md-7 col-sm-7">  
48 - <h3>{{subject}}</h3>  
49 - </div>  
50 - <div class="col-md-2 col-sm-2"> 47 + <div class="col-md-7 col-sm-7">
  48 + <h3>{{subject}}</h3>
  49 + </div>
  50 + <div class="col-md-2 col-sm-2">
51 {% if user|has_role:'system_admin' or user in subject.professors %} 51 {% if user|has_role:'system_admin' or user in subject.professors %}
52 - <a href="{% url 'course:update_subject' subject.slug%}" class="btn">{% trans "edit" %}</a> 52 + <a href="{% url 'course:update_subject' subject.slug%}" class="btn">{% trans "edit" %}</a>
53 {% endif %} 53 {% endif %}
54 - </div> 54 + </div>
55 <div class="col-md-3 col-sm-3"> 55 <div class="col-md-3 col-sm-3">
56 {% if user|has_role:'system_admin' or user in subject.professors %} 56 {% if user|has_role:'system_admin' or user in subject.professors %}
57 - <a href="{% url 'course:delete_subject' subject.slug%}" class="btn">{% trans "delete" %}</a> 57 + <a href="{% url 'course:delete_subject' subject.slug%}" class="btn">{% trans "delete" %}</a>
58 {% endif %} 58 {% endif %}
59 - </div>  
60 - </div>  
61 - </div>  
62 - <div class="panel-body">  
63 - <p>  
64 - {{subject.description|linebreaks}}  
65 - </p>  
66 - </div>  
67 - </div>  
68 -{% for topic in topics %}  
69 - {% if user|has_role:'system_admin' or topic.owner == user%}  
70 - {% include "subject/form_view_teacher.html" %}  
71 - {% else %}  
72 - {% include "subject/form_view_student.html" %}  
73 - {% endif %}  
74 -{% endfor %} 59 + </div>
  60 + </div>
  61 + </div>
  62 + <div class="panel-body">
  63 + <p>
  64 + {{subject.description|linebreaks}}
  65 + </p>
  66 + </div>
  67 + </div>
  68 +
  69 + {% for topic in topics %}
  70 + {% if user|has_role:'system_admin' or topic.owner == user%}
  71 + {% include "subject/form_view_teacher.html" %}
  72 + {% else %}
  73 + {% include "subject/form_view_student.html" %}
  74 + {% endif %}
  75 + {% endfor %}
  76 +
75 {% if user|has_role:'system_admin' or topic.owner == user%} 77 {% if user|has_role:'system_admin' or topic.owner == user%}
76 <a name="create_topic" class="btn btn-primary btn-md btn-block" href="{% url 'course:create_topic' subject.slug %}">{% trans "Create Topic" %}</a> 78 <a name="create_topic" class="btn btn-primary btn-md btn-block" href="{% url 'course:create_topic' subject.slug %}">{% trans "Create Topic" %}</a>
77 {% endif %} 79 {% endif %}
courses/views.py
@@ -281,7 +281,7 @@ class TopicsView(LoginRequiredMixin, generic.ListView): @@ -281,7 +281,7 @@ class TopicsView(LoginRequiredMixin, generic.ListView):
281 def get_queryset(self): 281 def get_queryset(self):
282 topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) 282 topic = get_object_or_404(Topic, slug = self.kwargs.get('slug'))
283 subject = topic.subject 283 subject = topic.subject
284 - context = subject.topics.filter(visible=True) 284 + context = Topic.objects.filter(subject = subject, visible=True)
285 #if (self.request.user in subject.professors.all() or has_role(self.request.user,'system_admin')): 285 #if (self.request.user in subject.professors.all() or has_role(self.request.user,'system_admin')):
286 #context = subject.topics.all() <- Change it By Activities 286 #context = subject.topics.all() <- Change it By Activities
287 return context 287 return context
forum/admin.py
1 from django.contrib import admin 1 from django.contrib import admin
2 2
3 -# Register your models here. 3 +from .models import Forum, Post, PostAnswer
  4 +
  5 +class ForumAdmin(admin.ModelAdmin):
  6 + list_display = ['name', 'slug']
  7 + search_fields = ['name', 'slug']
  8 +
  9 +class PostAdmin(admin.ModelAdmin):
  10 + list_display = ['user', 'forum']
  11 + search_fields = ['user', 'forum']
  12 +
  13 +class PostAnswerAdmin(admin.ModelAdmin):
  14 + list_display = ['user', 'post', 'answer_date']
  15 + search_fields = ['user']
  16 +
  17 +admin.site.register(Forum, ForumAdmin)
  18 +admin.site.register(Post, PostAdmin)
  19 +admin.site.register(PostAnswer, PostAnswerAdmin)
4 \ No newline at end of file 20 \ No newline at end of file
forum/forms.py 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +from django import forms
  2 +from django.utils.translation import ugettext_lazy as _
  3 +from .models import Forum
  4 +
  5 +class ForumForm(forms.ModelForm):
  6 +
  7 + class Meta:
  8 + model = Forum
  9 + fields = ('name', 'description')
  10 + labels = {
  11 + 'name': _('Title'),
  12 + 'description': _('Description')
  13 + }
  14 + help_texts = {
  15 + 'name': _('Forum title'),
  16 + 'description': _('What is this forum about?')
  17 + }
  18 + widgets = {
  19 + 'description': forms.Textarea(attrs={'cols': 80, 'rows': 5}),
  20 + }
0 \ No newline at end of file 21 \ No newline at end of file
forum/migrations/0001_initial.py 0 → 100644
@@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-09-22 20:41
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.conf import settings
  6 +from django.db import migrations, models
  7 +import django.db.models.deletion
  8 +
  9 +
  10 +class Migration(migrations.Migration):
  11 +
  12 + initial = True
  13 +
  14 + dependencies = [
  15 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  16 + ('courses', '0001_initial'),
  17 + ]
  18 +
  19 + operations = [
  20 + migrations.CreateModel(
  21 + name='Forum',
  22 + fields=[
  23 + ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity')),
  24 + ('title', models.CharField(max_length=100, verbose_name='Title')),
  25 + ('description', models.TextField(blank=True, verbose_name='Description')),
  26 + ],
  27 + options={
  28 + 'verbose_name': 'Forum',
  29 + 'verbose_name_plural': 'Foruns',
  30 + },
  31 + bases=('courses.activity',),
  32 + ),
  33 + migrations.CreateModel(
  34 + name='Post',
  35 + fields=[
  36 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  37 + ('message', models.TextField(verbose_name='Post message')),
  38 + ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')),
  39 + ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')),
  40 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
  41 + ],
  42 + options={
  43 + 'verbose_name': 'Post',
  44 + 'verbose_name_plural': 'Posts',
  45 + },
  46 + ),
  47 + migrations.CreateModel(
  48 + name='PostAnswer',
  49 + fields=[
  50 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  51 + ('message', models.TextField(verbose_name='Answer message')),
  52 + ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')),
  53 + ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')),
  54 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
  55 + ],
  56 + options={
  57 + 'verbose_name': 'Post Answer',
  58 + 'verbose_name_plural': 'Post Answers',
  59 + },
  60 + ),
  61 + ]
forum/migrations/0002_remove_forum_title.py 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-09-22 20:43
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations
  6 +
  7 +
  8 +class Migration(migrations.Migration):
  9 +
  10 + dependencies = [
  11 + ('forum', '0001_initial'),
  12 + ]
  13 +
  14 + operations = [
  15 + migrations.RemoveField(
  16 + model_name='forum',
  17 + name='title',
  18 + ),
  19 + ]
forum/models.py
@@ -11,16 +11,15 @@ It&#39;s one kind of activity available for a Topic. @@ -11,16 +11,15 @@ It&#39;s one kind of activity available for a Topic.
11 It works like a 'topic' of forum, which users can post to it and answer posts of it. 11 It works like a 'topic' of forum, which users can post to it and answer posts of it.
12 """ 12 """
13 class Forum(Activity): 13 class Forum(Activity):
14 - title = models.CharField(_('Title'), max_length = 100)  
15 description = models.TextField(_('Description'), blank = True) 14 description = models.TextField(_('Description'), blank = True)
16 - create_date = models.DateTimeField(_('Create Date'), auto_now_add = True)  
17 15
18 class Meta: 16 class Meta:
19 verbose_name = _('Forum') 17 verbose_name = _('Forum')
20 verbose_name_plural = _('Foruns') 18 verbose_name_plural = _('Foruns')
  19 + app_label ='forum'
21 20
22 def __str__(self): 21 def __str__(self):
23 - return self.title 22 + return self.name
24 23
25 """ 24 """
26 It represents a post made in a forum (topic) 25 It represents a post made in a forum (topic)
@@ -29,13 +28,15 @@ class Post(models.Model): @@ -29,13 +28,15 @@ class Post(models.Model):
29 user = models.ForeignKey(User, verbose_name = _('Autor')) 28 user = models.ForeignKey(User, verbose_name = _('Autor'))
30 message = models.TextField(_('Post message'), blank = False) 29 message = models.TextField(_('Post message'), blank = False)
31 post_date = models.DateTimeField(_('Post Date'), auto_now_add = True) 30 post_date = models.DateTimeField(_('Post Date'), auto_now_add = True)
  31 + forum = models.ForeignKey(Forum, verbose_name = _('Forum'))
32 32
33 class Meta: 33 class Meta:
34 verbose_name = _('Post') 34 verbose_name = _('Post')
35 verbose_name_plural = _('Posts') 35 verbose_name_plural = _('Posts')
  36 + app_label ='forum'
36 37
37 def __str__(self): 38 def __str__(self):
38 - return ''.join([self.user.name, " / ", self.post_date]) 39 + return ''.join([self.user.name, " / ", str(self.post_date)])
39 40
40 """ 41 """
41 It represents an answer to a forum's post 42 It represents an answer to a forum's post
@@ -49,6 +50,7 @@ class PostAnswer(models.Model): @@ -49,6 +50,7 @@ class PostAnswer(models.Model):
49 class Meta: 50 class Meta:
50 verbose_name = _('Post Answer') 51 verbose_name = _('Post Answer')
51 verbose_name_plural = _('Post Answers') 52 verbose_name_plural = _('Post Answers')
  53 + app_label ='forum'
52 54
53 def __str__(self): 55 def __str__(self):
54 - return ''.join([self.user.name, " / ", self.answer_date])  
55 \ No newline at end of file 56 \ No newline at end of file
  57 + return ''.join([self.user.name, " / ", str(self.answer_date)])
56 \ No newline at end of file 58 \ No newline at end of file
forum/static/js/forum.js 0 → 100644
@@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
  1 +function showForum(url, topic) {
  2 + $.ajax({
  3 + url: url,
  4 + data: {'topic': topic},
  5 + success: function(data) {
  6 + $(".forum_topics").html(data);
  7 + }
  8 + });
  9 +
  10 + $('#forumModal').modal();
  11 +}
  12 +
  13 +function getForm(url) {
  14 + $.ajax({
  15 + url: url,
  16 + success: function(data) {
  17 + $(".forum_form").html(data);
  18 + }
  19 + });
  20 +
  21 + $(".forum_form").show();
  22 +}
  23 +
  24 +function showPosts(url, forum) {
  25 + if ($("#collapse" + forum).hasClass('in')) {
  26 + $("#collapse" + forum).collapse('hide');
  27 + } else {
  28 + $.ajax({
  29 + url: url,
  30 + data: {'forum': forum},
  31 + success: function(data) {
  32 + $("#collapse" + forum).find(".well").html(data);
  33 + }
  34 + });
  35 +
  36 + $("#collapse" + forum).collapse('show');
  37 + }
  38 +}
  39 +
  40 +function showPostsAnswers(url, post) {
  41 + if ($("#collapse" + post).hasClass('in')) {
  42 + $("#collapse" + post).collapse('hide');
  43 + } else {
  44 + $.ajax({
  45 + url: url,
  46 + data: {'post': post},
  47 + success: function(data) {
  48 + $("#collapse" + post).find(".well").html(data);
  49 + }
  50 + });
  51 +
  52 + $("#collapse" + post).collapse('show');
  53 + }
  54 +}
0 \ No newline at end of file 55 \ No newline at end of file
forum/templates/forum/forum_form.html 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +{% load static i18n %}
  2 +{% load widget_tweaks %}
  3 +
  4 +<form method="post" action="" enctype="multipart/form-data">
  5 + {% csrf_token %}
  6 + {% for field in form %}
  7 + <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput">
  8 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
  9 + {% render_field field class='form-control' %}
  10 + <span class="help-block">{{ field.help_text }}</span>
  11 + {% if field.errors %}
  12 + <div class="row">
  13 + <br />
  14 + <div class="alert alert-danger alert-dismissible" role="alert">
  15 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  16 + <span aria-hidden="true">&times;</span>
  17 + </button>
  18 + <ul>
  19 + {% for error in field.errors %}
  20 + <li>{{ error }}</li>
  21 + {% endfor %}
  22 + </ul>
  23 + </div>
  24 + </div>
  25 + {% endif %}
  26 + </div>
  27 + {% endfor %}
  28 +
  29 + <input type="submit" value="{% trans 'Create' %}" class="btn btn-primary" />
  30 +</form>
0 \ No newline at end of file 31 \ No newline at end of file
forum/templates/forum/forum_list.html 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +{% load i18n permission_tags %}
  2 +
  3 +{% if foruns|length > 0 %}
  4 + {% for forum in foruns %}
  5 + <a class="forum_collapse" role="button" href="javascript: showPosts('{% url 'forum:posts' %}', '{{ forum.slug }}')" aria-expanded="true">
  6 + <div class="page-header">
  7 + <!-- {% if user|has_role:'system_admin' or user|has_role:'professor' and user == forum.topic.owner %}
  8 + <div class="pull-right">
  9 + <div class="btn-group icon-more-horiz">
  10 + <button class="btn btn-default btn-xs dropdown-toggle" type="button" onclick="$('#dropdown{{ forum.slug }}').dropdown('toggle');" data-toggle="dropdown">
  11 + <i class="material-icons">more_horiz</i>
  12 + </button>
  13 + <ul class="dropdown-menu" id="dropdown{{ forum.slug }}">
  14 + <li><a href="javascript:void(0)"><i class="material-icons">create</i> Edit</a></li>
  15 + <li><a href="javascript:void(0)"><i class="material-icons">delete_sweep</i> Remove</a></li>
  16 + </ul>
  17 + </div>
  18 + </div>
  19 + {% endif %} -->
  20 + <h1 id="timeline">
  21 + {{ forum }}
  22 + </h1>
  23 + <b>{% trans 'Description' %}: </b>{{ forum.description }}<p>
  24 + <b>{% trans 'Created in' %}: </b>{{ forum.create_date }}
  25 + </div>
  26 + </a>
  27 + <div class="collapse" id="collapse{{ forum.slug }}">
  28 + <div class="well">
  29 + </div>
  30 + </div>
  31 + {% endfor %}
  32 +{% else %}
  33 + <div class="page-header">
  34 + <p>{% trans 'No forum created yet.' %}</p>
  35 + </div>
  36 +{% endif %}
forum/templates/post/post_list.html 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +{% load i18n permission_tags %}
  2 +
  3 +{% if posts|length > 0 %}
  4 + <ul class="timeline post">
  5 + {% for post in posts %}
  6 + <li>
  7 + <a class="post_collapse" role="button" href="javascript: showPostsAnswers('{% url 'forum:post_answers' %}', '{{ post.id }}')" aria-expanded="false">
  8 + <div class="timeline-panel">
  9 + <div class="row">
  10 + <div class="col-xs-2 col-sm-2 col-md-2">
  11 + <img class="img-responsive img-rounded" src="{{ post.user.image_url }}" />
  12 + </div>
  13 + <div class="col-xs-10 col-sm-10 col-md-10">
  14 + <div class="timeline-heading">
  15 + <h3> {{ post.user }}</h3>
  16 + </div>
  17 + <div class="timeline-body">
  18 + <p><em>{{ post.message|linebreaks }}</em></p>
  19 + </div>
  20 + <hr>
  21 + <small class="text-muted">
  22 + <span class="pull-right">
  23 + <i class="glyphicon glyphicon-time"></i> {{ post.post_date|timesince }}
  24 + {% trans ' ago' %}
  25 + </span>
  26 + </small>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + </a>
  31 + <div class="collapse" id="collapse{{ post.id }}" style="margin-top:10px;">
  32 + <div class="well">
  33 + </div>
  34 + </div>
  35 + </li>
  36 + {% endfor %}
  37 + </ul>
  38 +{% else %}
  39 + <p>{% trans 'No posts were made yet.' %}</p>
  40 +{% endif %}
0 \ No newline at end of file 41 \ No newline at end of file
forum/templates/post_answers/post_answer_list.html 0 → 100644
@@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
  1 +{% load i18n permission_tags %}
  2 +
  3 +{% if answers|length > 0 %}
  4 + <ul class="timeline post">
  5 + {% for answer in answers %}
  6 + <li>
  7 + <div class="timeline-panel">
  8 + <div class="row">
  9 + <div class="col-xs-2 col-sm-2 col-md-2">
  10 + <img class="img-responsive img-rounded" src="{{ answer.user.image_url }}" />
  11 + </div>
  12 + <div class="col-xs-10 col-sm-10 col-md-10">
  13 + {% if user|has_role:'system_admin' or user|has_role:'professor' and user == forum.topic.owner %}
  14 + <div class="pull-right">
  15 + <div class="btn-group icon-more-horiz">
  16 + <a class="btn btn-default btn-xs dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  17 + <i class="material-icons">more_horiz</i>
  18 + </a>
  19 + <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
  20 + <li><a href="javascript:void(0)"><i class="material-icons">create</i> Edit</a></li>
  21 + <li><a href="javascript:void(0)"><i class="material-icons">delete_sweep</i> Remove</a></li>
  22 + </ul>
  23 + </div>
  24 + </div>
  25 + {% endif %}
  26 + <div class="timeline-heading">
  27 + <h3> {{ answer.user }}</h3>
  28 + </div>
  29 + <div class="timeline-body">
  30 + <p><em>{{ answer.message|linebreaks }}</em></p>
  31 + </div>
  32 + <hr>
  33 + <small class="text-muted">
  34 + <span class="pull-right">
  35 + <i class="glyphicon glyphicon-time"></i> {{ answer.answer_date|timesince }}
  36 + {% trans ' ago' %}
  37 + </span>
  38 + </small>
  39 + </div>
  40 + </div>
  41 + </div>
  42 + </li>
  43 + {% endfor %}
  44 + </ul>
  45 +{% else %}
  46 + <p>{% trans 'Nobody answered this post yet.' %}</p>
  47 +{% endif %}
0 \ No newline at end of file 48 \ No newline at end of file
forum/urls.py 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +from django.conf.urls import url, include
  2 +
  3 +from . import views
  4 +
  5 +
  6 +urlpatterns = [
  7 + url(r'^$', views.ForumIndex.as_view(), name='index'),
  8 + url(r'^create$', views.CreateForumView.as_view(), name='create'),
  9 + url(r'^posts$', views.PostIndex.as_view(), name='posts'),
  10 + url(r'^post_answers$', views.PostAnswerIndex.as_view(), name='post_answers'),
  11 +]
forum/views.py
1 -from django.shortcuts import render 1 +from django.shortcuts import render, get_object_or_404
  2 +from django.core.urlresolvers import reverse_lazy
  3 +from django.utils.translation import ugettext_lazy as _
  4 +from django.views import generic
  5 +from django.contrib.auth.mixins import LoginRequiredMixin
2 6
3 -# Create your views here. 7 +from .models import Forum, Post, PostAnswer
  8 +from courses.models import Topic
  9 +
  10 +from .forms import ForumForm
  11 +
  12 +class ForumIndex(LoginRequiredMixin, generic.ListView):
  13 + login_url = reverse_lazy("core:home")
  14 + redirect_field_name = 'next'
  15 +
  16 + template_name = "forum/forum_list.html"
  17 + context_object_name = 'foruns'
  18 +
  19 + def get_queryset(self):
  20 + topic = get_object_or_404(Topic, slug = self.request.GET.get('topic', ''))
  21 +
  22 + context = Forum.objects.filter(topic = topic)
  23 +
  24 + return context
  25 +
  26 +class CreateForumView(LoginRequiredMixin, generic.edit.CreateView):
  27 +
  28 + template_name = 'forum/forum_form.html'
  29 + form_class = ForumForm
  30 + success_url = reverse_lazy('forum:index')
  31 +
  32 +class PostIndex(LoginRequiredMixin, generic.ListView):
  33 + login_url = reverse_lazy("core:home")
  34 + redirect_field_name = 'next'
  35 +
  36 + template_name = "post/post_list.html"
  37 + context_object_name = 'posts'
  38 +
  39 + def get_queryset(self):
  40 + forum = get_object_or_404(Forum, slug = self.request.GET.get('forum', ''))
  41 +
  42 + context = Post.objects.filter(forum = forum)
  43 +
  44 + return context
  45 +
  46 +class PostAnswerIndex(LoginRequiredMixin, generic.ListView):
  47 + login_url = reverse_lazy("core:home")
  48 + redirect_field_name = 'next'
  49 +
  50 + template_name = "post_answers/post_answer_list.html"
  51 + context_object_name = 'answers'
  52 +
  53 + def get_queryset(self):
  54 + post = get_object_or_404(Post, id = self.request.GET.get('post', ''))
  55 +
  56 + context = PostAnswer.objects.filter(post = post)
  57 +
  58 + return context
4 \ No newline at end of file 59 \ No newline at end of file
users/admin.py
@@ -5,6 +5,6 @@ from .forms import UserForm @@ -5,6 +5,6 @@ from .forms import UserForm
5 class UserAdmin(admin.ModelAdmin): 5 class UserAdmin(admin.ModelAdmin):
6 list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] 6 list_display = ['username', 'name', 'email', 'is_staff', 'is_active']
7 search_fields = ['username', 'name', 'email'] 7 search_fields = ['username', 'name', 'email']
8 - form = UserForm 8 + # form = UserForm
9 9
10 admin.site.register(User, UserAdmin) 10 admin.site.register(User, UserAdmin)
11 \ No newline at end of file 11 \ No newline at end of file
users/forms.py
@@ -4,6 +4,7 @@ from django.conf import settings @@ -4,6 +4,7 @@ from django.conf import settings
4 from django import forms 4 from django import forms
5 from django.utils.translation import ugettext_lazy as _ 5 from django.utils.translation import ugettext_lazy as _
6 from rolepermissions.shortcuts import assign_role 6 from rolepermissions.shortcuts import assign_role
  7 +from django.contrib.auth.forms import UserCreationForm
7 from .models import User 8 from .models import User
8 9
9 10
@@ -22,35 +23,32 @@ class ProfileForm(forms.ModelForm): @@ -22,35 +23,32 @@ class ProfileForm(forms.ModelForm):
22 fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] 23 fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image']
23 widgets = { 24 widgets = {
24 'password':forms.PasswordInput 25 'password':forms.PasswordInput
25 - }  
26 -  
27 -class UserForm(forms.ModelForm):  
28 - def save(self, commit=True):  
29 - super(UserForm, self).save(commit=False)  
30 -  
31 - #if not self.instance.image:  
32 - # self.instance.image = os.path.join(os.path.dirname(settings.BASE_DIR), 'uploads', 'no_image.jpg')  
33 -  
34 - self.instance.set_password(self.cleaned_data['password'])  
35 - self.instance.save()  
36 -  
37 - if self.instance.is_staff:  
38 - assign_role(self.instance, 'system_admin')  
39 - elif self.instance.type_profile == 2:  
40 - assign_role(self.instance, 'student')  
41 - elif self.instance.type_profile == 1:  
42 - assign_role(self.instance, 'professor')  
43 -  
44 - self.instance.save() 26 + }
45 27
46 - return self.instance 28 +class UserForm(UserCreationForm):
  29 + # def save(self, commit=True):
  30 + # super(UserForm, self).save()
  31 + #
  32 + # #if not self.instance.image:
  33 + # # self.instance.image = os.path.join(os.path.dirname(settings.BASE_DIR), 'uploads', 'no_image.jpg')
  34 + #
  35 + # # self.instance.set_password(self.cleaned_data['password'])
  36 + # # self.instance.save()
  37 + #
  38 + # if self.instance.is_staff:
  39 + # assign_role(self.instance, 'system_admin')
  40 + # elif self.instance.type_profile == 2:
  41 + # assign_role(self.instance, 'student')
  42 + # elif self.instance.type_profile == 1:
  43 + # assign_role(self.instance, 'professor')
  44 + #
  45 + # self.instance.save()
  46 + #
  47 + # return self.instance
47 48
48 class Meta: 49 class Meta:
49 model = User 50 model = User
50 - fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active']  
51 - widgets = {  
52 - 'password':forms.PasswordInput  
53 - } 51 + fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active']
54 52
55 class EditUserForm(forms.ModelForm): 53 class EditUserForm(forms.ModelForm):
56 54
users/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-20 13:57 2 +# Generated by Django 1.10 on 2016-09-21 02:52
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import django.contrib.auth.models 5 import django.contrib.auth.models
users/templates/list_users.html
1 {% extends 'home.html' %} 1 {% extends 'home.html' %}
2 2
3 -{% load i18n pagination django_bootstrap_breadcrumbs %} 3 +{% load i18n pagination django_bootstrap_breadcrumbs static %}
4 4
5 {% block breadcrumbs %} 5 {% block breadcrumbs %}
6 6
@@ -24,6 +24,16 @@ @@ -24,6 +24,16 @@
24 {% endblock %} 24 {% endblock %}
25 25
26 {% block content %} 26 {% block content %}
  27 + {% if messages %}
  28 + {% for message in messages %}
  29 + <div class="alert alert-{{ message.tag }} alert-dismissible" role="alert">
  30 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  31 + <span aria-hidden="true">&times;</span>
  32 + </button>
  33 + <p>{{ message }}</p>
  34 + </div>
  35 + {% endfor %}
  36 + {% endif %}
27 <form action="" method="GET" class="form-horizontal"> 37 <form action="" method="GET" class="form-horizontal">
28 <div class="form-group"> 38 <div class="form-group">
29 <div class="col-md-9 col-sm-9 col-xs-9"> 39 <div class="col-md-9 col-sm-9 col-xs-9">
@@ -40,7 +50,11 @@ @@ -40,7 +50,11 @@
40 <div class="row panel panel-default"> 50 <div class="row panel panel-default">
41 <div class="panel-body"> 51 <div class="panel-body">
42 <div class="col-md-4"> 52 <div class="col-md-4">
43 - <img src="{{ acc.image.url }}" alt="photoUser" class="img-circle img-responsive"> 53 + {% if acc.image %}
  54 + <img src="{{ acc.image.url }}" alt="photoUser" class="img-circle img-responsive">
  55 + {% else %}
  56 + <img src="{% static 'images/avatar.png' %}" alt="Avatar" class="img-circle img-responsive">
  57 + {% endif %}
44 </div> 58 </div>
45 <div class="col-md-8"> 59 <div class="col-md-8">
46 <p>{% trans 'Name' %}: {{ acc.name }}</p> 60 <p>{% trans 'Name' %}: {{ acc.name }}</p>
users/templates/users/create.html
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 14
15 15
16 {% block content %} 16 {% block content %}
  17 + <script src="{% static 'js/base/amadeus.js' %}"></script>
17 {% if messages %} 18 {% if messages %}
18 {% for message in messages %} 19 {% for message in messages %}
19 <div class="alert alert-success alert-dismissible" role="alert"> 20 <div class="alert alert-success alert-dismissible" role="alert">
@@ -32,30 +33,34 @@ @@ -32,30 +33,34 @@
32 {% csrf_token %} 33 {% csrf_token %}
33 {% for field in form %} 34 {% for field in form %}
34 <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> 35 <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput">
35 - <label for="{{ field.auto_id }}">{{ field.label }}</label>  
36 {% if field.auto_id == 'id_birth_date' %} 36 {% if field.auto_id == 'id_birth_date' %}
37 - {% render_field field class='form-control input-sm' type='date' %}  
38 - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 37 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
  38 + <input type="date" class="form-control"name="{{field.name}}" value="{% if field.value.year %}{{field.value|date:'Y-m-d'}}{% else %}{{field.value}}{% endif %}">
39 {% elif field.auto_id == 'id_image' %} 39 {% elif field.auto_id == 'id_image' %}
40 - {% render_field field class='form-control input-sm' %} 40 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
  41 + {% render_field field class='form-control' %}
41 <div class="input-group"> 42 <div class="input-group">
42 - <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose your photo...' %}">  
43 - <span class="input-group-btn input-group-sm">  
44 - <button type="button" class="btn btn-fab btn-fab-mini">  
45 - <i class="material-icons">attach_file</i>  
46 - </button>  
47 - </span> 43 + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose your photo...' %}">
  44 + <span class="input-group-btn input-group-sm">
  45 + <button type="button" class="btn btn-fab btn-fab-mini">
  46 + <i class="material-icons">attach_file</i>
  47 + </button>
  48 + </span>
48 </div> 49 </div>
49 - {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %}  
50 - <div class="checkbox">  
51 - <label>  
52 - {% render_field field type='checkbox' %}  
53 - </label>  
54 - </div> 50 + {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %}
  51 + <div class="checkbox">
  52 + <label>
  53 + <input type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {{field.label}}
  54 + </label>
  55 + </div>
  56 + {% elif field.auto_id == 'id_cpf' %}
  57 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
  58 + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %}
55 {% else %} 59 {% else %}
56 - {% render_field field class='form-control input-sm' %}  
57 - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 60 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
  61 + {% render_field field class='form-control' %}
58 {% endif %} 62 {% endif %}
  63 + <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
59 {% if field.errors.length > 0 %} 64 {% if field.errors.length > 0 %}
60 <div class="alert alert-danger alert-dismissible" role="alert"> 65 <div class="alert alert-danger alert-dismissible" role="alert">
61 <button type="button" class="close" data-dismiss="alert" aria-label="Close"> 66 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
@@ -67,20 +72,24 @@ @@ -67,20 +72,24 @@
67 {% endfor %} 72 {% endfor %}
68 </ul> 73 </ul>
69 </div> 74 </div>
70 - </div>  
71 {% endif %} 75 {% endif %}
72 </div> 76 </div>
73 {% endfor %} 77 {% endfor %}
74 <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2"> 78 <div class="col-md-offset-2 col-md-2 col-sm-2 col-xs-2">
75 - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> 79 + <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" />
76 </div> 80 </div>
77 <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2"> 81 <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2">
78 - <a href="{% url 'users:manage' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a> 82 + <a href="{% url 'users:manage' %}" class="btn btn-sm btn-default" >{% trans 'Cancel' %}</a>
79 </div> 83 </div>
80 </form> 84 </form>
81 </div> 85 </div>
82 </div> 86 </div>
83 - </div> 87 + </div>
  88 +</br>
  89 +</br>
  90 +</br>
  91 +{% endblock %}
  92 +
  93 +{% block javascript %}
84 94
85 - <br clear="all" />  
86 {% endblock %} 95 {% endblock %}
users/templates/users/edit_profile.html
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> 31 <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput">
32 <label for="{{ field.auto_id }}">{{ field.label }}</label> 32 <label for="{{ field.auto_id }}">{{ field.label }}</label>
33 {% if field.auto_id == 'id_birth_date' %} 33 {% if field.auto_id == 'id_birth_date' %}
34 - {% render_field field class='form-control input-sm' type='date' %} 34 + <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'}}" id="{{ field.auto_id }}">
35 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 35 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
36 {% elif field.auto_id == 'id_image' %} 36 {% elif field.auto_id == 'id_image' %}
37 {% render_field field class='form-control input-sm' %} 37 {% render_field field class='form-control input-sm' %}
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 </label> 50 </label>
51 </div> 51 </div>
52 {% else %} 52 {% else %}
53 - {% render_field field class='form-control input-sm' %} 53 + {% render_field field class='form-control' %}
54 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 54 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
55 {% endif %} 55 {% endif %}
56 {% if field.errors.length > 0 %} 56 {% if field.errors.length > 0 %}
users/templates/users/update.html
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 </div> 24 </div>
25 {% endfor %} 25 {% endfor %}
26 {% endif %} 26 {% endif %}
27 - 27 +
28 <div class="card"> 28 <div class="card">
29 <div class="card-content"> 29 <div class="card-content">
30 <div class="card-body"> 30 <div class="card-body">
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> 34 <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput">
35 <label for="{{ field.auto_id }}">{{ field.label }}</label> 35 <label for="{{ field.auto_id }}">{{ field.label }}</label>
36 {% if field.auto_id == 'id_birth_date' %} 36 {% if field.auto_id == 'id_birth_date' %}
37 - {% render_field field class='form-control input-sm' type='date' %} 37 + <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'}}" id="{{ field.auto_id }}">
38 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 38 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
39 {% elif field.auto_id == 'id_image' %} 39 {% elif field.auto_id == 'id_image' %}
40 {% render_field field class='form-control input-sm' %} 40 {% render_field field class='form-control input-sm' %}
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 </label> 53 </label>
54 </div> 54 </div>
55 {% else %} 55 {% else %}
56 - {% render_field field class='form-control input-sm' %} 56 + {% render_field field class='form-control' %}
57 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 57 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
58 {% endif %} 58 {% endif %}
59 {% if field.errors.length > 0 %} 59 {% if field.errors.length > 0 %}
users/views.py
@@ -37,10 +37,10 @@ class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): @@ -37,10 +37,10 @@ class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView):
37 template_name = 'users/create.html' 37 template_name = 'users/create.html'
38 form_class = UserForm 38 form_class = UserForm
39 context_object_name = 'acc' 39 context_object_name = 'acc'
40 - success_url = reverse_lazy('user:manage') 40 + success_url = reverse_lazy('users:manage')
41 41
42 def form_valid(self, form): 42 def form_valid(self, form):
43 - self.object = form.save(commit = False) 43 + self.object = form.save()
44 44
45 if self.object.type_profile == 2: 45 if self.object.type_profile == 2:
46 assign_role(self.object, 'student') 46 assign_role(self.object, 'student')