Commit 8ccda95422491ac1ed7659ce6e71918de16d1d57

Authored by filipecmedeiros
2 parents 2f54f6a8 d0f76248

Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev

amadeus/settings.py
@@ -181,6 +181,14 @@ MESSAGE_TAGS = { @@ -181,6 +181,14 @@ MESSAGE_TAGS = {
181 messages_constants.ERROR: 'danger', 181 messages_constants.ERROR: 'danger',
182 } 182 }
183 183
  184 +#Send email for forgot Password
  185 +EMAIL_USE_TLS = True
  186 +EMAIL_HOST = 'smtp.gmail.com'
  187 +EMAIL_PORT = 25
  188 +EMAIL_HOST_USER = 'amadeusteste@gmail.com'
  189 +EMAIL_HOST_PASSWORD = 'amadeusteste'
  190 +# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  191 +
184 192
185 try: 193 try:
186 from .local_settings import * 194 from .local_settings import *
core/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:39 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import autoslug.fields 5 import autoslug.fields
  6 +from django.conf import settings
6 from django.db import migrations, models 7 from django.db import migrations, models
7 import django.db.models.deletion 8 import django.db.models.deletion
8 9
@@ -12,6 +13,7 @@ class Migration(migrations.Migration): @@ -12,6 +13,7 @@ class Migration(migrations.Migration):
12 initial = True 13 initial = True
13 14
14 dependencies = [ 15 dependencies = [
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ] 17 ]
16 18
17 operations = [ 19 operations = [
@@ -31,6 +33,7 @@ class Migration(migrations.Migration): @@ -31,6 +33,7 @@ class Migration(migrations.Migration):
31 name='Action_Resource', 33 name='Action_Resource',
32 fields=[ 34 fields=[
33 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 35 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  36 + ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')),
34 ], 37 ],
35 options={ 38 options={
36 'verbose_name': 'Action_Resource', 39 'verbose_name': 'Action_Resource',
@@ -42,6 +45,8 @@ class Migration(migrations.Migration): @@ -42,6 +45,8 @@ class Migration(migrations.Migration):
42 fields=[ 45 fields=[
43 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 46 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
44 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), 47 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
  48 + ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  49 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')),
45 ], 50 ],
46 options={ 51 options={
47 'verbose_name': 'Log', 52 'verbose_name': 'Log',
@@ -56,6 +61,8 @@ class Migration(migrations.Migration): @@ -56,6 +61,8 @@ class Migration(migrations.Migration):
56 ('read', models.BooleanField(default=False, verbose_name='Read')), 61 ('read', models.BooleanField(default=False, verbose_name='Read')),
57 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), 62 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
58 ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), 63 ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  64 + ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer')),
  65 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')),
59 ], 66 ],
60 options={ 67 options={
61 'verbose_name': 'Notification', 68 'verbose_name': 'Notification',
@@ -76,4 +83,9 @@ class Migration(migrations.Migration): @@ -76,4 +83,9 @@ class Migration(migrations.Migration):
76 'verbose_name_plural': 'Resources', 83 'verbose_name_plural': 'Resources',
77 }, 84 },
78 ), 85 ),
  86 + migrations.AddField(
  87 + model_name='action_resource',
  88 + name='resource',
  89 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'),
  90 + ),
79 ] 91 ]
core/migrations/0002_auto_20160930_1239.py
@@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-09-30 15:39  
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 - ('core', '0001_initial'),  
16 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='notification',  
22 - name='actor',  
23 - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='notification',  
27 - name='user',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='log',  
32 - name='action_resource',  
33 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'),  
34 - ),  
35 - migrations.AddField(  
36 - model_name='log',  
37 - name='user',  
38 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'),  
39 - ),  
40 - migrations.AddField(  
41 - model_name='action_resource',  
42 - name='action',  
43 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'),  
44 - ),  
45 - migrations.AddField(  
46 - model_name='action_resource',  
47 - name='resource',  
48 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'),  
49 - ),  
50 - ]  
core/templates/index.html
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 </div> 59 </div>
60 </form> 60 </form>
61 <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10"> 61 <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10">
62 - <a href="{% url 'core:remember_password' %}">{% trans "Forgot your password?" %}</a> 62 + <a href="{% url 'core:password_reset' %}">{% trans "Forgot your password?" %}</a>
63 </div> 63 </div>
64 {# </div> #} 64 {# </div> #}
65 {# <div class="row"> #} 65 {# <div class="row"> #}
core/templates/registration/passwor_reset_complete.html 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content %}
  5 +
  6 + <div class="row">
  7 + <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">
  8 + <div class="row">
  9 + <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">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <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">
  19 + <div class="card">
  20 + <div class="card-block">
  21 + <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12 col-xl-12">
  22 + <form class="form-group " method="post" action="">
  23 + {% csrf_token %}
  24 + <div class="form-group is-empty">
  25 + <p>
  26 + Sua senha foi definida. Você pode ir em frente e entrar agora.
  27 + </p>
  28 + </div>
  29 + </form>
  30 + </div>
  31 + </div>
  32 + </div>
  33 + </div>
  34 + </div>
  35 + </div>
  36 +
  37 +{% endblock content %}
core/templates/registration/passwor_reset_confirm.html 0 → 100644
@@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content%}
  5 +
  6 + <div class="row">
  7 + <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">
  8 + <div class="row">
  9 + <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">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <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">
  19 +
  20 +
  21 + {% if validlink %}
  22 + <h3>Nova Senha</h3>
  23 + <form method="post">
  24 + {% csrf_token %}
  25 + {{ form.new_password1.erros }}
  26 + <label for="id_password1"> Nova Senha: </label>
  27 + {form.new_password1}
  28 +
  29 + {{ form.new_password2.erros }}
  30 + <label for="id_password2"> Confirmar Senha: </label>
  31 + {form.new_password2}
  32 +
  33 +
  34 + <button type="submit">Confirmar</button>
  35 + </form>
  36 +
  37 + {% else %}
  38 + <p>
  39 + O link de redefinição de senha está inválido, possivelmente porque ele já foi utilizado.
  40 + Por favor, solicite uma nova redefinição de senha.
  41 + </p>
  42 + {% endif %}
  43 +
  44 + </div>
  45 + </div>
  46 +</div>
  47 +
  48 +{% endblock content %}
core/templates/registration/passwor_reset_done.html 0 → 100644
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content %}
  5 +
  6 + <div class="row">
  7 + <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">
  8 + <div class="row">
  9 + <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">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <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">
  19 + <div class="card">
  20 + <div class="card-block">
  21 + <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12 col-xl-12">
  22 + <form class="form-group " method="post" action="">
  23 + {% csrf_token %}
  24 + <div class="form-group is-empty">
  25 + <p>
  26 + Temos enviado instruções para configurar sua senha, se uma conta existe com o e-mail inserido.
  27 + Você deve recebê-los em breve.
  28 + </p>
  29 + <p>
  30 + Se você não receber um e-mail, por favor, certifique-se de que introduziu o endereço que você registrou,
  31 + e verifique a pasta de spam.
  32 + </p>
  33 + </div>
  34 + </form>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + </div>
  39 + </div>
  40 +
  41 +{% endblock %}
core/templates/registration/passwor_reset_email.html 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +To initiate the password reset process for your {{ user.get_username }} TestSite Account,
  2 +click the link below:
  3 +
  4 +{% block reset_link %}
  5 +{{ protocol }}://{{ domain }}{% url 'core:passwor_reset_confirm' uidb36=uid token=token %}
  6 +
  7 +{% endblock %}
  8 +
  9 +If clicking the link above doesn't work, please copy and paste the URL in a new browser
  10 +window instead.
  11 +
  12 +
  13 +Sincerely,
  14 +Amadeus.
core/templates/registration/passwor_reset_form.html 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content %}
  5 +
  6 + <div class="row">
  7 + < <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">
  8 + <div class="row">
  9 + <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">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <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">
  19 +
  20 +
  21 + <h3>Recuperar a senha</h3>
  22 + <form method="post">
  23 + {% csrf_token %}
  24 + <label for="id_email">E-mail: </label> {{ form.email }}
  25 + <input type="submit" value="Enviar" /></p>
  26 + </form>
  27 +
  28 + </div>
  29 + </div>
  30 + </div>
  31 +
  32 +{% endblock content %}
1 from django.conf.urls import url, include 1 from django.conf.urls import url, include
2 from django.contrib.auth import views as auth_views 2 from django.contrib.auth import views as auth_views
  3 +from django.contrib.auth.views import password_reset, password_reset_done,password_reset_confirm, password_reset_complete
3 4
4 from . import views 5 from . import views
5 6
@@ -11,4 +12,10 @@ urlpatterns = [ @@ -11,4 +12,10 @@ urlpatterns = [
11 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'), 12 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'),
12 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'), 13 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'),
13 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'), 14 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'),
  15 +
  16 + url(r'^reset/$', password_reset, {'template_name':'registration/passwor_reset_form.html','email_template_name':'registration/password_reset_email.html','post_reset_redirect':'done/'}, name="password_reset"),
  17 + url(r'^reset/done/$', password_reset_done, {'template_name':'registration/passwor_reset_done.html'}),
  18 + url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, {'template_name':'registration/password_reset_confirm.html'}),
  19 + url(r'^done/$', password_reset_complete,{'template_name':'registration/passwor_reset_complete.html'}),
  20 +
14 ] 21 ]
courses/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:39 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import autoslug.fields 5 import autoslug.fields
  6 +from django.conf import settings
6 from django.db import migrations, models 7 from django.db import migrations, models
7 import django.db.models.deletion 8 import django.db.models.deletion
8 9
@@ -12,7 +13,8 @@ class Migration(migrations.Migration): @@ -12,7 +13,8 @@ class Migration(migrations.Migration):
12 initial = True 13 initial = True
13 14
14 dependencies = [ 15 dependencies = [
15 - ('core', '0002_auto_20160930_1239'), 16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  17 + ('core', '0001_initial'),
16 ] 18 ]
17 19
18 operations = [ 20 operations = [
@@ -22,6 +24,7 @@ class Migration(migrations.Migration): @@ -22,6 +24,7 @@ class Migration(migrations.Migration):
22 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), 24 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')),
23 ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), 25 ('limit_date', models.DateTimeField(verbose_name='Deliver Date')),
24 ('all_students', models.BooleanField(default=False, verbose_name='All Students')), 26 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  27 + ('students', models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
25 ], 28 ],
26 bases=('core.resource',), 29 bases=('core.resource',),
27 ), 30 ),
@@ -53,6 +56,9 @@ class Migration(migrations.Migration): @@ -53,6 +56,9 @@ class Migration(migrations.Migration):
53 ('init_date', models.DateField(verbose_name='Begin of Course Date')), 56 ('init_date', models.DateField(verbose_name='Begin of Course Date')),
54 ('end_date', models.DateField(verbose_name='End of Course Date')), 57 ('end_date', models.DateField(verbose_name='End of Course Date')),
55 ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), 58 ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')),
  59 + ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category')),
  60 + ('professors', models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')),
  61 + ('students', models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
56 ], 62 ],
57 options={ 63 options={
58 'ordering': ('create_date', 'name'), 64 'ordering': ('create_date', 'name'),
@@ -65,6 +71,7 @@ class Migration(migrations.Migration): @@ -65,6 +71,7 @@ class Migration(migrations.Migration):
65 fields=[ 71 fields=[
66 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), 72 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')),
67 ('all_students', models.BooleanField(default=False, verbose_name='All Students')), 73 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  74 + ('students', models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
68 ], 75 ],
69 bases=('core.resource',), 76 bases=('core.resource',),
70 ), 77 ),
@@ -80,6 +87,8 @@ class Migration(migrations.Migration): @@ -80,6 +87,8 @@ class Migration(migrations.Migration):
80 ('end_date', models.DateField(verbose_name='End of Subject Date')), 87 ('end_date', models.DateField(verbose_name='End of Subject Date')),
81 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), 88 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
82 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), 89 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')),
  90 + ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')),
  91 + ('professors', models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')),
83 ], 92 ],
84 options={ 93 options={
85 'ordering': ('create_date', 'name'), 94 'ordering': ('create_date', 'name'),
@@ -94,6 +103,7 @@ class Migration(migrations.Migration): @@ -94,6 +103,7 @@ class Migration(migrations.Migration):
94 ('name', models.CharField(max_length=100, verbose_name='Name')), 103 ('name', models.CharField(max_length=100, verbose_name='Name')),
95 ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), 104 ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')),
96 ('description', models.TextField(blank=True, verbose_name='Description')), 105 ('description', models.TextField(blank=True, verbose_name='Description')),
  106 + ('subjects', models.ManyToManyField(to='courses.Subject')),
97 ], 107 ],
98 options={ 108 options={
99 'verbose_name': 'subject category', 109 'verbose_name': 'subject category',
@@ -110,6 +120,8 @@ class Migration(migrations.Migration): @@ -110,6 +120,8 @@ class Migration(migrations.Migration):
110 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), 120 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
111 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), 121 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')),
112 ('visible', models.BooleanField(default=False, verbose_name='Visible')), 122 ('visible', models.BooleanField(default=False, verbose_name='Visible')),
  123 + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
  124 + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')),
113 ], 125 ],
114 options={ 126 options={
115 'ordering': ('create_date', 'name'), 127 'ordering': ('create_date', 'name'),
@@ -117,4 +129,14 @@ class Migration(migrations.Migration): @@ -117,4 +129,14 @@ class Migration(migrations.Migration):
117 'verbose_name_plural': 'Topics', 129 'verbose_name_plural': 'Topics',
118 }, 130 },
119 ), 131 ),
  132 + migrations.AddField(
  133 + model_name='material',
  134 + name='topic',
  135 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),
  136 + ),
  137 + migrations.AddField(
  138 + model_name='activity',
  139 + name='topic',
  140 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),
  141 + ),
120 ] 142 ]
courses/migrations/0002_auto_20160930_1239.py
@@ -1,80 +0,0 @@ @@ -1,80 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-09-30 15:39  
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.AddField(  
21 - model_name='topic',  
22 - name='owner',  
23 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='topic',  
27 - name='subject',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='subjectcategory',  
32 - name='subjects',  
33 - field=models.ManyToManyField(to='courses.Subject'),  
34 - ),  
35 - migrations.AddField(  
36 - model_name='subject',  
37 - name='course',  
38 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course'),  
39 - ),  
40 - migrations.AddField(  
41 - model_name='subject',  
42 - name='professors',  
43 - field=models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),  
44 - ),  
45 - migrations.AddField(  
46 - model_name='material',  
47 - name='students',  
48 - field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
49 - ),  
50 - migrations.AddField(  
51 - model_name='material',  
52 - name='topic',  
53 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),  
54 - ),  
55 - migrations.AddField(  
56 - model_name='course',  
57 - name='category',  
58 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category'),  
59 - ),  
60 - migrations.AddField(  
61 - model_name='course',  
62 - name='professors',  
63 - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),  
64 - ),  
65 - migrations.AddField(  
66 - model_name='course',  
67 - name='students',  
68 - field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
69 - ),  
70 - migrations.AddField(  
71 - model_name='activity',  
72 - name='students',  
73 - field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
74 - ),  
75 - migrations.AddField(  
76 - model_name='activity',  
77 - name='topic',  
78 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),  
79 - ),  
80 - ]  
courses/templates/course/index.html
@@ -22,6 +22,23 @@ @@ -22,6 +22,23 @@
22 </ul> 22 </ul>
23 </div> 23 </div>
24 </div> 24 </div>
  25 +
  26 +{% if user|has_role:'professor, system_admin' %}
  27 +
  28 + <div class="panel panel-primary navigation">
  29 + <div class="panel-heading">
  30 + <h3 class="panel-title">Actions</h3>
  31 + </div>
  32 + <div class="panel-body">
  33 + <ul class="nav nav-pills nav-stacked">
  34 + <li><a href="javascript:void(0)">Replicate Course</a></li>
  35 + <li><a href="javascript:void(0)">Create Course</a></li>
  36 + </ul>
  37 + </div>
  38 + </div>
  39 +
  40 +{% endif %}
  41 +
25 {% endblock %} 42 {% endblock %}
26 43
27 {% block content %} 44 {% block content %}
@@ -35,18 +52,101 @@ @@ -35,18 +52,101 @@
35 </div> 52 </div>
36 {% endfor %} 53 {% endfor %}
37 {% endif %} 54 {% endif %}
  55 +
  56 +{% if user|has_role:'professor, system_admin' %}
  57 +
  58 + <div class="col-md-12">
  59 + {% if courses_teacher|length > 0 %}
  60 + {% for course in courses_teacher %}
  61 + <!-- Put your content here! -->
  62 + <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false">
  63 + <div class="group">
  64 + <div class="panel panel-info">
  65 + <div class="panel-heading headingOne ui-sortable-handle" role="tab">
  66 + <div class="row">
  67 + <div class="col-xs-9 col-md-10 titleTopic">
  68 + <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="collapsed">
  69 + <h4>{{course.name}}</h4>
  70 + </a>
  71 + </div>
  72 + <div class="col-xs-4 col-md-2" id="divMoreActions">
  73 + <div class="btn-group">
  74 + <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible">
  75 + <i class="fa fa-eye fa-2x" aria-hidden="true"></i>
  76 + </button>
  77 +
  78 + </div>
  79 + <div class="btn-group">
  80 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  81 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  82 + </button>
  83 + <ul class="dropdown-menu" aria-labelledby="moreActions">
  84 + <li><a href="{% url 'course:view' course.slug %}"><i class="fa fa-angle-double-right fa-fw" aria-hidden="true"></i>&nbsp; Access</a></li>
  85 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; Replicate</a></li>
  86 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeCourse"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; Remove</a></li>
  87 + </ul>
  88 + </div>
  89 + </div>
  90 + </div>
  91 + </div>
  92 + <div class="panel-collapse collapseOne collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">
  93 + <div class="panel-body">
  94 + <p><b>Course Name: </b>{{course.name}}</p>
  95 + <p><b>Duration (in semesters): </b>09</p>
  96 + <p><b>Coordinator: </b>{{course.professors}}</p>
  97 + <p>
  98 + <b>Description:</b>
  99 + <i>
  100 + {{course.description}}
  101 + </i>
  102 + </p>
  103 +
  104 + </div>
  105 + </div>
  106 + </div>
  107 + </div>
  108 + </div>
  109 + {% endfor %}
  110 + {% else %}
  111 + {% trans 'No courses found' %}
  112 + {% endif %}
  113 + <div class="group">
  114 + <div class="modal" id="removeCourse">
  115 + <div class="modal-dialog">
  116 + <div class="modal-content">
  117 + <div class="modal-header">
  118 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
  119 + <h4 class="modal-title"></h4>
  120 + </div>
  121 + <div class="modal-body">
  122 + <p>Delete your course?</p>
  123 + </div>
  124 + <div class="modal-footer">
  125 +
  126 + <a href="http://127.0.0.1:8080/html/screens/users/profile_user.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
  127 +
  128 + </div>
  129 + </div>
  130 + </div>
  131 + </div>
  132 + </div>
  133 + </div>
  134 +
  135 +{% else %}
  136 +
38 <div class="col-md-12"> 137 <div class="col-md-12">
39 <div class="input-group"> 138 <div class="input-group">
40 - <div class="form-group is-empty"><input type="search" class="form-control" placeholder="Search Courses"></div>  
41 - <span class="input-group-btn input-group-sm">  
42 - <button type="button" class="btn btn-fab btn-fab-mini">  
43 - <i class="material-icons">search</i>  
44 - </button>  
45 - </span>  
46 -</div> 139 + <div class="form-group is-empty"><input type="search" class="form-control" placeholder="Search Courses"></div>
  140 + <span class="input-group-btn input-group-sm">
  141 + <button type="button" class="btn btn-fab btn-fab-mini">
  142 + <i class="material-icons">search</i>
  143 + </button>
  144 + </span>
  145 + </div>
47 </div> 146 </div>
48 - {% if courses|length > 0 %}  
49 - {% for course in courses %} 147 +
  148 + {% if subjects_student|length > 0 %}
  149 + {% for course in courses_student %}
50 <div class="col-md-12"> 150 <div class="col-md-12">
51 <div class="panel panel-info"> 151 <div class="panel panel-info">
52 <!--{% if course.image %} 152 <!--{% if course.image %}
@@ -80,7 +180,6 @@ @@ -80,7 +180,6 @@
80 {% endif %} 180 {% endif %}
81 181
82 <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">View Course</a> 182 <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">View Course</a>
83 -  
84 </div> 183 </div>
85 </div> 184 </div>
86 </div> 185 </div>
@@ -100,4 +199,5 @@ @@ -100,4 +199,5 @@
100 {% else %} 199 {% else %}
101 {% trans 'No courses found' %} 200 {% trans 'No courses found' %}
102 {% endif %} 201 {% endif %}
  202 +{% endif %}
103 {% endblock %} 203 {% endblock %}
courses/templates/course/view.html
@@ -15,120 +15,206 @@ @@ -15,120 +15,206 @@
15 {% endblock %} 15 {% endblock %}
16 16
17 {% block sidebar %} 17 {% block sidebar %}
18 -<div class="panel panel-primary">  
19 - <div class="panel-heading">  
20 - <img src="{{ user.image_url }}" id="img" class="img-circle img-responsive">  
21 - </br>  
22 - <div class="row">  
23 - <div class="col-xs-3 col-md-3">  
24 - <i class="fa fa-facebook-official fa-2x" aria-hidden="true"></i> 18 + <div class="panel panel-primary navigation">
  19 + <div class="panel-heading">
  20 + <h5>{% trans 'Menu' %}</h5>
  21 + </div>
  22 + <div class="panel-body">
  23 + <ul class="nav nav-pills nav-stacked">
  24 + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
  25 + <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
  26 + </ul>
  27 + </div>
25 </div> 28 </div>
26 - <div class="col-xs-3 col-md-3">  
27 - <i class="fa fa-twitter fa-2x" aria-hidden="true"></i>  
28 - </div>  
29 - <div class="col-xs-3 col-md-3">  
30 - <i class="fa fa-linkedin-square fa-2x" aria-hidden="true"></i>  
31 - </div>  
32 - <div class="col-xs-3 col-md-3">  
33 - <i class="fa fa-google-plus-official fa-2x" aria-hidden="true"></i>  
34 - </div> 29 +
  30 +{% if user|has_role:'professor, system_admin' %}
  31 +
  32 + <div class="panel panel-primary navigation">
  33 + <div class="panel-heading">
  34 + <h3 class="panel-title">Actions</h3>
  35 + </div>
  36 + <div class="panel-body">
  37 + <ul class="nav nav-pills nav-stacked">
  38 + <li><a href="teacher/course_participants_teacher.html" target="_self">Participants</a></li>
  39 + <li><a href="javascript:void(0)">Replicate Subject</a></li>
  40 + <li><a href="javascript:void(0)">Create Subject</a></li>
  41 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal">Create Topic</a></li>
  42 + </ul>
35 </div> 43 </div>
36 - </div>  
37 - <div class="panel-body">  
38 - <ul class="nav nav-pills nav-stacked">  
39 - <li><a href="{% url 'app:index' %}">{% trans "Home" %}</a></li>  
40 - <li><a href="{% url 'users:profile' %}">{% trans "Profile" %}</a></li>  
41 - {# <li><a href="">{% trans "Courses" %}</a></li>#}  
42 - </ul>  
43 - </div>  
44 -</div>  
45 -{% if courses.count > 0 %}  
46 -<div class="panel panel-primary">  
47 - <div class="panel-heading">  
48 - <h5>{% trans "Courses" %}</h5>  
49 - </div>  
50 - <div class="panel-body">  
51 - <ul class="nav nav-pills nav-stacked">  
52 - {% for course in courses %}  
53 - <li><a href="{% url 'course:view' course.slug %}">{{course}}</a></li>  
54 - {% endfor %}  
55 - </ul>  
56 - </div>  
57 </div> 44 </div>
58 {% endif %} 45 {% endif %}
  46 +
59 {% endblock %} 47 {% endblock %}
60 48
61 {% block content %} 49 {% block content %}
62 50
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="{% url 'course:update' course.slug %}"><i class="material-icons">create</i> Edit</a></li>  
78 - <li><a href="{% url 'course:delete' course.slug %}"><i class="material-icons">delete_sweep</i> Remove</a></li>  
79 - </ul> 51 + <div class="col-md-12">
  52 + <div class="panel panel-info">
  53 + <div class="panel-heading headingOne">
  54 + <div class="row">
  55 + <div class="col-xs-8 col-md-10 titleTopic">
  56 + <h4>{{course}}</h4>
  57 + </div>
  58 + <div class="col-xs-4 col-md-2" id="divMoreActions">
  59 + <div class="btn-group">
  60 + <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible">
  61 + <i class="fa fa-eye fa-2x" aria-hidden="true"></i>
  62 + </button>
80 63
  64 + </div>
  65 + <div class="btn-group">
  66 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  67 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  68 + <div class="ripple-container"></div></button>
  69 + <ul class="dropdown-menu" aria-labelledby="moreActions">
  70 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#createSubject"><i class="fa fa-plus-square-o" aria-hidden="true"></i>&nbsp; Create Subject</a></li>
  71 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; Replicate</a></li>
  72 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal3"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; Edit</a></li>
  73 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; Remove</a></li>
  74 + </ul>
  75 + </div>
81 </div> 76 </div>
82 - {% endif %}  
83 - </div>  
84 </div> 77 </div>
  78 + </div>
  79 + <div class="panel-body">
  80 + <p><b>Course Name: </b>{{course.name}}</p>
  81 + <p><b>Duration (in semesters): </b>09</p>
  82 + <p><b>Coordinator: </b>{{course.professors}}</p>
  83 + <p>
  84 + <b>Description:</b>
  85 + <i>
  86 + {{course.description}}
  87 + </i>
  88 + </p>
  89 +
  90 + </div>
85 </div> 91 </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 92
  93 +<!-- MODAL CREATE SUBJECT -->
  94 +<div class="modal" tabindex="-1" role="dialog " id="createSubject">
  95 + <div class="modal-dialog">
  96 + <div class="modal-content">
  97 + <div class="modal-header">
  98 + <h4 class="modal-title">Create a New Subject</h4>
  99 + </div>
  100 + <div class="modal-body">
  101 + <div>
  102 + <form class="form-horizontal">
  103 + <div class="form-group is-empty">
  104 + <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Name</label>
  105 + <div class="col-md-8 col-xs-8">
  106 + <input type="text" class="form-control" name="nameSubject">
  107 + </div>
  108 + </div>
  109 + <div class="form-group is-empty">
  110 + <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Description</label>
  111 + <div class="col-md-8 col-xs-8">
  112 + <textarea class="form-control" rows="3" id="textAreaSubject"></textarea>
  113 + <span class="help-block">Sign the description of the course.</span>
  114 + </div>
  115 + </div>
  116 + <div class="form-group is-empty">
  117 + <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Goals</label>
  118 + <div class="col-md-8 col-xs-8">
  119 + <textarea class="form-control" rows="3" id="textAreaSubject"></textarea>
  120 + <span class="help-block">Sign the objectives of the course until the end of the course.</span>
  121 + </div>
  122 + </div>
  123 + <div class="form-group is-empty">
  124 + <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Students Limit</label>
  125 + <div class="col-md-8 col-xs-8">
  126 + <input type="number" class="form-control" name="StudentLimit">
  127 + </div>
  128 + </div>
  129 + <div class="row">
  130 + <div class="col-md-6 col-xs-12">
  131 + <div class="row">
  132 + <div class="form-group is-empty">
  133 + <label class="control-label col-md-4 col-xs-4 col-xs-offset-1">Begining</label>
  134 + <div class="col-md-8 col-xs-6">
  135 + <input type="date" class="form-control" name="BeginDate">
  136 + </div>
  137 + </div>
  138 + </div>
  139 + </div>
  140 + <div class="col-md-6 col-xs-12">
  141 + <div class="row">
  142 + <div class="form-group is-empty">
  143 + <label class="control-label col-md-4 col-xs-4 col-xs-offset-1">End</label>
  144 + <div class="col-md-8 col-xs-6">
  145 + <input type="date" class="form-control" name="EndDate">
  146 + </div>
  147 + </div>
  148 + </div>
  149 + </div>
  150 + </div>
  151 + </form>
  152 + </div>
  153 + <div class="modal-footer">
  154 + <button type="button" data-dismiss="modal" class="btn btn-default">Cancel</button>
  155 + <a href="#" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
  156 + </div>
  157 + </div>
  158 + </div>
100 </div> 159 </div>
101 </div> 160 </div>
102 161
  162 +<div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false">
  163 + <div><div class="panel panel-info">
  164 +</div>
103 165
104 -{% for subject in subjects %}  
105 - <div class="panel panel-info">  
106 - <div class="panel-heading">  
107 - <div class="row">  
108 - <a href="{% url 'course:view_subject' subject.slug %}">  
109 - <div class="col-md-11">  
110 166
111 - <h3 class="panel-title">{{subject}}</h3> 167 +<!-- MODAL REMOVE -->
  168 +<div class="modal" id="removeSubject">
  169 + <div class="modal-dialog">
  170 + <div class="modal-content">
  171 + <div class="modal-header">
  172 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
  173 + <h4 class="modal-title"></h4>
  174 + </div>
  175 + <div class="modal-body">
  176 + <p>Are you sure you want to remove this subject?</p>
  177 + </div>
  178 + <div class="modal-footer">
  179 +
  180 + <a href="http://127.0.0.1:8080/html/screens/users/teacher/home_course_teacher.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
112 181
  182 + </div>
  183 + </div>
  184 + </div>
  185 +</div>
  186 +</div>
  187 +<div>
  188 +
  189 +{% for subject in subjects %}
  190 +<div class="panel panel-info">
  191 + <div class="panel-heading headingTwo ui-sortable-handle" role="tab">
  192 + <div class="row">
  193 + <div class="col-xs-9 col-md-10 titleTopic">
  194 + <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
  195 + <h4>{{subject.name}}</h4>
  196 + </a>
113 </div> 197 </div>
114 - </a>  
115 - <div class="col-md-1 text-right">  
116 - {% if user|has_role:'professor, system_admin' %}  
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> 198 + <div class="col-xs-3 col-md-2" id="divMoreActions">
  199 + <div class="btn-group">
  200 + <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible">
  201 + <i class="fa fa-eye fa-2x" aria-hidden="true"></i>
120 </button> 202 </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> 203 + </div>
  204 + <div class="btn-group">
  205 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  206 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  207 + </button>
  208 + <ul class="dropdown-menu" aria-labelledby="moreActions">
  209 + <li><a href="{% url 'course:view_subject' subject.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; Access</a></li>
  210 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal3"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; Replicate</a></li>
  211 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeSubject2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; Remove</a></li>
124 </ul> 212 </ul>
125 -  
126 </div> 213 </div>
127 - {% endif %}  
128 </div> 214 </div>
129 </div> 215 </div>
130 - </div>  
131 - <div class="panel-body"> 216 + </div>
  217 + <div class="panel-body">
132 <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} 218 <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %}
133 {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> 219 {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p>
134 <p> 220 <p>
@@ -146,11 +232,33 @@ @@ -146,11 +232,33 @@
146 </div> 232 </div>
147 </div> 233 </div>
148 </div> 234 </div>
149 - </div> 235 +</div>
150 {% endfor %} 236 {% endfor %}
151 -<a class="btn-floating btn-large waves-effect waves-light red" href="{% url 'course:create' %}">  
152 - <i class="fa fa-plus" aria-hidden="true"></i>  
153 - </a> 237 +
  238 +
  239 +<!-- MODAL REMOVE -->
  240 + <div class="modal" id="removeSubject2">
  241 + <div class="modal-dialog">
  242 + <div class="modal-content">
  243 + <div class="modal-header">
  244 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
  245 + <h4 class="modal-title"></h4>
  246 + </div>
  247 + <div class="modal-body">
  248 + <p>Are you sure you want to remove this subject?</p>
  249 + </div>
  250 + <div class="modal-footer">
  251 +
  252 + <a href="http://127.0.0.1:8080/html/screens/users/teacher/home_course_teacher.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
  253 +
  254 + </div>
  255 + </div>
  256 + </div>
  257 + </div>
  258 +</div>
  259 +</div>
  260 +</div>
  261 +
154 {% endblock %} 262 {% endblock %}
155 263
156 264
courses/templates/topic/index.html
@@ -80,13 +80,13 @@ @@ -80,13 +80,13 @@
80 <div class="container-fluid"> 80 <div class="container-fluid">
81 <div class="row"> 81 <div class="row">
82 <div class="col-md-4"> 82 <div class="col-md-4">
83 -  
84 <div class="form-group is-empty"> 83 <div class="form-group is-empty">
85 <input type="text" class="form-control col-md-8" placeholder="Search Student"> 84 <input type="text" class="form-control col-md-8" placeholder="Search Student">
86 </div> 85 </div>
87 86
88 - </div>  
89 - </div> 87 + </div>
  88 + </div>
  89 +
90 <div class="panel-group" id="accordion"> 90 <div class="panel-group" id="accordion">
91 <div class="panel panel-info"> 91 <div class="panel panel-info">
92 <div class="panel-heading"> 92 <div class="panel-heading">
@@ -102,87 +102,22 @@ @@ -102,87 +102,22 @@
102 <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i> 102 <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>
103 103
104 </div> 104 </div>
105 - <div class="col-md-6">  
106 - <label> Nota:</label>  
107 - <input type="number" step="0.01">  
108 - </div> 105 + {% if user|has_role:'professor, system_admin' %}
  106 + <div class="col-md-6">
  107 + <label> Nota:</label>
  108 + <input type="number" step="0.01">
  109 + </div>
  110 + {% else %}
  111 + <input type="file" name="arquivos" class="btn btn-success" multiple/>
  112 + {% endif %}
109 </div> 113 </div>
110 </div> 114 </div>
111 </div> 115 </div>
112 </div> 116 </div>
113 - <div class="panel panel-info">  
114 - <div class="panel-heading">  
115 - <h4 class="panel-title">  
116 - <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">  
117 - Aluno Joao<i class="fa fa-plus-square" aria-hidden="true"></i></a>  
118 - </h4>  
119 - </div>  
120 - <div id="collapse2" class="panel-collapse collapse">  
121 - <div class="panel-body">  
122 - <div class="row">  
123 - <div class="col-md-6">  
124 - <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>  
125 -  
126 - </div>  
127 - <div class="col-md-6">  
128 - <label> Nota:</label>  
129 - <input type="number" step="0.01">  
130 - </div>  
131 - </div>  
132 -  
133 - </div>  
134 </div> 117 </div>
135 </div> 118 </div>
136 - <div class="panel panel-info">  
137 - <div class="panel-heading">  
138 - <h4 class="panel-title">  
139 - <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">  
140 - Aluno Santos<i class="fa fa-plus-square" aria-hidden="true"></i></a>  
141 - </h4>  
142 - </div>  
143 - <div id="collapse3" class="panel-collapse collapse">  
144 - <div class="panel-body">  
145 - <div class="row">  
146 - <div class="col-md-6">  
147 - <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>  
148 -  
149 - </div>  
150 - <div class="col-md-6">  
151 - <label> Nota:</label>  
152 - <input type="number" step="0.01">  
153 - </div>  
154 - </div>  
155 - </div>  
156 - </div>  
157 - </div>  
158 - <div class="panel panel-info">  
159 - <div class="panel-heading">  
160 - <h4 class="panel-title">  
161 - <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">  
162 - Aluno Ruam<i class="fa fa-plus-square" aria-hidden="true"></i></a>  
163 - </h4>  
164 - </div>  
165 - <div id="collapse4" class="panel-collapse collapse">  
166 - <div class="panel-body">  
167 - <div class="row">  
168 - <div class="col-md-6">  
169 - <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>  
170 -  
171 - </div>  
172 - <div class="col-md-6">  
173 - <label> Nota:</label>  
174 - <input type="number" step="0.01">  
175 - </div>  
176 - </div>  
177 -  
178 - </div>  
179 - </div>  
180 - </div>  
181 -  
182 -</div>  
183 -</div>  
184 -  
185 -</fieldset></form> 119 + </fieldset>
  120 + </form>
186 121
187 <ul class="pagination pagination-sm"> 122 <ul class="pagination pagination-sm">
188 <li class="disabled"><a href="javascript:void(0)">«</a></li> 123 <li class="disabled"><a href="javascript:void(0)">«</a></li>
courses/views.py
@@ -24,15 +24,14 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): @@ -24,15 +24,14 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
24 redirect_field_name = 'next' 24 redirect_field_name = 'next'
25 queryset = Course.objects.all() 25 queryset = Course.objects.all()
26 template_name = 'course/index.html' 26 template_name = 'course/index.html'
27 - context_object_name = 'courses' 27 + context_object_name = 'courses_student'
28 paginate_by = 3 28 paginate_by = 3
29 29
30 def get_context_data(self, **kwargs): 30 def get_context_data(self, **kwargs):
31 context = super(IndexView, self).get_context_data(**kwargs) 31 context = super(IndexView, self).get_context_data(**kwargs)
32 context['categories'] = Category.objects.all() 32 context['categories'] = Category.objects.all()
  33 + context['courses_teacher'] = Course.objects.filter(professors__name = self.request.user.name)
33 34
34 - # context['professors'] = Course.objects.all().select_related('professors__name')  
35 - # super.createNotification(users= User.obejcts.all(), message="testando a notificacao em login")  
36 return context 35 return context
37 36
38 class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,generic.edit.CreateView): 37 class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,generic.edit.CreateView):
forum/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:39 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
  5 +from django.conf import settings
5 from django.db import migrations, models 6 from django.db import migrations, models
6 import django.db.models.deletion 7 import django.db.models.deletion
7 8
@@ -11,7 +12,8 @@ class Migration(migrations.Migration): @@ -11,7 +12,8 @@ class Migration(migrations.Migration):
11 initial = True 12 initial = True
12 13
13 dependencies = [ 14 dependencies = [
14 - ('courses', '0002_auto_20160930_1239'), 15 + ('courses', '0001_initial'),
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ] 17 ]
16 18
17 operations = [ 19 operations = [
@@ -36,6 +38,8 @@ class Migration(migrations.Migration): @@ -36,6 +38,8 @@ class Migration(migrations.Migration):
36 ('message', models.TextField(verbose_name='Post message')), 38 ('message', models.TextField(verbose_name='Post message')),
37 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), 39 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
38 ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), 40 ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')),
  41 + ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')),
  42 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
39 ], 43 ],
40 options={ 44 options={
41 'verbose_name': 'Post', 45 'verbose_name': 'Post',
@@ -50,6 +54,7 @@ class Migration(migrations.Migration): @@ -50,6 +54,7 @@ class Migration(migrations.Migration):
50 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), 54 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
51 ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), 55 ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')),
52 ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), 56 ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')),
  57 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
53 ], 58 ],
54 options={ 59 options={
55 'verbose_name': 'Post Answer', 60 'verbose_name': 'Post Answer',
forum/migrations/0002_auto_20160930_1239.py
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-09-30 15:39  
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 - ('forum', '0001_initial'),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='postanswer',  
22 - name='user',  
23 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='post',  
27 - name='forum',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='post',  
32 - name='user',  
33 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'),  
34 - ),  
35 - ]  
poll/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:40 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 from django.db import migrations, models 5 from django.db import migrations, models
@@ -11,7 +11,7 @@ class Migration(migrations.Migration): @@ -11,7 +11,7 @@ class Migration(migrations.Migration):
11 initial = True 11 initial = True
12 12
13 dependencies = [ 13 dependencies = [
14 - ('courses', '0002_auto_20160930_1239'), 14 + ('courses', '0001_initial'),
15 ] 15 ]
16 16
17 operations = [ 17 operations = [
@@ -23,9 +23,9 @@ class Migration(migrations.Migration): @@ -23,9 +23,9 @@ class Migration(migrations.Migration):
23 ('order', models.PositiveSmallIntegerField(verbose_name='Order')), 23 ('order', models.PositiveSmallIntegerField(verbose_name='Order')),
24 ], 24 ],
25 options={ 25 options={
26 - 'verbose_name_plural': 'Answers',  
27 'ordering': ('order',), 26 'ordering': ('order',),
28 'verbose_name': 'Answer', 27 'verbose_name': 'Answer',
  28 + 'verbose_name_plural': 'Answers',
29 }, 29 },
30 ), 30 ),
31 migrations.CreateModel( 31 migrations.CreateModel(
@@ -34,8 +34,8 @@ class Migration(migrations.Migration): @@ -34,8 +34,8 @@ class Migration(migrations.Migration):
34 ('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')), 34 ('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')),
35 ], 35 ],
36 options={ 36 options={
37 - 'verbose_name_plural': 'Polls',  
38 'verbose_name': 'Poll', 37 'verbose_name': 'Poll',
  38 + 'verbose_name_plural': 'Polls',
39 }, 39 },
40 bases=('courses.activity',), 40 bases=('courses.activity',),
41 ), 41 ),
users/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:40 2 +# Generated by Django 1.10 on 2016-10-01 16:01
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