Commit a5bd890d41c1d39a4a925d9e14f1ed8e41a8ede8

Authored by ifac0
2 parents 006e2c01 46b8be78

resolvendo conflitos #171

Showing 133 changed files with 3361 additions and 1512 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 133 files displayed.

amadeus/settings.py
... ... @@ -54,6 +54,7 @@ INSTALLED_APPS = [
54 54 'app',
55 55 'courses',
56 56 'forum',
  57 + 'exam',
57 58 'poll',
58 59 'links',
59 60 'exam',
... ...
amadeus/static/nothing.txt.py 0 → 100644
amadeus/urls.py
... ... @@ -21,7 +21,7 @@ from django.contrib import admin
21 21  
22 22 urlpatterns = [
23 23 url(r'^home/', include('app.urls', namespace = 'app')),
24   - url(r'^course/', include('courses.urls', namespace = 'course')),
  24 + url(r'^courses/', include('courses.urls', namespace = 'course')),
25 25 url(r'^users/', include('users.urls', namespace = 'users')),
26 26 url(r'^admin/', admin.site.urls),
27 27 url(r'^', include('core.urls', namespace = 'core')),
... ...
app/templates/home.html
... ... @@ -3,53 +3,55 @@
3 3 {% load static i18n django_bootstrap_breadcrumbs permission_tags %}
4 4  
5 5 {% block javascript %}
6   - <script type="text/javascript">
7   - var pageNum = {{ page_obj.number }}; // The latest page loaded
8   - var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages
9   - var baseUrl = '{% url "app:index" %}';
  6 + {% if page_obj %}
  7 + <script type="text/javascript">
  8 + var pageNum = {{ page_obj.number }}; // The latest page loaded
  9 + var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages
  10 + var baseUrl = '{% url "app:index" %}';
10 11  
11   - // loadOnScroll handler
12   - var loadOnScroll = function() {
13   - // If the current scroll position is past out cutoff point...
14   - if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
15   - // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row
16   - $(window).unbind();
17   - // execute the load function below that will visit the view and return the content
18   - loadItems();
19   - }
20   - };
  12 + // loadOnScroll handler
  13 + var loadOnScroll = function() {
  14 + // If the current scroll position is past out cutoff point...
  15 + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
  16 + // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row
  17 + $(window).unbind();
  18 + // execute the load function below that will visit the view and return the content
  19 + loadItems();
  20 + }
  21 + };
21 22  
22   - var loadItems = function() {
23   - // Check if page is equal to the number of pages
24   - if (pageNum == numberPages) {
25   - return false
26   - }
27   - // Update the page number
28   - pageNum = pageNum + 1;
  23 + var loadItems = function() {
  24 + // Check if page is equal to the number of pages
  25 + if (pageNum == numberPages) {
  26 + return false
  27 + }
  28 + // Update the page number
  29 + pageNum = pageNum + 1;
29 30  
30   - $("#loading").show();
31   - // Configure the url we're about to hit
32   - setTimeout(function (){
33   - $.ajax({
34   - url: baseUrl,
35   - data: {'page': pageNum},
36   - success: function(data) {
37   - $("#loading").hide();
38   -
39   - $("#timeline").append(data);
40   - },
41   - complete: function(data, textStatus){
42   - // Turn the scroll monitor back on
43   - $(window).bind('scroll', loadOnScroll);
44   - }
45   - });
46   - }, 1000)
47   - };
  31 + $("#loading").show();
  32 + // Configure the url we're about to hit
  33 + setTimeout(function (){
  34 + $.ajax({
  35 + url: baseUrl,
  36 + data: {'page': pageNum},
  37 + success: function(data) {
  38 + $("#loading").hide();
48 39  
49   - $(document).ready(function(){
50   - $(window).bind('scroll', loadOnScroll);
51   - });
52   - </script>
  40 + $("#timeline").append(data);
  41 + },
  42 + complete: function(data, textStatus){
  43 + // Turn the scroll monitor back on
  44 + $(window).bind('scroll', loadOnScroll);
  45 + }
  46 + });
  47 + }, 1000)
  48 + };
  49 +
  50 + $(document).ready(function(){
  51 + $(window).bind('scroll', loadOnScroll);
  52 + });
  53 + </script>
  54 + {% endif %}
53 55 {% endblock %}
54 56  
55 57 {% block breadcrumbs %}
... ... @@ -62,70 +64,49 @@
62 64 {% endblock %}
63 65  
64 66 {% block sidebar %}
65   - <div class="panel panel-primary">
  67 + <div class="panel panel-primary navigation">
66 68 <div class="panel-heading">
67   - <img src="{{ user.image_url }}" id="img" class="img-rounded">
68   - <p></p>
69   - <div class="row">
70   - <div class="col-xs-3 col-md-3">
71   - <i class="fa fa-facebook-official fa-2x" aria-hidden="true"></i>
72   - </div>
73   - <div class="col-xs-3 col-md-3">
74   - <i class="fa fa-twitter fa-2x" aria-hidden="true"></i>
75   - </div>
76   - <div class="col-xs-3 col-md-3">
77   - <i class="fa fa-linkedin-square fa-2x" aria-hidden="true"></i>
78   - </div>
79   - <div class="col-xs-3 col-md-3">
80   - <i class="fa fa-google-plus-official fa-2x" aria-hidden="true"></i>
81   - </div>
82   - </div>
83   - </div>
84   - <div class="panel-body">
85   - <ul class="nav nav-pills nav-stacked">
86   - <li> <a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li>
87   - <li> <a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
88   - <li> <a href="#">{% trans 'Pending Tasks' %}</a></li>
89   - {% if user|has_role:'student' and not user.is_staff %}
90   - <li> <a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
91   - {% endif %}
92   - {% if user|has_role:'system_admin' %}
93   - <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
94   - {% endif %}
95   - {% if user|has_role:'system_admin' or user|has_role:'professor' %}
96   - <li>
97   - <a href="#courses_list" class="accordion" data-toggle="collapse">{% trans 'Manage Courses' %}</a>
98   -
99   - <div id="courses_list" class="collapse">
100   - <ul class="nav nav-pill nav-stacked accordion_list">
101   - {% for course in courses_list %}
102   - <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li>
103   - {% endfor %}
104   - </ul>
105   - </div>
106   - </li>
107   - {% endif %}
108   - </ul>
109   - </div>
110   - </div>
  69 + <h4>Menu</h4>
  70 + </div>
  71 + <div class="panel-body">
  72 + <ul class="nav nav-pills nav-stacked">
  73 + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li>
  74 + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
  75 + {% if user|has_role:'student' or not user.is_staff %}
  76 + <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
  77 + {% endif %}
  78 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
  79 + {% if user|has_role:'system_admin' %}
  80 + <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
  81 + {% endif %}
  82 + {% if user|has_role:'system_admin' or user|has_role:'professor' %}
  83 + <li>
  84 + <a href="#courses_list" class="accordion" data-toggle="collapse">{% trans 'Manage Courses' %}</a>
  85 + <div id="courses_list" class="collapse">
  86 + <ul class="nav nav-pill nav-stacked accordion_list">
  87 + {% for course in courses_list %}
  88 + <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li>
  89 + {% endfor %}
  90 + </ul>
  91 + </div>
  92 + </li>
  93 + {% endif %}
  94 + </ul>
  95 + </div>
  96 + </div>
111 97 {% endblock %}
112 98  
113 99 {% block content %}
114 100 {% if user|has_role:'system_admin' %}
115   - <h3>{% trans 'Courses' %}</h3>
116   -
117   - <div id="timeline">
118   - {% include page_template %}
119   - </div>
120   -
  101 + <h3>{% trans 'Courses' %}</h3>
  102 + <div id="timeline">
  103 + {% include page_template %}
  104 + </div>
121 105 {% else %}
122   -
123   - <div id="timeline">
124   - {% include page_template %}
125   - </div>
126   -
  106 + <div id="timeline">
  107 + {% include page_template %}
  108 + </div>
127 109 {% endif %}
128   -
129 110 <div id="loading" class="alert alert-primary" role="alert" style="display: none">
130 111 <center>
131 112 <span class="fa fa-spin fa-circle-o-notch"></span>
... ...
app/templates/home_student.html
... ... @@ -18,12 +18,13 @@
18 18 {% block sidebar %}
19 19 <div class="panel panel-primary navigation">
20 20 <div class="panel-heading">
21   - <h5>{% trans 'Menu' %}</h5>
  21 + <h4>{% trans 'Menu' %}</h4>
22 22 </div>
23 23 <div class="panel-body">
24 24 <ul class="nav nav-pills nav-stacked">
25 25 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
26 26 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
  27 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
27 28 <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li>
28 29 </ul>
29 30 </div>
... ...
app/templates/home_teacher_student_content.html
... ... @@ -4,19 +4,14 @@
4 4  
5 5  
6 6 <div class="well timeLine">
7   - <div class="row">
8   - <div class="col-md-12">
9   - <p><a href="#"></a></p><h6><a href="#"><i>Default Path to Notification</i></a></h6><p></p>
10   - </div>
11   - </div>
  7 +
12 8 <div class="row">
13 9 <div class="col-xs-2 col-md-1">
14 10 <img class="imgTimeLine" src="{{ notification.user.image_url }}">
15 11 </div>
16 12 <div class="col-xs-10 col-md-11">
17   - <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
18   - <a href=""><h4 class="resource_inline"><b>{{ notification.user }}</b></h4></a>
19   - <p class="resource_inline">{{notification.message}} em : <a href="{% url 'core:notification_read' notification.id %}">Recurso</a></p>
  13 + <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4>
  14 + <p class="resource_inline">{{notification.message}} em : <a href="{% url 'core:notification_read' notification.id %}">{{ notification.action_resource.resource.name }}</a></p>
20 15 <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p>
21 16 </div>
22 17 </div>
... ...
app/views.py
... ... @@ -18,8 +18,6 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
18 18 context_object_name = 'objects'
19 19 paginate_by = 10
20 20  
21   -
22   -
23 21 def get_queryset(self):
24 22 if self.request.user.is_staff:
25 23 objects = Course.objects.all()
... ... @@ -42,7 +40,6 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
42 40 else:
43 41 self.template_name = "home_teacher_student_content.html"
44 42  
45   - super(AppIndex, self).createNotification("testando notificacao de login", resource_name="home", resource_link="/")
46 43 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs)
47 44  
48 45  
... ...
core/decorators.py
... ... @@ -60,7 +60,7 @@ def notification_decorator(read = False, message = &#39;&#39;, actor = None, users = [],
60 60 if action.exists():
61 61 action = action[0]
62 62 else:
63   - action = Action(name = not_action)
  63 + action = Action(name = not_action)
64 64 action.save()
65 65  
66 66 if resource.exists():
... ...
core/locale/pt_BR/LC_MESSAGES/django.po
... ... @@ -20,7 +20,7 @@ msgstr &quot;&quot;
20 20  
21 21 #: core/models.py:15 core/models.py:36
22 22 msgid "Name"
23   -msgstr ""
  23 +msgstr "Nome"
24 24  
25 25 #: core/models.py:16 core/models.py:37
26 26 msgid "Created Date"
... ... @@ -36,7 +36,7 @@ msgstr &quot;&quot;
36 36  
37 37 #: core/models.py:61
38 38 msgid "message"
39   -msgstr ""
  39 +msgstr "mensagem"
40 40  
41 41 #: core/models.py:62
42 42 msgid "Actor"
... ... @@ -64,11 +64,11 @@ msgstr &quot;Senha&quot;
64 64  
65 65 #: core/templates/index.html:44
66 66 msgid "Remember Email"
67   -msgstr ""
  67 +msgstr "Lembrar Senha"
68 68  
69 69 #: core/templates/index.html:53
70 70 msgid "Guest"
71   -msgstr ""
  71 +msgstr "Convidado"
72 72  
73 73 #: core/templates/index.html:56
74 74 msgid "Login"
... ... @@ -80,11 +80,11 @@ msgstr &quot;Cadastrar&quot;
80 80  
81 81 #: core/templates/register_user.html:29
82 82 msgid "User Register"
83   -msgstr ""
  83 +msgstr "Registrar Usuário"
84 84  
85 85 #: core/templates/register_user.html:53
86 86 msgid "Save"
87   -msgstr ""
  87 +msgstr "Salvar"
88 88  
89 89 #: core/templates/remember_password.html:18
90 90 msgid "E-mail"
... ... @@ -92,7 +92,7 @@ msgstr &quot;E-mail&quot;
92 92  
93 93 #: core/templates/remember_password.html:22
94 94 msgid "Registration"
95   -msgstr ""
  95 +msgstr "Registrar"
96 96  
97 97 #: core/templates/remember_password.html:26
98 98 msgid "Send"
... ... @@ -100,7 +100,7 @@ msgstr &quot;Enviar&quot;
100 100  
101 101 #: core/views.py:31
102 102 msgid "User successfully registered!"
103   -msgstr ""
  103 +msgstr "Usuario cadastrado com sucesso"
104 104  
105 105 #: core/views.py:54
106 106 msgid "E-mail or password are incorrect!"
... ...
core/migrations/0001_initial.py
1 1 # -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
  2 +# Generated by Django 1.10 on 2016-10-22 04:31
3 3 from __future__ import unicode_literals
4 4  
5 5 import autoslug.fields
  6 +from django.conf import settings
6 7 from django.db import migrations, models
7 8 import django.db.models.deletion
8 9  
... ... @@ -12,6 +13,7 @@ class Migration(migrations.Migration):
12 13 initial = True
13 14  
14 15 dependencies = [
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 17 ]
16 18  
17 19 operations = [
... ... @@ -20,21 +22,23 @@ class Migration(migrations.Migration):
20 22 fields=[
21 23 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22 24 ('name', models.CharField(max_length=100, verbose_name='Name')),
  25 + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from=('name',), unique=True, verbose_name='Slug')),
23 26 ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')),
24 27 ],
25 28 options={
26   - 'verbose_name': 'Action',
27 29 'verbose_name_plural': 'Actions',
  30 + 'verbose_name': 'Action',
28 31 },
29 32 ),
30 33 migrations.CreateModel(
31 34 name='Action_Resource',
32 35 fields=[
33 36 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  37 + ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')),
34 38 ],
35 39 options={
36   - 'verbose_name': 'Action_Resource',
37 40 'verbose_name_plural': 'Action_Resources',
  41 + 'verbose_name': 'Action_Resource',
38 42 },
39 43 ),
40 44 migrations.CreateModel(
... ... @@ -42,10 +46,12 @@ class Migration(migrations.Migration):
42 46 fields=[
43 47 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
44 48 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
  49 + ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  50 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')),
45 51 ],
46 52 options={
47   - 'verbose_name': 'Log',
48 53 'verbose_name_plural': 'Logs',
  54 + 'verbose_name': 'Log',
49 55 },
50 56 ),
51 57 migrations.CreateModel(
... ... @@ -56,8 +62,8 @@ class Migration(migrations.Migration):
56 62 ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')),
57 63 ],
58 64 options={
59   - 'verbose_name': 'Amadeus Mime Type',
60 65 'verbose_name_plural': 'Amadeus Mime Types',
  66 + 'verbose_name': 'Amadeus Mime Type',
61 67 },
62 68 ),
63 69 migrations.CreateModel(
... ... @@ -68,10 +74,12 @@ class Migration(migrations.Migration):
68 74 ('read', models.BooleanField(default=False, verbose_name='Read')),
69 75 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
70 76 ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  77 + ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer')),
  78 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')),
71 79 ],
72 80 options={
73   - 'verbose_name': 'Notification',
74 81 'verbose_name_plural': 'Notifications',
  82 + 'verbose_name': 'Notification',
75 83 },
76 84 ),
77 85 migrations.CreateModel(
... ... @@ -84,8 +92,13 @@ class Migration(migrations.Migration):
84 92 ('url', models.CharField(default='', max_length=100, verbose_name='URL')),
85 93 ],
86 94 options={
87   - 'verbose_name': 'Resource',
88 95 'verbose_name_plural': 'Resources',
  96 + 'verbose_name': 'Resource',
89 97 },
90 98 ),
  99 + migrations.AddField(
  100 + model_name='action_resource',
  101 + name='resource',
  102 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'),
  103 + ),
91 104 ]
... ...
core/migrations/0002_auto_20161018_1842.py
... ... @@ -1,50 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
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   - ('core', '0001_initial'),
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/migrations/0002_auto_20161022_0158.py 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-10-22 04:58
  3 +from __future__ import unicode_literals
  4 +
  5 +import autoslug.fields
  6 +from django.db import migrations
  7 +
  8 +
  9 +class Migration(migrations.Migration):
  10 +
  11 + dependencies = [
  12 + ('core', '0001_initial'),
  13 + ]
  14 +
  15 + operations = [
  16 + migrations.AlterField(
  17 + model_name='action',
  18 + name='slug',
  19 + field=autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug'),
  20 + ),
  21 + ]
... ...
core/mixins.py
... ... @@ -41,22 +41,23 @@ class LogMixin(object):
41 41 class NotificationMixin(object):
42 42 message = ""
43 43 read = False
44   - action_name = ''
  44 + action_slug = ''
45 45 resource_name = ''
46 46  
47   - def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_name = '', resource_name='', resource_link=''): #the default will be a broadcast
48   - action = Action.objects.filter(name = action_name)
  47 + def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_slug = '',
  48 + resource_name='', resource_link=''): #the default will be a broadcast
  49 + action = Action.objects.filter(slug = action_slug)
49 50 resource = Resource.objects.filter(slug = resource_slug)
50 51 if action.exists():
51 52 action = action[0]
52 53 else:
53   - action = Action(name = self.action_name)
  54 + action = Action(name = action_slug)
54 55 action.save()
55 56  
56 57 if resource.exists():
57 58 resource = resource[0]
58 59 else:
59   - resource = Resource(name = self.resource_name, url= resource_link)
  60 + resource = Resource(name = resource_name, url= resource_link)
60 61 resource.save()
61 62  
62 63 action_resource = Action_Resource.objects.filter(action = action, resource = resource)
... ... @@ -76,3 +77,9 @@ class NotificationMixin(object):
76 77 """
77 78 Not quite sure how to do about it"""
78 79 return super(NotificationMixin, self).dispatch(request, *args, **kwargs)
  80 +
  81 + def createorRetrieveAction(self, action_name):
  82 + action = Action.objects.filter(name=action_name)
  83 + if action is None:
  84 + action = Action(name=action_name)
  85 + return action
79 86 \ No newline at end of file
... ...
core/models.py
... ... @@ -25,6 +25,7 @@ class Action(models.Model):
25 25 """
26 26  
27 27 name = models.CharField(_('Name'), max_length = 100)
  28 + slug = AutoSlugField(_("Slug"), populate_from=('name'), unique=True)
28 29 created_date = models.DateField(_('Created Date'), auto_now_add=True)
29 30  
30 31 class Meta:
... ... @@ -84,7 +85,7 @@ class Notification(models.Model):
84 85 @action_resource: The Object that holds the information about which action was perfomed on the Resource
85 86 @actor: The user who applied the action
86 87 """
87   -
  88 +
88 89 message = models.TextField(_('Message'))
89 90 user = models.ForeignKey(User, related_name = _('%(class)s_Actor'), verbose_name= _('User'))
90 91 read = models.BooleanField(_('Read'), default = False)
... ...
core/static/css/base/amadeus.css
... ... @@ -12,7 +12,7 @@
12 12 #notification-dropdown{
13 13 max-height: 500%;
14 14 overflow: auto;
15   - width: 200px;
  15 + width: 300px;
16 16 }
17 17  
18 18 /* HEADER */
... ... @@ -276,7 +276,7 @@ a.alert_message:hover{color : grey}
276 276  
277 277 /*Logo register user*/
278 278 #logo{
279   - max-width: 30%;
  279 + max-width: 40%;
280 280 margin-top: 1em;
281 281 margin-bottom: 1em;
282 282 }
... ... @@ -337,4 +337,31 @@ ul, li {
337 337  
338 338 .icon_edit_remove{
339 339 float: right;
  340 +}
  341 +
  342 +
  343 +/* core/index.html classes*/
  344 +
  345 +.logo-login{
  346 + margin-top: 15px;
  347 + margin-bottom: 15px;
  348 + width:50%;
  349 +}
  350 +.forgotPassword{
  351 + padding-bottom: 10px;
  352 +}
  353 +.form-group{
  354 + margin-top: 10px;
  355 +}
  356 +
  357 +/* core/register_user.html classes*/
  358 +
  359 +.block-register-inline{
  360 + float: left;
  361 + display: inline-block;
  362 +}
  363 +
  364 +/* core/reset_password.html classes*/
  365 +.send-reset-email{
  366 + float: right;
340 367 }
341 368 \ No newline at end of file
... ...
core/static/css/base/header.css
... ... @@ -41,4 +41,3 @@
41 41 font-size: 20px;
42 42  
43 43 }
44   -
... ...
core/static/js/main.js
1   -$('.date-picker').datepicker({ format: 'dd/mm/yy' });
2 1 \ No newline at end of file
  2 +$('.date-picker').datepicker({
  3 + format: 'mm/dd/yyyy',
  4 +});
3 5 \ No newline at end of file
... ...
core/templates/base.html
... ... @@ -47,77 +47,60 @@
47 47 {% endblock %}
48 48 </head>
49 49 <body>
  50 + {% block nav %}
  51 + <div class="navbar navbar-default">
  52 + <div class="navbar-header">
  53 + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
  54 + <span class="icon-bar"></span>
  55 + <span class="icon-bar"></span>
  56 + <span class="icon-bar"></span>
  57 + </button>
  58 + <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
  59 + </div>
  60 + <div class="navbar-collapse collapse navbar-responsive-collapse">
  61 + <ul class="nav navbar-nav navbar-right notifications">
  62 + <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
  63 + <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
  64 + <ul id="notification-dropdown" class="dropdown-menu">
  65 + <li class="dropdown-header">Notifications</li>
  66 + {% include "notifications.html" %}
  67 +
  68 + <li>
  69 + <a onclick="getNotifications(5)">
  70 + <div id="notification-see-more" class="list-group-item">
  71 + <div class="row-content">
  72 + <p class="list-group-item-text">See More</p>
  73 + </div>
  74 + </a>
  75 + </li>
  76 + </ul>
  77 + </li>
  78 +
  79 + <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>
  80 + <li > <a class="link" href="{% url 'users:profile' %}">{{ user }}</a></li>
  81 + <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>
  82 + </ul>
  83 + </div>
  84 + </div>
  85 + {% endblock %}
50 86 <div class="container-fluid">
51   - {% block nav %}
52   - <div class="row">
53   - <div class="navbar navbar-default">
54   - <div class="navbar-header">
55   - <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
56   - <span class="icon-bar"></span>
57   - <span class="icon-bar"></span>
58   - <span class="icon-bar"></span>
59   - </button>
60   - <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
61   - </div>
62   - <div class="navbar-collapse collapse navbar-responsive-collapse">
63   - <ul class="nav navbar-nav navbar-right notifications">
64   - <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
65   - <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
66   - <ul id="notification-dropdown" class="dropdown-menu">
67   - <li class="dropdown-header">Notifications</li>
68   - {% include "notifications.html" %}
69   -
70   - <li>
71   - <a onclick="getNotifications(5)">
72   - <div id="notification-see-more" class="list-group-item">
73   - <div class="row-content">
74   - <p class="list-group-item-text">See More</p>
75   - </div>
76   - </a>
77   - </li>
78   - </ul>
79   - </li>
80   -
81   - <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>
82   - <li > <a class="link" href="{% url 'users:profile' %}">{{ user }}</a></li>
83   - <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>
84   - </ul>
85   - </div>
86   - </div>
87   - </div>
88   - {% endblock %}
89   -
90 87 <div class="row">
91   - <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
92   - {% block sidebar %}
93   -
94   - {% endblock %}
95   - </div>
96   -
97   - <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
98   - {% block breadcrumbs %}
99   -
100   - {% endblock %}
101   -
102   - {% block render_breadcrumbs %}
103   -
104   - {% endblock %}
105   - <div class="row">
106   - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
107   - {% block content %}
108   -
109   - {% endblock %}
110   - </div>
111   -
112   -
113   - </div>
114   - </div>
  88 + <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
  89 + {% block sidebar %}{% endblock %}
  90 + </div>
  91 + <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
  92 + {% block breadcrumbs %}{% endblock %}
  93 + {% block render_breadcrumbs %}{% endblock %}
  94 + </div>
  95 + <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
  96 + {% block content %}{% endblock %}
  97 + </div>
115 98 </div>
116 99 </div>
117 100 <script src="{% static 'js/main.js' %}"></script>
118 101 <script type="text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script>
119 102 {% block script_file %}
120   -
  103 +
121 104 {% endblock script_file %}
122 105 </body>
123 106  
... ...
core/templates/create_account.html
... ... @@ -1,180 +0,0 @@
1   -<!DOCTYPE html>
2   -{% load static %}
3   -<!--
4   -Copyright 2008, 2009 UFPE - Universidade Federal de Pernambuco
5   -
6   -Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
7   -
8   -O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como
9   -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença.
10   -
11   -Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
12   -
13   -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
14   --->
15   -
16   -
17   -
18   -
19   -
20   -
21   -
22   -<html>
23   -<head>
24   - <!--
25   -Copyright 2008, 2009 UFPE - Universidade Federal de Pernambuco
26   -
27   -Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
28   -
29   -O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como
30   -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença.
31   -
32   -Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
33   -
34   -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
35   --->
36   -
37   -
38   -
39   -
40   - <title>Projeto Amadeus</title>
41   -
42   - <meta http-equiv="Cache-Control" content="no-cache, no-store" />
43   -
44   - <link href="{% static 'css/css.css' %}" rel="stylesheet" type="text/css" />
45   - <link href="{% static 'css/amadeus.css' %}" rel="stylesheet" type="text/css" />
46   - <link href="{% static 'css/content_management.css' %}" rel="stylesheet" type="text/css" />
47   - <link href="{% static 'css/jqueryui/smoothness/jquery-ui-1.7.1.custom.css' %}" rel="stylesheet" type="text/css" />
48   -
49   - <script type='text/javascript' src='dwr/interface/UtilDWR.js'></script>
50   - <script type='text/javascript' src='dwr/engine.js'></script>
51   - <script type='text/javascript' src='dwr/util.js'></script>
52   - <script type="text/javascript" src="{% static 'js/jqueryui/jquery-1.3.2.min.js' %}"></script>
53   - <script type="text/javascript" src="{% static 'js/jqueryui/jquery-ui-1.7.1.custom.min.js' %}"></script>
54   - <script type="text/javascript" src="{% static 'js/openid.js' %}"></script>
55   - <script type="text/javascript" src="{% static 'js/amadeus.js' %}"></script>
56   -</head>
57   -<body>
58   - <div id="pBody" class="pBody">
59   - <div id="pHeader" class="pHeader">
60   - <div id="login">
61   - <dl id="formlogin">
62   - <form name="logonForm" method="post" action="/amadeuslms/validateLogin.do">
63   - <dt><input type="text" name="login" maxlength="15" size="15" value="" class="inputlogin"> </dt>
64   - <dt><input type="password" name="password" maxlength="15" size="15" value="" class="inputlogin">&nbsp;<br /><a href="" name="logonForm" class="button">Entrar</a></dt>
65   - </form>
66   -<script type="text/javascript" language="JavaScript">
67   - <!--
68   - var focusControl = document.forms["logonForm"].elements["login"];
69   -
70   - if (focusControl.type != "hidden" && !focusControl.disabled) {
71   - focusControl.focus();
72   - }
73   - // -->
74   -</script>
75   -
76   - </dl>
77   - </div>
78   - </div>
79   - <!--
80   -Copyright 2008, 2009 UFPE - Universidade Federal de Pernambuco
81   -
82   -Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
83   -
84   -O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como
85   -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença.
86   -
87   -Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
88   -
89   -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90   --->
91   -
92   -
93   -
94   -
95   -
96   -
97   -
98   -<div id="institutional_menu">
99   -
100   - <span><a href="/amadeuslms/fProject.do" target="_blank">O Projeto</a></span>
101   - <span>&nbsp;|&nbsp;</span>
102   - <span><a href="/amadeuslms/fCCTE.do" target="_blank">Grupo CCTE</a></span>
103   -</div>
104   - <div id="pTitle" class="pTitle">
105   - <h2>Nova conta</h2>
106   - </div>
107   - <div id="pBreadCrumbs" class="pBreadCrumbs">
108   - <ul id="breadcrumb">
109   - <li><a href="">Página Inicial</a></li>
110   - <li>Nova conta</li>
111   - </ul>
112   - </div>
113   - <div id="pLeftMenu" class="pLeftMenu">
114   - <div id="side_menu_1">
115   - <ul id="menu_sessoes">
116   - <li><a href="" class="insert">Lembrar senha</a></li>
117   - </ul>
118   - </div>
119   - </div>
120   - <div id="pContent" class="pContent">
121   - <dl class="insert2">
122   - <form name="formUserRegister" method="post" action="/amadeuslms/insertUser.do">
123   -
124   - <dt>Nome completo</dt>
125   - <dd class="field"><input type="text" name="name" value="" class="formfield" id="realname"></dd>
126   - <dd class="description">Seu nome completo</dd>
127   - <dt>E-mail</dt>
128   - <dd class="field"><input type="text" name="email" value="" class="formfield" id="mail"></dd>
129   - <dd class="description">Seu endereço de e-mail (exemplo@mail.com)</dd>
130   - <dt>Login</dt>
131   - <dd class="field"><input type="text" name="login" maxlength="15" size="15" value="" class="formfield" id="username"></dd>
132   - <dd class="description">Seu login</dd>
133   - <dt>Senha</dt>
134   - <dd class="field"><input type="password" name="password" maxlength="15" size="15" value="" class="formfield" id="password"></dd>
135   - <dd class="description">Sua senha (mínimo de 4 caracteres)</dd>
136   - <dt>Confirmação de senha</dt>
137   - <dd class="field"><input type="password" name="passwordConfirmation" maxlength="15" size="15" value="" class="formfield" id="passwordConfirmation"></dd>
138   - <dd class="description">Confirme sua senha</dd>
139   - <dt class="field"><input type="submit" name="insertUser" value="Cadastrar" class="button"></dt>
140   - <br/><br/><ul id="required"><li>Todos os campos são de preenchimento obrigatório</li></ul>
141   - </form>
142   -<script type="text/javascript" language="JavaScript">
143   - <!--
144   - var focusControl = document.forms["formUserRegister"].elements["name"];
145   -
146   - if (focusControl.type != "hidden" && !focusControl.disabled) {
147   - focusControl.focus();
148   - }
149   - // -->
150   -</script>
151   -
152   - </dl>
153   - </div>
154   - <div id="pRightMenu" class="pRightMenu">
155   -
156   - </div>
157   - <!--
158   -Copyright 2008, 2009 UFPE - Universidade Federal de Pernambuco
159   -
160   -Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
161   -
162   -O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como
163   -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença.
164   -
165   -Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
166   -
167   -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
168   --->
169   -
170   -
171   -
172   -
173   -
174   -<div id="footnote">
175   - <dl><dd>Copyright Amadeus. Todos os direitos reservados<dd></dl>
176   -</div>
177   -
178   - </div>
179   -</body>
180   -</html>
core/templates/guest.html 0 → 100644
... ... @@ -0,0 +1,172 @@
  1 +<!DOCTYPE html>
  2 +
  3 +{% load static i18n %}
  4 +{% load i18n custom_filters %}
  5 +
  6 +<html>
  7 +<head>
  8 + <title>{{ title }}</title>
  9 +
  10 + <meta http-equiv="Cache-Control" content="no-cache, no-store" />
  11 + <link href="{% static 'img/favicon.ico' %}" rel="shortcut icon" />
  12 + <!-- Roboto font -->
  13 + <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
  14 + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  15 +
  16 + <!-- jQuery & jQuery UI -->
  17 + <script type="text/javascript" src="{% static 'js/vendor/jquery-3.1.0.min.js' %}"></script>
  18 + <script type="text/javascript" src="{% static 'js/vendor/jquery-ui.js' %}"></script>
  19 +
  20 + <!-- Bootstrap and themes (material) -->
  21 + <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}">
  22 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/material.min.css' %}">
  23 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/ripples.min.css' %}">
  24 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/datepicker.css' %}">
  25 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/alertify.min.css' %}">
  26 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/themes/bootstrap.css' %}">
  27 + <script type="text/javascript" src="{% static 'bootstrap-3.3.7/js/bootstrap.js' %}"></script>
  28 + <script type="text/javascript" src="{% static 'js/vendor/bootstrap-acessibility.min.js' %}"></script>
  29 + <script type="text/javascript" src="{% static 'js/vendor/material.min.js' %}"></script>
  30 + <script type="text/javascript" src="{% static 'js/vendor/ripples.min.js' %}"></script>
  31 + <script type="text/javascript" src="{% static 'js/vendor/bootstrap-datepicker.js' %}"></script>
  32 + <script type="text/javascript" src="{% static 'js/vendor/alertify.min.js' %}"></script>
  33 +
  34 + <!-- Font awesome -->
  35 + <link rel="stylesheet" type="text/css" href="{% static 'font-awesome-4.6.3/css/font-awesome.min.css' %}">
  36 +
  37 + <!-- Custom styles -->
  38 + <link rel="stylesheet" type="text/css" href="{% static 'css/base/amadeus.css' %}">
  39 +
  40 + <!-- Init material Bootstrap -->
  41 + <script type="text/javascript">$.material.init()</script>
  42 +
  43 + <!--Javascript block for specific-app ones -->
  44 + <script src="{% static 'js/base/amadeus.js' %}"></script>
  45 + {% block style %}
  46 + {% endblock %}
  47 + {% block javascript %}
  48 + <script type="text/javascript" src="{% static 'js/course.js' %}"></script>
  49 + {% endblock %}
  50 +</head>
  51 +<body>
  52 + {% block nav %}
  53 + <div class="navbar navbar-default">
  54 + <div class="navbar-header">
  55 + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
  56 + <span class="icon-bar"></span>
  57 + <span class="icon-bar"></span>
  58 + <span class="icon-bar"></span>
  59 + </button>
  60 + <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
  61 + </div>
  62 + <div class="navbar-collapse collapse navbar-responsive-collapse">
  63 + <ul class="nav navbar-nav navbar-right notifications">
  64 + <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
  65 + <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
  66 + <ul id="notification-dropdown" class="dropdown-menu">
  67 + <li class="dropdown-header">Notifications</li>
  68 + {% include "notifications.html" %}
  69 +
  70 + <li>
  71 + <a onclick="getNotifications(5)">
  72 + <div id="notification-see-more" class="list-group-item">
  73 + <div class="row-content">
  74 + <p class="list-group-item-text">See More</p>
  75 + </div>
  76 + </a>
  77 + </li>
  78 + </ul>
  79 + </li>
  80 +
  81 + <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>
  82 + <li > <a class="link" href="{% url 'app:index' %}">{{ user }}</a></li>
  83 +
  84 + </ul>
  85 + </div>
  86 + </div>
  87 + {% endblock %}
  88 + <div class="container-fluid">
  89 + <div class="row">
  90 +
  91 + <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
  92 + {% block sidebar %}
  93 + <div class="panel panel-primary navigation">
  94 + <div class="panel-heading">
  95 + <h4>Menu</h4>
  96 + </div>
  97 + <div class="panel-body">
  98 + <ul class="nav nav-pills nav-stacked">
  99 + <li><a href="{% url 'core:register' %}">{% trans 'Register' %}</a></li>
  100 + </ul>
  101 + </div>
  102 + </div>
  103 + {% endblock %}
  104 +
  105 + </div>
  106 + <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
  107 + {% block breadcrumbs %}
  108 + <div class="col-md-12">
  109 + <form id="searchform" action="{% url 'course:manage' %}" method="get" accept-charset="utf-8">
  110 + <div class="input-group">
  111 + <div class="form-group is-empty">
  112 + <input type="search" class="form-control" placeholder="Search Courses" name="q" id="searchbox"></div>
  113 + <span class="input-group-btn input-group-sm">
  114 + <button type="button" class="btn btn-fab btn-fab-mini">
  115 + <i class="material-icons">search</i>
  116 + </button>
  117 + </span>
  118 + </div>
  119 + </form>
  120 + </div>
  121 +
  122 + <div class="col-md-12">
  123 + <div class="btn-group btn-group-justified btn-group-raised">
  124 + <a href="?category=all" class="btn btn-raised btn-info">Todos</a>
  125 + {% for category in categories %}
  126 + <a href="?category={{category.name}}" class="btn btn-raised btn-primary">{{category.name}}</a>
  127 + {% endfor %}
  128 + </div>
  129 + </div>
  130 +
  131 + {% endblock %}
  132 + {% block render_breadcrumbs %}{% endblock %}
  133 + <div>
  134 + </div>
  135 + <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
  136 + {% block content %}
  137 + {% for course in courses %}
  138 + <div class="panel panel-info panel_{{ course.id }}">
  139 + <div class="panel-heading">
  140 + <a href="{{ course.get_absolute_url }}" class="panel-title">{{course.name}}</a>
  141 + {% if user|show_course_subscribe:course %}
  142 + <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}', {{ course.id}}, '{% trans 'Are you sure you want to subscribe to this course?' %}')" class="btn btn-sm btn-primary btn-raised pull-right" style="margin-top:-4px">{% trans 'Subscribe' %}</a>
  143 + {% endif %}
  144 + </div>
  145 +
  146 + <div class="panel-body">
  147 + <p><b>Course Name: </b>{{course.name}}</p>
  148 + <p><b>Begining: </b>{{course.init_date}}</p>
  149 + <p><b>End: </b>{{course.end_date}}</p>
  150 + <p><b>Professor: </b>{{course.professors.name}}</p>
  151 + <p>
  152 + <b>Description:</b>
  153 + <i>
  154 + {{course.content}}
  155 + </i>
  156 + </p>
  157 + </div>
  158 + </div>
  159 + {% endfor %}
  160 +
  161 + {% endblock %}
  162 + </div>
  163 + </div>
  164 + </div>
  165 + <script src="{% static 'js/main.js' %}"></script>
  166 + <script type="text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script>
  167 + {% block script_file %}
  168 +
  169 + {% endblock script_file %}
  170 +</body>
  171 +
  172 +</html>
0 173 \ No newline at end of file
... ...
core/templates/index.html
... ... @@ -10,20 +10,16 @@
10 10 {% endblock sidebar %}
11 11  
12 12 {% block content %}
13   - <div class="row">
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">
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>
18   - </br>
19   - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
20   - </br>
21   - </div>
  13 + <div class="row">
  14 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
  15 + <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
  16 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
  17 + </div>
22 18 </div>
23 19 </div>
24 20  
25   - <div class="row ">
26   - <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">
  21 + <div class="row">
  22 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-8 col-lg-offset-3 col-xl-8 col-xl-offset-3">
27 23 {% if messages %}
28 24 {% for message in messages %}
29 25 <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert">
... ... @@ -38,44 +34,41 @@
38 34 <div class="card-block">
39 35 <form id="form-login" class="form-group" method="post" action="">
40 36 {% csrf_token %}
41   - <div class="form-group is-empty">
42   - <label for="inputEmail" class="col-md-4 col-xs-4 col-sm-4 col-lg-4 control-label"> {% trans 'Username' %}</label>
43   - <div class="col-md-8 col-xs-8 col-lg-8 col-sm-8">
44   - <input form="form-login" type="text" name="username" class="form-control" id="inputEmail" placeholder="Username" value="{% if username %}{{username}}{% endif %}">
45   - </div>
46   - </div>
47   - <div class="form-group is-empty">
48   - <label for="inputPassword" class="col-md-4 col-xs-4 col-lg-4 col-sm-4 control-label"> {% trans 'Password' %}</label>
49   - <div class="col-md-8 col-xs-8 col-lg-8 col-sm-8">
50   - <input form="form-login" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password">
51   - </div>
52   - </div>
53   - <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10">
54   - <div class="checkbox">
55   - <label>
56   - <input form="form-login" type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Remember Email' %}
57   - </label>
58   - </div>
59   - </div>
60   - </form>
61   - <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10">
62   - <a href="{% url 'core:password_reset' %}">{% trans "Forgot your password?" %}</a>
63   - </div>
64   - {# </div> #}
65   - {# <div class="row"> #}
66   - <div class="col-md-6 col-xs-6 col-sm-6 col-lg-6 text-center">
67   - <button type="button" class="btn btn-flat" formaction="#" style="position: initial;">{% trans 'Guest' %}</button>
68   - </div>
69   - <div class="col-md-6 col-xs-6 col-sm-6 col-lg-6 text-center">
70   - <button type="submite" class="btn btn-flat btn-success" form="form-login" style="position: initial;">{% trans 'Login' %}</button>
71   - </div>
72   - {# </div> #}
  37 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
  38 + <div class="form-group">
  39 + <label for="inputEmail" class="control-label"> {% trans 'Username' %}</label>
  40 + <input form="form-login" for="inputSmall" type="text" name="username" class="form-control" placeholder="Username" id="inputEmail" value="{% if username %}{{username}}{% endif %}">
  41 + </div>
  42 + </div>
  43 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
  44 + <div class="form-group">
  45 + <label for="inputPassword" class="control-label"> {% trans 'Password' %}</label>
  46 + <input form="form-login" for="inputSmall" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password">
  47 + </div>
  48 + </div>
  49 + <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10 col-lg-offset-1">
  50 + <div class="checkbox">
  51 + <label>
  52 + <input form="form-login" type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Remember Email' %}
  53 + </label>
  54 + </div>
  55 + </div>
  56 + </form>
  57 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 col-lg-offset-1 text-center">
  58 + <button type="submite" class="btn btn-success btn-raised btn-block" form="form-login" style="position: initial;">{% trans 'Login' %}</button>
  59 + </div>
  60 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 text-center">
  61 + <a class="btn btn-default btn-raised btn-block" href="{% url 'core:guest' %}" formaction="#" style="position: initial;">{% trans 'Guest' %}</a>
  62 + </div>
  63 + <div class="col-md-10 col-sm-10 col-xs-10 col-lg-6 col-lg-offset-7 forgotPassword">
  64 + <a href="{% url 'core:password_reset' %}">{% trans "Forgot your password?" %}</a>
  65 + </div>
73 66 </div>
74 67 </div>
75 68 <a class="btn btn-raised btn-primary btn-block" href="{% url 'core:register' %}">{% trans 'Sign Up' %} </a>
76 69 </div>
77 70 </div>
78   - </div>
  71 +
79 72 {% endblock%}
80 73  
81 74  
... ...
core/templates/notifications.html
... ... @@ -6,7 +6,7 @@
6 6 <a href="{% url 'core:notification_read' notification.id %}"><div class="list-group-item">
7 7 <div class="row-picture">
8 8 <img class="circle" src="http://lorempixel.com/56/56/people/1" alt="icon">
9   - <div class="least-content pull-right">{{ notification.datetime }}</div>
  9 + <div class="least-content ">{{ notification.datetime }}</div>
10 10 </div>
11 11 <div class="row-content">
12 12 <p class="list-group-item-text">{{ notification.message }}</p>
... ...
core/templates/register_user.html
... ... @@ -18,80 +18,85 @@
18 18 </div>
19 19 {% endfor %}
20 20 {% endif %}
21   - <div class="row logo-row">
22   - <div class="col-lg-offset-2 col-lg-9">
23   - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus" id="logo">
24   - </div>
  21 + <div class="row">
  22 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
  23 + <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
  24 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
  25 + </div>
  26 + </div>
25 27 </div>
26 28  
27 29 <div class="row">
28   - <div class="">
  30 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-10 col-lg-offset-2 col-xl-8 col-xl-offset-3">
29 31 <div class="card">
30 32 <div class="card-content">
31 33 <div class="card-body">
32   - <form class="form-horizontal" name="registerForm" method="post" action="" enctype="multipart/form-data">
  34 + <form class="form-horizontal" name="registerForm" method="post" id="register-user" enctype="multipart/form-data">
33 35 {% csrf_token %}
34   - <legend>{% trans 'User Register' %}</legend>
35   - {% for field in form %}
36   - <div class="form-group is-empy{% if form.has_error %} has-error {% endif %} is-fileinput">
37   - {% if field.field.required %}
38   - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}<span>*</span></label>
39   - {% else %}
40   - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label>
41   - {% endif %}
42   - <div class="col-md-8">
43   - {% if field.auto_id == 'id_birth_date' %}
44   - {% render_field field class='form-control input-sm date-picker' %}
45   -
46   - <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
47   - {% elif field.auto_id == 'id_image' %}
48   - {% render_field field class='form-control input-sm' %}
49   - <div class="input-group">
50   - <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">
51   - <span class="input-group-btn input-group-sm">
52   - <button type="button" class="btn btn-fab btn-fab-mini">
53   - <i class="material-icons">attach_file</i>
54   - </button>
55   - </span>
56   - </div>
57   - {% elif field.auto_id == 'id_cpf' %}
58   - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %}
  36 + <h2>{% trans 'User Register' %}</h2>
  37 + <hr>
  38 + <div class="row">
  39 + <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  40 + {% for field in form %}
  41 + <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput block-register-inline">
  42 + {% if field.field.required %}
  43 + <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}<span>*</span></label>
  44 + {% else %}
  45 + <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label>
  46 + {% endif %}
  47 + <div class="col-md-8 col-lg-10 col-lg-offset-2">
  48 + {% if field.auto_id == 'id_birth_date' %}
  49 + {% render_field field class='form-control input-sm date-picker' %}
  50 + <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
  51 + {% elif field.auto_id == 'id_image' %}
  52 + {% render_field field class='form-control input-sm' %}
  53 + <div class="input-group">
  54 + <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">
  55 + <span class="input-group-btn input-group-sm">
  56 + <button type="button" class="btn btn-fab btn-fab-mini">
  57 + <i class="material-icons">attach_file</i>
  58 + </button>
  59 + </span>
  60 + </div>
  61 + {% elif field.auto_id == 'id_cpf' %}
  62 + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %}
59 63  
60   - {% elif field.auto_id == 'id_phone' %}
61   - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %}
62   - {% else %}
63   - {% render_field field class='form-control' %}
64   - <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
65   - {% endif %}
66   - </div>
67   -
68   - {% if field.errors %}
69   - <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert">
70   - <button type="button" class="close" data-dismiss="alert" aria-label="Close">
71   - <span aria-hidden="true">&times;</span>
72   - </button>
73   - <ul>
74   - {% for error in field.errors %}
75   - <li>{{ error }}</li>
  64 + {% elif field.auto_id == 'id_phone' %}
  65 + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %}
  66 + {% else %}
  67 + {% render_field field class='form-control' %}
  68 + <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
  69 + {% endif %}
  70 + </div>
  71 +
  72 + {% if field.errors %}
  73 + <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert">
  74 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  75 + <span aria-hidden="true">&times;</span>
  76 + </button>
  77 + <ul>
  78 + {% for error in field.errors %}
  79 + <li>{{ error }}</li>
  80 + {% endfor %}
  81 + </ul>
  82 + </div>
  83 + {% endif %}
  84 + </div>
76 85 {% endfor %}
77   - </ul>
  86 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 col-lg-offset-1 text-center">
  87 + <input type="submit" value="{% trans 'Save' %}" class="btn btn-success btn-raised" />
  88 + </div>
  89 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 text-center">
  90 + <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Cancel' %}</a>
  91 + </div>
78 92 </div>
79   - {% endif %}
80 93 </div>
81   - {% endfor %}
82   - <div class="col-md-offset-4 col-md-2 col-sm-2 col-xs-2">
83   - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" />
84   - </div>
85   - <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2">
86   - <a href="{% url 'core:home' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a>
87   - </div>
88   -
89 94 </form>
90 95 </div>
91 96 </div>
92 97 </div>
93 98 </div>
94 99 </div>
95   -
  100 +
96 101 <br clear="all" />
97 102 {% endblock %}
... ...
core/templates/registration/passwor_reset_done.html
1 1 {% extends "index.html" %}
2 2 {% load i18n static %}
  3 +{% block content%}
3 4  
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>
  5 +<div class="row">
  6 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
  7 + <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
  8 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
15 9 </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>{% trans "We have sent instructions to set up your password, if an account exists with the email entered. You should receive them soon." %}</p>
26   - <p>{% trans "If you do not receive an email, please make sure you entered the address you registered, and check the spam folder." %}</p>
27   - </div>
28   - </form>
  10 + </div>
  11 +</div>
  12 +<div class="row">
  13 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-8 col-lg-offset-3 col-xl-8 col-xl-offset-3">
  14 + {% if success %}
  15 + <div class="alert alert-success alert-dismissible" role="alert">
  16 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  17 + <span aria-hidden="true">&times;</span>
  18 + </button>
  19 + <ul>
  20 + <li>{{ success }}</li>
  21 + </ul>
  22 + </div>
  23 + {% elif danger %}
  24 + <div class="alert alert-danger alert-dismissible" role="alert">
  25 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  26 + <span aria-hidden="true">&times;</span>
  27 + </button>
  28 + <ul>
  29 + <li>{{ danger }}</li>
  30 + </ul>
  31 + </div>
  32 + {% endif %}
  33 + <div class="card">
  34 + <div class="card-block">
  35 + <form class="form-group " method="post" action="">
  36 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
  37 + {% csrf_token %}
  38 + <div class="form-group is-empty">
  39 + <p>{% trans "We have sent instructions to set up your password, if an account exists with the email entered. You should receive them soon." %}</p>
  40 + <p>{% trans "If you do not receive an email, please make sure you entered the address you registered, and check the spam folder." %}</p>
  41 + </div>
  42 + <div class="form-group">
  43 + <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Back' %}</a>
29 44 </div>
30 45 </div>
31   - </div>
  46 + </form>
32 47 </div>
  48 + </div>
33 49 </div>
34   -
35   -{% endblock %}
  50 +</div>
  51 +{% endblock content %}
... ...
core/templates/registration/passwor_reset_form.html
... ... @@ -2,57 +2,53 @@
2 2 {% load i18n static %}
3 3 {% block content%}
4 4  
5   - <div class="row">
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">
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>
10   - </br>
11   - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
12   - </br>
13   - </div>
14   - </div>
15   - </div>
16   - <div class="row ">
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 %}
19   - <div class="alert alert-success alert-dismissible" role="alert">
20   - <button type="button" class="close" data-dismiss="alert" aria-label="Close">
21   - <span aria-hidden="true">&times;</span>
22   - </button>
23   - <ul>
24   - <li>{{ success }}</li>
25   - </ul>
26   - </div>
27   - {% elif danger %}
28   - <div class="alert alert-danger alert-dismissible" role="alert">
29   - <button type="button" class="close" data-dismiss="alert" aria-label="Close">
30   - <span aria-hidden="true">&times;</span>
31   - </button>
32   - <ul>
33   - <li>{{ danger }}</li>
34   - </ul>
35   - </div>
36   - {% endif %}
37   - <div class="card">
38   - <div class="card-block">
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="">
41   - {% csrf_token %}
42   - <div class="form-group is-empty">
43   - <label for="inputEmail" class="ccontrol-label"> {% trans 'E-mail' %}</label>
44   - <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{form.email}}"{% endif %}>
45   - </div>
46   - <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">
47   - <button type="submite" class="btn btn-raised btn-primary btn-block">{% trans 'Send' %}</button>
48   -
49   - </div>
50   - </form>
51   - </div>
52   - </div>
53   - </div>
  5 +<div class="row">
  6 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
  7 + <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
  8 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
  9 + </div>
  10 + </div>
  11 +</div>
  12 +<div class="row">
  13 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-8 col-lg-offset-3 col-xl-8 col-xl-offset-3">
  14 + {% if success %}
  15 + <div class="alert alert-success alert-dismissible" role="alert">
  16 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  17 + <span aria-hidden="true">&times;</span>
  18 + </button>
  19 + <ul>
  20 + <li>{{ success }}</li>
  21 + </ul>
  22 + </div>
  23 + {% elif danger %}
  24 + <div class="alert alert-danger alert-dismissible" role="alert">
  25 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  26 + <span aria-hidden="true">&times;</span>
  27 + </button>
  28 + <ul>
  29 + <li>{{ danger }}</li>
  30 + </ul>
  31 + </div>
  32 + {% endif %}
  33 + <div class="card">
  34 + <div class="card-block">
  35 + <form class="form-group " method="post" action="">
  36 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
  37 + {% csrf_token %}
  38 + <div class="form-group is-empty">
  39 + <label for="inputEmail" class="ccontrol-label"> {% trans 'E-mail' %}</label>
  40 + <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{form.email}}"{% endif %}>
  41 + </div>
  42 + <div class="form-group send-reset-email">
  43 + <button type="submite" class="btn btn-raised btn-primary ">{% trans 'Send' %}</button>
  44 + </div>
  45 + <div class="form-group">
  46 + <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Back' %}</a>
  47 + </div>
  48 + </div>
  49 + </form>
54 50 </div>
55 51 </div>
56 52 </div>
57   -
  53 +</div>
58 54 {% endblock content %}
... ...
core/urls.py
... ... @@ -11,6 +11,7 @@ urlpatterns = [
11 11 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'),
12 12 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'),
13 13 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'),
  14 + url(r'^guest/$', views.guest, name='guest'),
14 15  
15 16 #Reset Password
16 17  
... ...
core/views.py
... ... @@ -18,7 +18,7 @@ from .forms import RegisterUserForm
18 18 from .decorators import log_decorator, notification_decorator
19 19  
20 20 from users.models import User
21   -
  21 +from courses.models import Course, CourseCategory
22 22  
23 23 def index(request):
24 24 context = {
... ... @@ -68,7 +68,6 @@ def remember_password(request):
68 68 context['danger'] = 'E-mail does not send'
69 69 return render(request, "remember_password.html",context)
70 70  
71   -@notification_decorator(message='just connected')
72 71 @log_decorator('Acessar', 'Sistema')
73 72 def login(request):
74 73 context = {}
... ... @@ -113,3 +112,10 @@ def getNotifications(request):
113 112  
114 113 html = render_to_string("notifications.html", context)
115 114 return HttpResponse(html)
  115 +
  116 +def guest (request):
  117 + context = {
  118 + 'courses': Course.objects.filter(public=True),
  119 + 'categories': CourseCategory.objects.all(),
  120 + }
  121 + return render(request, 'guest.html', context)
116 122 \ No newline at end of file
... ...
courses/locale/pt_BR/LC_MESSAGES/django.po
... ... @@ -30,11 +30,11 @@ msgstr &quot;&quot;
30 30  
31 31 #: courses/forms.py:26
32 32 msgid "Objectives"
33   -msgstr ""
  33 +msgstr "Objetivos"
34 34  
35 35 #: courses/forms.py:27 courses/models.py:23
36 36 msgid "Content"
37   -msgstr ""
  37 +msgstr "Conteúdo"
38 38  
39 39 #: courses/forms.py:28
40 40 msgid "Number of studets maximum"
... ... @@ -42,11 +42,11 @@ msgstr &quot;Número máximo de estudantes&quot;
42 42  
43 43 #: courses/forms.py:29
44 44 msgid "Course registration start date"
45   -msgstr ""
  45 +msgstr "Início das inscrições"
46 46  
47 47 #: courses/forms.py:30
48 48 msgid "Course registration end date"
49   -msgstr ""
  49 +msgstr "Fim da Inscrições"
50 50  
51 51 #: courses/forms.py:31
52 52 msgid "Course start date"
... ... @@ -66,59 +66,59 @@ msgstr &quot;Categoria&quot;
66 66  
67 67 #: courses/forms.py:37
68 68 msgid "Course name"
69   -msgstr ""
  69 +msgstr "Nome do Curso"
70 70  
71 71 #: courses/forms.py:38
72 72 msgid "Course objective"
73   -msgstr ""
  73 +msgstr "Objetivo do Curso"
74 74  
75 75 #: courses/forms.py:39
76 76 msgid "Course modules"
77   -msgstr ""
  77 +msgstr "Ḿódulos do curso"
78 78  
79 79 #: courses/forms.py:40
80 80 msgid "Max number of students that a class can have"
81   -msgstr ""
  81 +msgstr "Número máximo de estudantes que uma classe pode ter"
82 82  
83 83 #: courses/forms.py:41
84 84 msgid "Date that starts the registration period of the course (dd/mm/yyyy)"
85   -msgstr ""
  85 +msgstr "Data do começo do período de inscrição do curso (dia/mês/ano)"
86 86  
87 87 #: courses/forms.py:42
88 88 msgid "Date that ends the registration period of the course (dd/mm/yyyy)"
89   -msgstr ""
  89 +msgstr "Data do termino do período de inscrição do curso (dia/mês/ano)"
90 90  
91 91 #: courses/forms.py:43
92 92 msgid "Date that the course starts (dd/mm/yyyy)"
93   -msgstr ""
  93 +msgstr "Data que o curso começa (dia/mês/ano)"
94 94  
95 95 #: courses/forms.py:44
96 96 msgid "Date that the course ends (dd/mm/yyyy)"
97   -msgstr ""
  97 +msgstr "Data que o curso termina (dia/mês/ano)"
98 98  
99 99 #: courses/forms.py:45
100 100 msgid "Representative image of the course"
101   -msgstr ""
  101 +msgstr "Imagem representativa do curso"
102 102  
103 103 #: courses/forms.py:46
104 104 msgid "Category which the course belongs"
105   -msgstr ""
  105 +msgstr "Categoria ao qual o curso pertence"
106 106  
107 107 #: courses/forms.py:59 courses/models.py:46
108 108 msgid "Description"
109   -msgstr ""
  109 +msgstr "Descrição"
110 110  
111 111 #: courses/forms.py:60
112 112 msgid "Is it visible?"
113   -msgstr ""
  113 +msgstr "Visível?"
114 114  
115 115 #: courses/forms.py:63
116 116 msgid "Module's name"
117   -msgstr ""
  117 +msgstr "nome do módulo"
118 118  
119 119 #: courses/forms.py:64
120 120 msgid "Modules's description"
121   -msgstr ""
  121 +msgstr "descrição do módulo"
122 122  
123 123 #: courses/forms.py:65
124 124 msgid "Is the module visible?"
... ... @@ -147,7 +147,7 @@ msgstr &quot;&quot;
147 147  
148 148 #: courses/models.py:24
149 149 msgid "Maximum Students"
150   -msgstr ""
  150 +msgstr "Quantidade máximo de estudantes"
151 151  
152 152 #: courses/models.py:26
153 153 msgid "Register Date (Begin)"
... ...
courses/migrations/0001_initial.py
1 1 # -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
  2 +# Generated by Django 1.10 on 2016-10-22 04:32
3 3 from __future__ import unicode_literals
4 4  
5 5 import autoslug.fields
  6 +from django.conf import settings
6 7 from django.db import migrations, models
7 8 import django.db.models.deletion
8 9 import s3direct.fields
... ... @@ -14,6 +15,7 @@ class Migration(migrations.Migration):
14 15  
15 16 dependencies = [
16 17 ('core', '0001_initial'),
  18 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
17 19 ]
18 20  
19 21 operations = [
... ... @@ -23,6 +25,7 @@ class Migration(migrations.Migration):
23 25 ('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 26 ('limit_date', models.DateField(verbose_name='Deliver Date')),
25 27 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  28 + ('students', models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
26 29 ],
27 30 bases=('core.resource',),
28 31 ),
... ... @@ -32,10 +35,11 @@ class Migration(migrations.Migration):
32 35 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
33 36 ('pdf', s3direct.fields.S3DirectField()),
34 37 ('name', models.CharField(max_length=100)),
  38 + ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')),
35 39 ],
36 40 options={
37   - 'verbose_name': 'Activity File',
38 41 'verbose_name_plural': 'Activitys Files',
  42 + 'verbose_name': 'Activity File',
39 43 },
40 44 ),
41 45 migrations.CreateModel(
... ... @@ -47,8 +51,8 @@ class Migration(migrations.Migration):
47 51 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')),
48 52 ],
49 53 options={
50   - 'verbose_name': 'Category',
51 54 'verbose_name_plural': 'Categories',
  55 + 'verbose_name': 'Category',
52 56 },
53 57 ),
54 58 migrations.CreateModel(
... ... @@ -66,11 +70,12 @@ class Migration(migrations.Migration):
66 70 ('init_date', models.DateField(verbose_name='Begin of Course Date')),
67 71 ('end_date', models.DateField(verbose_name='End of Course Date')),
68 72 ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')),
  73 + ('public', models.BooleanField(verbose_name='Public')),
69 74 ],
70 75 options={
71   - 'ordering': ('create_date', 'name'),
72   - 'verbose_name': 'Course',
73 76 'verbose_name_plural': 'Courses',
  77 + 'verbose_name': 'Course',
  78 + 'ordering': ('create_date', 'name'),
74 79 },
75 80 ),
76 81 migrations.CreateModel(
... ... @@ -82,8 +87,8 @@ class Migration(migrations.Migration):
82 87 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')),
83 88 ],
84 89 options={
85   - 'verbose_name': 'Category',
86 90 'verbose_name_plural': 'Categories',
  91 + 'verbose_name': 'Category',
87 92 },
88 93 ),
89 94 migrations.CreateModel(
... ... @@ -108,6 +113,7 @@ class Migration(migrations.Migration):
108 113 fields=[
109 114 ('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')),
110 115 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  116 + ('students', models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
111 117 ],
112 118 bases=('core.resource',),
113 119 ),
... ... @@ -123,11 +129,15 @@ class Migration(migrations.Migration):
123 129 ('end_date', models.DateField(verbose_name='End of Subject Date')),
124 130 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
125 131 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')),
  132 + ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category')),
  133 + ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')),
  134 + ('professors', models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')),
  135 + ('students', models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
126 136 ],
127 137 options={
128   - 'ordering': ('create_date', 'name'),
129   - 'verbose_name': 'Subject',
130 138 'verbose_name_plural': 'Subjects',
  139 + 'verbose_name': 'Subject',
  140 + 'ordering': ('create_date', 'name'),
131 141 },
132 142 ),
133 143 migrations.CreateModel(
... ... @@ -137,10 +147,11 @@ class Migration(migrations.Migration):
137 147 ('name', models.CharField(max_length=100, verbose_name='Name')),
138 148 ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')),
139 149 ('description', models.TextField(blank=True, verbose_name='Description')),
  150 + ('subjects', models.ManyToManyField(to='courses.Subject')),
140 151 ],
141 152 options={
142   - 'verbose_name': 'subject category',
143 153 'verbose_name_plural': 'subject categories',
  154 + 'verbose_name': 'subject category',
144 155 },
145 156 ),
146 157 migrations.CreateModel(
... ... @@ -153,11 +164,48 @@ class Migration(migrations.Migration):
153 164 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
154 165 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')),
155 166 ('visible', models.BooleanField(default=False, verbose_name='Visible')),
  167 + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
  168 + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')),
156 169 ],
157 170 options={
158   - 'ordering': ('create_date', 'name'),
159   - 'verbose_name': 'Topic',
160 171 'verbose_name_plural': 'Topics',
  172 + 'verbose_name': 'Topic',
  173 + 'ordering': ('create_date', 'name'),
161 174 },
162 175 ),
  176 + migrations.AddField(
  177 + model_name='material',
  178 + name='topic',
  179 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),
  180 + ),
  181 + migrations.AddField(
  182 + model_name='linkmaterial',
  183 + name='material',
  184 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'),
  185 + ),
  186 + migrations.AddField(
  187 + model_name='filematerial',
  188 + name='material',
  189 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'),
  190 + ),
  191 + migrations.AddField(
  192 + model_name='course',
  193 + name='category',
  194 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'),
  195 + ),
  196 + migrations.AddField(
  197 + model_name='course',
  198 + name='professors',
  199 + field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),
  200 + ),
  201 + migrations.AddField(
  202 + model_name='course',
  203 + name='students',
  204 + field=models.ManyToManyField(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),
  205 + ),
  206 + migrations.AddField(
  207 + model_name='activity',
  208 + name='topic',
  209 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),
  210 + ),
163 211 ]
... ...
courses/migrations/0002_auto_20161018_1842.py
... ... @@ -1,105 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
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='category',
38   - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category'),
39   - ),
40   - migrations.AddField(
41   - model_name='subject',
42   - name='course',
43   - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course'),
44   - ),
45   - migrations.AddField(
46   - model_name='subject',
47   - name='professors',
48   - field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),
49   - ),
50   - migrations.AddField(
51   - model_name='subject',
52   - name='students',
53   - field=models.ManyToManyField(related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),
54   - ),
55   - migrations.AddField(
56   - model_name='material',
57   - name='students',
58   - field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'),
59   - ),
60   - migrations.AddField(
61   - model_name='material',
62   - name='topic',
63   - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),
64   - ),
65   - migrations.AddField(
66   - model_name='linkmaterial',
67   - name='material',
68   - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'),
69   - ),
70   - migrations.AddField(
71   - model_name='filematerial',
72   - name='material',
73   - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'),
74   - ),
75   - migrations.AddField(
76   - model_name='course',
77   - name='category',
78   - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'),
79   - ),
80   - migrations.AddField(
81   - model_name='course',
82   - name='professors',
83   - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),
84   - ),
85   - migrations.AddField(
86   - model_name='course',
87   - name='students',
88   - field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),
89   - ),
90   - migrations.AddField(
91   - model_name='activityfile',
92   - name='diet',
93   - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'),
94   - ),
95   - migrations.AddField(
96   - model_name='activity',
97   - name='students',
98   - field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'),
99   - ),
100   - migrations.AddField(
101   - model_name='activity',
102   - name='topic',
103   - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),
104   - ),
105   - ]
courses/models.py
1 1 from django.utils.translation import ugettext_lazy as _
2 2 from django.db import models
  3 +import datetime
3 4 from autoslug.fields import AutoSlugField
4 5 from users.models import User
5 6 from core.models import Resource, MimeType
6 7 from s3direct.fields import S3DirectField
7 8  
  9 +from django.core.urlresolvers import reverse
  10 +from core.models import Resource
  11 +
8 12 class CourseCategory(models.Model):
9 13  
10 14 name = models.CharField(_('Name'), max_length = 100, unique = True)
... ... @@ -45,7 +49,8 @@ class Course(models.Model):
45 49 image = models.ImageField(verbose_name = _('Image'), blank = True, upload_to = 'courses/')
46 50 category = models.ForeignKey(CourseCategory, verbose_name = _('Category'), related_name='course_category')
47 51 professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='courses_professors')
48   - students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='courses_student')
  52 + students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='courses_student', blank = True)
  53 + public = models.BooleanField(_('Public'))
49 54  
50 55 class Meta:
51 56 ordering = ('create_date','name')
... ... @@ -55,6 +60,14 @@ class Course(models.Model):
55 60 def __str__(self):
56 61 return self.name
57 62  
  63 + def get_absolute_url (self):
  64 + return reverse('course:view', kwargs={'slug': self.slug})
  65 +
  66 + def show_subscribe(self):
  67 + today = datetime.date.today()
  68 +
  69 + return today >= self.init_register_date and today <= self.end_register_date
  70 +
58 71 class Subject(models.Model):
59 72  
60 73 name = models.CharField(_('Name'), max_length = 100)
... ... @@ -68,8 +81,7 @@ class Subject(models.Model):
68 81 course = models.ForeignKey(Course, verbose_name = _('Course'), related_name="subjects")
69 82 category = models.ForeignKey(CategorySubject, verbose_name = _('Category'), related_name='subject_category',null=True)
70 83 professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='professors_subjects')
71   - students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student')
72   -
  84 + students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student', blank = True)
73 85  
74 86 class Meta:
75 87 ordering = ('create_date','name')
... ... @@ -79,6 +91,11 @@ class Subject(models.Model):
79 91 def __str__(self):
80 92 return self.name
81 93  
  94 + def show_subscribe(self):
  95 + today = datetime.date.today()
  96 +
  97 + return today < self.init_date
  98 +
82 99 class Topic(models.Model):
83 100  
84 101 name = models.CharField(_('Name'), max_length = 100)
... ...
courses/static/js/course.js
... ... @@ -0,0 +1,22 @@
  1 +/*
  2 +*
  3 +* Function to subscribe (works for courses and subjects)
  4 +*
  5 +*/
  6 +function subscribe(elem, url, id, confirm_message) {
  7 + alertify.confirm(confirm_message, function(){
  8 + $.ajax({
  9 + dataType: "json",
  10 + url: url,
  11 + success: function (data) {
  12 + if (data.status == "ok") {
  13 + elem.remove();
  14 + alertify.success(data.message);
  15 + $(".panel_"+id).find(".view_btn").show()
  16 + } else {
  17 + alertify.error(data.message);
  18 + }
  19 + }
  20 + });
  21 + });
  22 +}
0 23 \ No newline at end of file
... ...
courses/static/js/modal_category.js 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +
  2 +var Submite = {
  3 + remove: function(url,dados,id_li_link){
  4 + $('#category').modal('hide');
  5 + $.post(url,dados, function(data){
  6 + $(id_li_link).remove();
  7 + $("#modal_category").empty();
  8 + $("div.modal-backdrop.fade.in").remove();
  9 + alertify.success("Category removed successfully!");
  10 + }).fail(function(){
  11 + $("#modal_category").empty();
  12 + $("#modal_category").append(data);
  13 + $('#category').modal('show');
  14 + });
  15 + }
  16 +}
  17 +
  18 +var modal = {
  19 + get: function (url, id_modal, id_div_modal){
  20 + $.get(url, function(data){
  21 + if($(id_modal).length){
  22 + $(id_div_modal).empty();
  23 + $(id_div_modal).append(data);
  24 + } else {
  25 + $(id_div_modal).append(data);
  26 + }
  27 + $(id_modal).modal('show');
  28 + });
  29 + }
  30 +};
0 31 \ No newline at end of file
... ...
courses/templates/category/create.html
... ... @@ -74,7 +74,7 @@
74 74 {% endif %}
75 75 {% endfor %}
76 76 <div class="row text-center">
77   - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" />
  77 + <button type="submit" class="btn btn-primary btn-raised">{% trans "Save" %}</button>
78 78 </div>
79 79 </form>
80 80 </div>
... ...
courses/templates/category/delete.html
1   -{% extends 'base.html' %}
2   -
3   -{% load static i18n %}
4 1 {% load static i18n permission_tags %}
5 2  
6   -{% block breadcrumbs %}
7   - <ol class="breadcrumb">
8   - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li>
9   - <li class="active">{% trans 'Manage Categories' %}</li>
10   - </ol>
11   -{% endblock %}
  3 +<!-- Modal (remember to change the ids!!!) -->
  4 +<div class="modal fade" id="category" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  5 + <div class="modal-dialog" role="document">
  6 + <div class="modal-content">
  7 + <!-- Modal Header -->
  8 + <div class="modal-header">
12 9  
13   -{% block sidebar %}
14   - <div class="panel panel-primary navigation">
15   - <div class="panel-heading">
16   - <h5>{% trans 'Menu' %}</h5>
17   - </div>
18   - <div class="panel-body">
19   - <ul class="nav nav-pills nav-stacked">
20   - <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
21   - <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
22   - </ul>
23   - </div>
  10 + <h4 class="modal-title" id="myModalLabel">{% trans "Delete Category" %}</h4>
  11 + </div>
  12 + <!-- Modal Body -->
  13 + <div class="modal-body">
  14 + <!-- Put ONLY your content here!!! -->
  15 + <form id="delete_form" action="" method="post">
  16 + {% csrf_token %}
  17 + <p>{% trans 'Are you sure you want to delete the subject' %} "{{category.name}}"?</p>
  18 + </form>
  19 + </div>
  20 + <!-- Modal Footer -->
  21 + <div class="modal-footer">
  22 + <!-- Don't remove that!!! -->
  23 + <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
  24 + <button type="submit" id="button" form="delete_form" class="btn btn-primary btn-raised">{% trans "Delete" %}</button>
  25 + <script>
  26 + $("#delete_form").submit(function(event) {
  27 + Submite.remove("{% url 'course:delete_cat' category.slug %}",$(this).serialize(),"#category_{{category.slug}}");
  28 + event.preventDefault();
  29 + });
  30 + </script>
  31 + </div>
24 32 </div>
25   -
26   -{% if user|has_role:'professor' or user|has_role:'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="{% url 'course:create' %}">Create Course</a></li>
36   - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>
37   - </ul>
38   - </div>
39   - </div>
40   - <div class="panel panel-primary navigation">
41   - <div class="panel-heading">
42   - <h3 class="panel-title">Category</h3>
43   - </div>
44   - <div class="panel-body">
45   - <ul class="nav nav-pills nav-stacked">
46   - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>
47   - <li><a href="{% url 'course:manage_cat' %}">List Category</a></li>
48   - </ul>
49   - </div>
50   - </div>
51   -{% endif %}
52   -{% endblock %}
53   -
54   -{% block content %}
55   - <div class="card card-content">
56   - <div class="card-body">
57   - <form action="" method="post">{% csrf_token %}
58   - <h1>{% trans 'Are you sure you want to delete the category' %} "{{ object }}"?</h1>
59   - <input type="submit" class="btn btn-success btn-sm" value="{% trans 'Yes' %}" />
60   - <a href="{% url 'course:manage_cat' %}" class="btn btn-danger btn-sm">{% trans 'No' %}</a>
61   - </form>
62   - </div>
63   - </div>
64   -{% endblock %}
  33 + </div>
  34 +</div>
  35 +<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  36 +<script src="{% static 'js/modal_category.js' %}"></script>
... ...
courses/templates/category/index.html
... ... @@ -82,7 +82,8 @@
82 82 <td class="text-center">
83 83 <a href="{% url 'course:view_cat' category.slug %}" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-eye-open"></span></a>
84 84 <a href="{% url 'course:update_cat' category.slug %}" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-edit"></span></a>
85   - <a href="{% url 'course:delete_cat' category.slug %}" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span></a>
  85 + <a href="javascript:modal.get('{% url 'course:delete_cat' category.slug %}','#category','#modal_category');" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span></a>
  86 +
86 87 </td>
87 88 </tr>
88 89 {% endfor %}
... ... @@ -96,4 +97,6 @@
96 97 </tbody>
97 98 </table>
98 99 </div>
99   -{% endblock %}
  100 + <div class="row" id="modal_category">
  101 +<script src="{% static 'js/modal_category.js' %}"></script>
  102 +{% endblock %}
100 103 \ No newline at end of file
... ...
courses/templates/category/update.html
... ... @@ -87,7 +87,7 @@
87 87 {% endif %}
88 88 {% endfor %}
89 89 <div class="row text-center">
90   - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" />
  90 + <button type="submit" class="btn btn-primary btn-raised">{% trans "Save" %}</button>
91 91 </div>
92 92 </form>
93 93 </div>
... ...
courses/templates/course/course_card.html 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +{% load static i18n permission_tags %}
  2 +{% load django_bootstrap_breadcrumbs %}
  3 +
  4 +<div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false">
  5 + <div class="group">
  6 + <div class="panel panel-info">
  7 + <div class="panel-heading" role="tab">
  8 + <div class="row">
  9 + <div class="col-xs-9 col-md-10 titleTopic">
  10 + <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="collapsed">
  11 + <h4 style="color:white">{{course.name}}</h4>
  12 + </a>
  13 + </div>
  14 + {% if user|has_role:'professor' or user|has_role:'system_admin' %}
  15 + <div class="col-xs-4 col-md-2" id="divMoreActions">
  16 + <div class="btn-group">
  17 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  18 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  19 + </button>
  20 + <ul class="dropdown-menu" aria-labelledby="moreActions">
  21 + <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>
  22 + <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>
  23 + </ul>
  24 + </div>
  25 + </div>
  26 + {% endif %}
  27 + </div>
  28 + </div>
  29 + <div class="panel-collapse collapseOne collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">
  30 + <div class="panel-body">
  31 + <p><b>Course Name: </b>{{course.name}}</p>
  32 + <p><b>Coordinator: </b>{{course.professors.all.0}}</p>
  33 + <p>
  34 + <b>Description:</b>
  35 + <i>
  36 + {{course.description}}
  37 + </i>
  38 + </p>
  39 + <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Course' %}<div class="ripple-container"></div></a>
  40 + </div>
  41 + </div>
  42 + </div>
  43 + </div>
  44 + </div>
0 45 \ No newline at end of file
... ...
courses/templates/course/index.html
... ... @@ -11,47 +11,36 @@
11 11 {% endblock %}
12 12  
13 13 {% block sidebar %}
14   - <div class="panel panel-primary navigation">
  14 + <div class="panel panel-primary navigation">
15 15 <div class="panel-heading">
16   - <h5>{% trans 'Menu' %}</h5>
  16 + <h4>Menu</h4>
17 17 </div>
18 18 <div class="panel-body">
19 19 <ul class="nav nav-pills nav-stacked">
20   - <li><a href="{% url 'core:home' %}">{% trans 'Home' %}</a></li>
  20 + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li>
21 21 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
22   - <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
  22 + {% if user|has_role:'student' or not user.is_staff %}
  23 + <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
  24 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
  25 + {% endif %}
  26 + {% if user|has_role:'system_admin' %}
  27 + <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
  28 + {% endif %}
  29 + {% if user|has_role:'system_admin' or user|has_role:'professor' %}
  30 + <li>
  31 + <a href="#courses_list" class="accordion" data-toggle="collapse">{% trans 'Manage Courses' %}</a>
  32 + <div id="courses_list" class="collapse">
  33 + <ul class="nav nav-pill nav-stacked accordion_list">
  34 + {% for course in courses_list %}
  35 + <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li>
  36 + {% endfor %}
  37 + </ul>
  38 + </div>
  39 + </li>
  40 + {% endif %}
23 41 </ul>
24 42 </div>
25 43 </div>
26   -
27   -{% if user|has_role:'professor' or user|has_role:'system_admin' %}
28   -
29   - <div class="panel panel-primary navigation">
30   - <div class="panel-heading">
31   - <h3 class="panel-title">Actions</h3>
32   - </div>
33   - <div class="panel-body">
34   - <ul class="nav nav-pills nav-stacked">
35   - <li><a href="javascript:void(0)">Replicate Course</a></li>
36   - <li><a href="{% url 'course:create' %}">Create Course</a></li>
37   - </ul>
38   - </div>
39   - </div>
40   -
41   - <div class="panel panel-primary navigation">
42   - <div class="panel-heading">
43   - <h3 class="panel-title">Category</h3>
44   - </div>
45   - <div class="panel-body">
46   - <ul class="nav nav-pills nav-stacked">
47   - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>
48   - <li><a href="{% url 'course:manage_cat' %}">List Category</a></li>
49   - </ul>
50   - </div>
51   - </div>
52   -
53   -{% endif %}
54   -
55 44 {% endblock %}
56 45  
57 46 {% block content %}
... ... @@ -79,62 +68,14 @@
79 68 </div>
80 69 </form>
81 70 </div>
82   - <div class="col-md-12">
83   - <div class="btn-group btn-group-justified btn-group-raised">
84   - <a href="?category=all" class="btn btn-raised btn-info">Todos</a>
85   - {% for category_course in categorys_courses %}
86   - <a href="?category={{category_course.name}}" class="btn btn-raised btn-primary">{{category_course.name}}</a>
87   - {% endfor %}
88   - </div>
89   - </div>
  71 +
90 72  
91 73 </fieldset>
92 74 <div class="col-md-12">
93 75 {% if courses|length > 0 %}
94 76 {% if request.GET.category == 'all' or none or request.GET.category == '' %}
95 77 {% for course in list_courses %}
96   - <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false">
97   - <div class="group">
98   - <div class="panel panel-info">
99   - <div class="panel-heading" role="tab">
100   - <div class="row">
101   - <div class="col-xs-9 col-md-9 titleTopic">
102   - <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="collapsed">
103   - <h4 style="color:white">{{course.name}}</h4>
104   - </a>
105   - </div>
106   - {% if user|has_role:'professor' or user|has_role:'system_admin' %}
107   - <div class="col-xs-4 col-md-3" id="divMoreActions">
108   - <div class="btn-group">
109   - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
110   - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
111   - </button>
112   - <ul class="dropdown-menu" aria-labelledby="moreActions">
113   - <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>
114   - <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>
115   - </ul>
116   - </div>
117   - </div>
118   - {% endif %}
119   - </div>
120   - </div>
121   - <div class="panel-collapse collapseOne collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">
122   - <div class="panel-body">
123   - <p><b>Course Name: </b>{{course.name}}</p>
124   - <p><b>Duration (in semesters): </b>09</p>
125   - <p><b>Coordinator: </b>{{course.professors}}</p>
126   - <p>
127   - <b>Description:</b>
128   - <i>
129   - {{course.description}}
130   - </i>
131   - </p>
132   - <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Course' %}<div class="ripple-container"></div></a>
133   - </div>
134   - </div>
135   - </div>
136   - </div>
137   - </div>
  78 + {% include "course/course_card.html" %}
138 79 {% endfor %}
139 80 {% else %}
140 81 {% for course in courses_category %}
... ...
courses/templates/course/view.html
1 1 {% extends 'home.html' %}
2 2  
3   -{% load static i18n permission_tags %}
  3 +{% load static i18n permission_tags custom_filters %}
4 4 {% load django_bootstrap_breadcrumbs %}
5 5  
6 6 {% block style %}
7 7 <link rel="stylesheet" href="{% static 'css/course/course.css' %}">
8 8 {% endblock style %}
9 9  
  10 +{% block javascript %}
  11 + <script type="text/javascript" src="{% static 'js/course.js' %}"></script>
  12 +{% endblock %}
  13 +
10 14 {% block breadcrumbs %}
11 15  
12 16 {{ block.super }}
... ... @@ -24,22 +28,23 @@
24 28 <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li>
25 29 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
26 30 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
  31 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
27 32 </ul>
28 33 </div>
29 34 </div>
30 35  
31   -{% if user|has_role:'professor' or user|has_role:'system_admin' %}
  36 +{% if user|has_role:'professor' and user in course.professors or user|has_role:'system_admin' %}
32 37  
33 38 <div class="panel panel-primary navigation">
34 39 <div class="panel-heading">
35   - <h3 class="panel-title">Actions</h3>
  40 + <h3 class="panel-title">{% trans "Actions" %}</h3>
36 41 </div>
37 42 <div class="panel-body">
38 43 <ul class="nav nav-pills nav-stacked">
39   - <li><a href="teacher/course_participants_teacher.html" target="_self">Participants</a></li>
40   - <li><a href="javascript:void(0)">Replicate Subject</a></li>
41   - <li><a href="javascript:void(0)">Create Subject</a></li>
42   - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal">Create Topic</a></li>
  44 + <li><a href="teacher/course_participants_teacher.html" target="_self"> {% trans "Participants" %}</a></li>
  45 + <li><a href="javascript:void(0)">{% trans "Replicate Subject" %}</a></li>
  46 + <li><a href="javascript:void(0)">{% trans "Create Subject" %}</a></li>
  47 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal">{% trans "Create Topic" %}</a></li>
43 48 </ul>
44 49 </div>
45 50 </div>
... ... @@ -56,17 +61,17 @@
56 61 <div class="col-xs-8 col-md-10 titleTopic">
57 62 <h4>{{course}}</h4>
58 63 </div>
59   - {% if user|has_role:'professor' or user|has_role:'system_admin' %}
  64 + {% if user|has_role:'professor' and user in course.professors or user|has_role:'system_admin' %}
60 65 <div class="col-xs-4 col-md-2" id="divMoreActions">
61 66 <div class="btn-group">
62 67 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
63 68 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
64 69 <div class="ripple-container"></div></button>
65 70 <ul class="dropdown-menu" aria-labelledby="moreActions">
66   - <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>
67   - <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>
68   - <li><a href="{% url 'course:update' course.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; Edit</a></li>
69   - <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>
  71 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#createSubject"><i class="fa fa-plus-square-o" aria-hidden="true"></i>&nbsp; {% trans "Create Subject" %}</a></li>
  72 + <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; {% trans "Replicate" %}</a></li>
  73 + <li><a href="{% url 'course:update' course.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Edit" %}</a></li>
  74 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Remove" %}</a></li>
70 75 </ul>
71 76 </div>
72 77 </div>
... ... @@ -75,7 +80,6 @@
75 80 </div>
76 81 <div class="panel-body">
77 82 <p><b>Course Name: </b>{{course.name}}</p>
78   - <p><b>Duration (in semesters): </b>09</p>
79 83 <p><b>Coordinator: </b>{{course.professors}}</p>
80 84 <p>
81 85 <b>Description:</b>
... ... @@ -86,75 +90,20 @@
86 90  
87 91 </div>
88 92 </div>
89   - <div class="btn-group btn-group-justified btn-group-raised">
90   - <a href="?category=all" class="btn btn-raised btn-info">Todos</a>
91   - {% for category_subject in categorys_subjects %}
92   - <a href="?category={{category_subject.name}}" class="btn btn-raised btn-primary">{{category_subject.name}}</a>
93   - {% endfor %}
94   - </div>
  93 +
95 94 <!-- MODAL CREATE SUBJECT -->
96 95 <div class="modal" tabindex="-1" role="dialog " id="createSubject">
97 96 <div class="modal-dialog">
98 97 <div class="modal-content">
99 98 <div class="modal-header">
100   - <h4 class="modal-title">Create a New Subject</h4>
  99 + <h4 class="modal-title">{% trans "Create a New Subject" %}</h4>
101 100 </div>
102 101 <div class="modal-body">
103 102 <div>
104   - <!--<form class="form-horizontal">
105   - <div class="form-group is-empty">
106   - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Name</label>
107   - <div class="col-md-8 col-xs-8">
108   - <input type="text" class="form-control" name="nameSubject">
109   - </div>
110   - </div>
111   - <div class="form-group is-empty">
112   - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Description</label>
113   - <div class="col-md-8 col-xs-8">
114   - <textarea class="form-control" rows="3" id="textAreaSubject"></textarea>
115   - <span class="help-block">Sign the description of the course.</span>
116   - </div>
117   - </div>
118   - <div class="form-group is-empty">
119   - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Goals</label>
120   - <div class="col-md-8 col-xs-8">
121   - <textarea class="form-control" rows="3" id="textAreaSubject"></textarea>
122   - <span class="help-block">Sign the objectives of the course until the end of the course.</span>
123   - </div>
124   - </div>
125   - <div class="form-group is-empty">
126   - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Students Limit</label>
127   - <div class="col-md-8 col-xs-8">
128   - <input type="number" class="form-control" name="StudentLimit">
129   - </div>
130   - </div>
131   - <div class="row">
132   - <div class="col-md-6 col-xs-12">
133   - <div class="row">
134   - <div class="form-group is-empty">
135   - <label class="control-label col-md-4 col-xs-4 col-xs-offset-1">Begining</label>
136   - <div class="col-md-8 col-xs-6">
137   - <input type="date" class="form-control" name="BeginDate">
138   - </div>
139   - </div>
140   - </div>
141   - </div>
142   - <div class="col-md-6 col-xs-12">
143   - <div class="row">
144   - <div class="form-group is-empty">
145   - <label class="control-label col-md-4 col-xs-4 col-xs-offset-1">End</label>
146   - <div class="col-md-8 col-xs-6">
147   - <input type="date" class="form-control" name="EndDate">
148   - </div>
149   - </div>
150   - </div>
151   - </div>
152   - </div>
153   - </form>-->
154 103 </div>
155 104 <div class="modal-footer">
156   - <button type="button" data-dismiss="modal" class="btn btn-default">Cancel</button>
157   - <a href="#" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
  105 + <button type="button" data-dismiss="modal" class="btn btn-default">{% trans "Cancel" %}</button>
  106 + <a href="#" target="_self"><button type="button" class="btn btn-primary"> {% trans "Confirm" %}</button></a>
158 107 </div>
159 108 </div>
160 109 </div>
... ... @@ -177,11 +126,11 @@
177 126 <h4 class="modal-title"></h4>
178 127 </div>
179 128 <div class="modal-body">
180   - <p>Are you sure you want to remove this subject?</p>
  129 + <p>{% trans "Are you sure you want to remove this subject?" %}</p>
181 130 </div>
182 131 <div class="modal-footer">
183 132  
184   - <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>
  133 + <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">{% trans "Confirm" %}</button></a>
185 134  
186 135 </div>
187 136 </div>
... ... @@ -191,7 +140,7 @@
191 140 <div>
192 141 {% if request.GET.category == 'all' or none or request.GET.category == '' %}
193 142 {% for subject in subjects %}
194   - <div class="panel panel-info">
  143 + <div class="panel panel-info panel_{{ subject.id }}">
195 144 <div class="panel-heading headingTwo ui-sortable-handle" role="tab">
196 145 <div class="row">
197 146 <div class="col-xs-9 col-md-10 titleTopic">
... ... @@ -199,17 +148,25 @@
199 148 <h4 style="color:white">{{subject.name}}</h4>
200 149 </a>
201 150 </div>
202   - <div class="col-xs-3 col-md-2" id="divMoreActions">
203   - <div class="btn-group">
204   - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
205   - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
206   - </button>
207   - <ul class="dropdown-menu" aria-labelledby="moreActions">
208   - <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>
209   - <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>
210   - </ul>
  151 + {% if user|has_role:'professor' and user in subject.professors or user|has_role:'system_admin' %}
  152 + <div class="col-xs-3 col-md-2" id="divMoreActions">
  153 + <div class="btn-group">
  154 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  155 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  156 + </button>
  157 + <ul class="dropdown-menu" aria-labelledby="moreActions">
  158 + <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>
  159 + <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>
  160 + </ul>
  161 + </div>
211 162 </div>
212   - </div>
  163 + {% endif %}
  164 +
  165 + {% if user|show_subject_subscribe:subject %}
  166 + <div class="col-xs-3 col-md-2">
  167 + <a onclick="subscribe($(this), '{% url 'course:subscribe_subject' subject.slug %}', {{ subject.id }}, '{% trans 'Are you sure you want to subscribe to this subject?' %}')" class="btn btn-sm btn-primary btn-raised">{% trans 'Subscribe' %}</a>
  168 + </div>
  169 + {% endif %}
213 170 </div>
214 171 </div>
215 172 <div class="panel-body">
... ... @@ -229,14 +186,14 @@
229 186 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>
230 187 </div>
231 188 </div>
232   - <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a>
  189 + <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block view_btn" {% if user|show_subject_subscribe:subject %}style="display:none"{% endif %}>{% trans 'View Subject' %}<div class="ripple-container"></div></a>
233 190 </div>
234 191 </div>
235 192 {% endfor %}
236 193 {% else %}
237 194 {% for subject in subjects_category %}
238 195 {% if subject.category.name == request.GET.category %}
239   - <div class="panel panel-info">
  196 + <div class="panel panel-info panel_{{ subject.id }}">
240 197 <div class="panel-heading headingTwo ui-sortable-handle" role="tab">
241 198 <div class="row">
242 199 <div class="col-xs-9 col-md-10 titleTopic">
... ... @@ -244,17 +201,24 @@
244 201 <h4 style="color:white">{{subject.name}}</h4>
245 202 </a>
246 203 </div>
247   - <div class="col-xs-3 col-md-2" id="divMoreActions">
248   - <div class="btn-group">
249   - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
250   - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
251   - </button>
252   - <ul class="dropdown-menu" aria-labelledby="moreActions">
253   - <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>
254   - <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>
255   - </ul>
  204 + {% if user|has_role:'professor' and user in subject.professors or user|has_role:'system_admin' %}
  205 + <div class="col-xs-3 col-md-2" id="divMoreActions">
  206 + <div class="btn-group">
  207 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  208 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  209 + </button>
  210 + <ul class="dropdown-menu" aria-labelledby="moreActions">
  211 + <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>
  212 + <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>
  213 + </ul>
  214 + </div>
256 215 </div>
257   - </div>
  216 + {% endif %}
  217 + {% if user|show_subject_subscribe:subject %}
  218 + <div class="col-xs-3 col-md-2">
  219 + <a onclick="subscribe($(this), '{% url 'course:subscribe_subject' subject.slug %}', {{ subject.id }}, '{% trans 'Are you sure you want to subscribe to this subject?' %}')" class="btn btn-sm btn-primary btn-raised">{% trans 'Subscribe' %}</a>
  220 + </div>
  221 + {% endif %}
258 222 </div>
259 223 </div>
260 224 <div class="panel-body">
... ... @@ -274,14 +238,14 @@
274 238 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>
275 239 </div>
276 240 </div>
277   - <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a>
  241 + <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block view_btn" {% if user|show_subject_subscribe:subject %}style="display:none"{% endif %}>{% trans 'View Subject' %}<div class="ripple-container"></div></a>
278 242 </div>
279 243 </div>
280 244 {% endif %}
281 245 {% endfor %}
282 246 {% endif %}
283 247  
284   -{% if user|has_role:'professor' or user|has_role:'system_admin' %}
  248 +{% if user|has_role:'professor' and user in course.professors.all or user|has_role:'system_admin' %}
285 249  
286 250 <div class="form-group">
287 251 <a href="{% url 'course:create_subject' course.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised">{% trans 'Create Subject' %}<div class="ripple-container"></div></a>
... ... @@ -297,11 +261,11 @@
297 261 <h4 class="modal-title"></h4>
298 262 </div>
299 263 <div class="modal-body">
300   - <p>Are you sure you want to remove this subject?</p>
  264 + <p> {% trans "Are you sure you want to remove this subject?" %}</p>
301 265 </div>
302 266 <div class="modal-footer">
303 267  
304   - <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>
  268 + <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">{% trans "Confirm" %}</button></a>
305 269  
306 270 </div>
307 271 </div>
... ...
courses/templates/subject/form_view_teacher.html
... ... @@ -4,7 +4,7 @@
4 4 <script type="text/javascript" src="{% static 'js/forum.js' %}"></script>
5 5 <script src="{% static 'js/file.js' %}"></script>
6 6 <script type="text/javascript" src="{% static 'js/material.js' %}"></script>
7   - <script type = "text/javascript" src="{% static 'link.js' %}"></script>
  7 + <script type = "text/javascript" src="{% static 'links.js' %}"></script>
8 8 {% endblock %}
9 9  
10 10 <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false">
... ... @@ -55,7 +55,7 @@
55 55 <div class="dropdown">
56 56 <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
57 57 <ul class="dropdown-menu" aria-labelledby="dLabel">
58   - <li><a href=" javascript:get_modal_link('{% url 'course:links:create_link' %}', '#createLinksModal','#divModalLink') ">Create a Link<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 54.5312px; top: 22px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li>
  58 + <li><a href=" javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">Create a Link<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 54.5312px; top: 22px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li>
59 59 <li>
60 60 <a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')">
61 61 {% trans "Create a file" %}
... ... @@ -68,7 +68,7 @@
68 68 </ul>
69 69 </div>
70 70 </div>
71   - <ul>
  71 + <ul id="list-materials">
72 72 {% list_topic_file request topic %}
73 73 {% list_topic_link request topic%}
74 74 <li><i class="fa fa-file-code-o" aria-hidden="true"></i> <a href="#" data-toggle="modal" data-target="#embedModal">EMBED Material</a></li>
... ... @@ -116,12 +116,20 @@
116 116 <div class="dropdown">
117 117 <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
118 118 <ul class="dropdown-menu" aria-labelledby="dLabel">
119   - <li><a href=" javascript:get_modal_link('{% url 'course:links:create_link' %}', '#createLinksModal','#divModalLink') ">Create a Link</a></li>
120   - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#fileModal">Create a file</a></li>
  119 + <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink')">Create a Link</a></li>
  120 + <li>
  121 + <a href="#">
  122 + {% trans "Create a file" %}
  123 + <div class="ripple-container">
  124 + <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);">
  125 + </div>
  126 + </div>
  127 + </a>
  128 + </li>
121 129 </ul>
122 130 </div>
123 131 </div>
124   - <ul>
  132 + <ul id="list-materials-edit">
125 133 {% list_topic_link_edit request topic%}
126 134 {% list_topic_file_edit request topic %}
127 135 </ul>
... ... @@ -170,7 +178,7 @@
170 178 </div>
171 179 <div class="modal-footer">
172 180  
173   - <a href="http://localhost:8080/html/screens/users/profile_user.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
  181 + <a href="" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
174 182  
175 183 </div>
176 184 </div>
... ...
courses/templates/subject/index.html
... ... @@ -36,12 +36,12 @@
36 36 <div class="panel panel-info">
37 37 <div class="panel-heading">
38 38 <div class="row">
39   - <div class="col-md-10 col-sm-9">
  39 + <div class="col-md-10 col-sm-10">
40 40 <h3>{{subject}}</h3>
41 41 </div>
42 42 {% professor_subject subject user as subject_professor%}
43 43 {% if subject_professor %}
44   - <div class="col-xs-4 col-md-3 divMoreActions">
  44 + <div class="col-xs-4 col-md-2 divMoreActions">
45 45 <div class="btn-group">
46 46 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
47 47 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
... ...
courses/templates/topic/index.html
... ... @@ -30,20 +30,24 @@
30 30 </ul>
31 31 </div>
32 32 </div>
33   - <div class="panel panel-primary navigation">
34   - <div class="panel-heading">
35   - <h3 class="panel-title">Actions</h3>
36   - </div>
37   - <div class="panel-body">
38   - <ul class="nav nav-pills nav-stacked">
39   - <li><a href="javascript:void(0)">Participants</a></li>
40   - <li><a href="javascript:void(0)">Replicate subject</a></li>
41   - <li><a href="javascript:void(0)">Create subject</a></li>
42   - <li><a href="javascript:void(0)">Edit subject</a></li>
43   - <li><a href="javascript:void(0)">Remove subject</a></li>
44   - </ul>
  33 +
  34 + {% if user|has_role:'professor' %}
  35 + <div class="panel panel-primary navigation">
  36 + <div class="panel-heading">
  37 + <h3 class="panel-title">Actions</h3>
  38 + </div>
  39 + <div class="panel-body">
  40 + <ul class="nav nav-pills nav-stacked">
  41 + <li><a href="javascript:void(0)">Participants</a></li>
  42 + <li><a href="javascript:void(0)">Replicate subject</a></li>
  43 + <li><a href="javascript:void(0)">Create subject</a></li>
  44 + <li><a href="javascript:void(0)">Edit subject</a></li>
  45 + <li><a href="javascript:void(0)">Remove subject</a></li>
  46 + </ul>
  47 + </div>
45 48 </div>
46   -</div>
  49 + {% endif %}
  50 +
47 51 {% endblock %}
48 52  
49 53 {% block content %}
... ... @@ -132,11 +136,8 @@
132 136 </div>
133 137 </fieldset>
134 138 </form>
135   -{% empty %}
136   - {% trans 'No activity found' %}
137   -{% endfor %}
138 139  
139   -<ul class="pagination pagination-sm">
  140 + <ul class="pagination pagination-sm">
140 141 <li class="disabled"><a href="javascript:void(0)">«</a></li>
141 142 <li class="active"><a href="javascript:void(0)">1</a></li>
142 143 <li><a href="javascript:void(0)">2</a></li>
... ... @@ -145,6 +146,11 @@
145 146 <li><a href="javascript:void(0)">5</a></li>
146 147 <li><a href="javascript:void(0)">»</a></li>
147 148 </ul>
  149 +{% empty %}
  150 + {% trans 'No activity found' %}
  151 +{% endfor %}
  152 +
  153 +
148 154  
149 155 </div>
150 156  
... ...
courses/templates/topic/link_topic_list.html
1 1 {% load static i18n list_topic_foruns permission_tags %}
  2 +<div id="list-topic{{ topic.id }}-links">
2 3 {% for link in links%}
3   - <li><i class="fa fa-link" aria-hidden="true"></i> <a href="#" data-toggle="modal" data-target="#linksModal{{slug}}{{ forloop.counter }}">{{link}}</a></li>
4   - <!--MODAL VIEW LINK-->
5   - <div class="modal fade" id="linksModal{{slug}}{{ forloop.counter}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
6   - <div class="modal-dialog" role="document">
7   - <div class="modal-content">
8   - <div class="modal-header">
9   - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
10   - <h4 class="modal-title" id="myModalLabel">Link</h4>
11   - </div>
12   - <div class="modal-body">
13   - <!-- Card -->
14   - <article class="card animated fadeInLeft">
15   - <div class="card-block">
16   - <b class="card-title">{{link.name}}</b><p></p>
17   - <p class="card-text"> </p><p>{{link.link_description}}</p>
18   - <a href="{{ link.link_url }}" class="btn btn-primary">Read more</a>
19   - </div>
20   - </article>
21   - <!-- .end Card -->
22   - </div>
23   - </div>
24   - </div>
25   - </div>
26   - <!-- EndModal -->
  4 + <li><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link}}</a></li>
27 5 {% endfor %}
  6 +</div>
  7 +<div class = 'row' id ="divModalLink">
  8 +
  9 +</div>
... ...
courses/templates/topic/link_topic_list_edit.html
1 1 {% load static i18n list_topic_foruns permission_tags %}
  2 +<div id="list-topic{{ topic.id }}-links-edit">
2 3 {% for link in links%}
  4 +
3 5 <li class="icon_edit_remove"> <a href="#" data-toggle="modal" data-target="#linksModalEdit"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="#" data-toggle="modal" data-target="#removeLink"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li>
4   - <li><i class="fa fa-link" aria-hidden="true"></i> <a href="#" data-toggle="modal" data-target="#linksModal{{slug}}{{ forloop.counter }}">{{link}}</a></li>
  6 + <li><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:get_modal_link('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link}}</a></li>
5 7  
6   - <!--MODAL VIEW LINK-->
7   - <div class="modal fade" id="linksModal{{slug}}{{ forloop.counter}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
8   - <div class="modal-dialog" role="document">
9   - <div class="modal-content">
10   - <div class="modal-header">
11   - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
12   - <h4 class="modal-title" id="myModalLabel">Link</h4>
13   - </div>
14   - <div class="modal-body">
15   - <!-- Card -->
16   - <article class="card animated fadeInLeft">
17   - <div class="card-block">
18   - <b class="card-title">{{link.name}}</b><p></p>
19   - <p class="card-text"> </p><p>{{link.link_description}}</p>
20   - <a href="{{ link.link_url }}" class="btn btn-primary">Read more</a>
21   - </div>
22   - </article>
23   - <!-- .end Card -->
24   - </div>
25   - </div>
26   - </div>
27   - </div>
28   - <!-- EndModal -->
29 8 {% endfor %}
30   - <div class = "row" id="divModalLink">
31   - </div>
  9 +</div>
... ...
courses/templates/topic/list_file_edit.html
1 1 {% load static i18n permission_tags%}
2 2  
3   -<div id="list-topic-files-edit">
  3 +<div id="list-topic{{ topic.id }}-files-edit">
4 4 {% for file in files %}
5   - <li class="icon_edit_remove" id="file_edit_{{ file.slug }}"> <a href="javascript:get_modal_file('{% url 'course:file:update_file' file.slug %}', '#fileUpdateModal', '#divModalFileUpdate')" ><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:get_modal_file('{% url 'course:file:delete_file' file.slug %}', '#fileDeleteModal', '#divModalFileUpdate')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li>
6   - <li id="file_edit_icon_{{ file.slug }}"><i class="material-icons">{{ file.file_type.icon }}</i> <a href="{{ file.file_url.url }}" target="_blank">{{ file.name }}</a></li>
  5 + <li class="icon_edit_remove" id="file_edit_icon_{{ file.slug }}"> <a href="javascript:get_modal_file('{% url 'course:file:update_file' file.slug %}', '#fileUpdateModal', '#divModalFileUpdate')" ><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:get_modal_file('{% url 'course:file:delete_file' file.slug %}', '#fileDeleteModal', '#divModalFileUpdate')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li>
  6 + <li id="file_edit_{{ file.slug }}"><i class="material-icons">{{ file.file_type.icon }}</i> <a href="{{ file.file_url.url }}" target="_blank">{{ file.name }}</a></li>
7 7 {% endfor %}
8 8 </div>
9 9  
... ...
courses/templatetags/custom_filters.py 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +from django import template
  2 +from rolepermissions.verifications import has_role
  3 +
  4 +register = template.Library()
  5 +
  6 +@register.filter
  7 +def show_subject_subscribe(user, subject):
  8 + if not user is None:
  9 + if user.is_authenticated:
  10 + if has_role(user, 'student') and not user.is_staff:
  11 + if not user in subject.students.all() and subject.show_subscribe:
  12 + return True
  13 +
  14 + return False
  15 +
  16 +@register.filter
  17 +def show_course_subscribe(user, course):
  18 + if not user is None:
  19 + if user.is_authenticated:
  20 + if has_role(user, 'student') and not user.is_staff:
  21 + if not user in course.students.all() and course.show_subscribe:
  22 + return True
  23 +
  24 + return False
0 25 \ No newline at end of file
... ...
courses/templatetags/list_topic_foruns.py
... ... @@ -59,7 +59,7 @@ def list_topic_link_edit(request,topic):
59 59 'request':request
60 60 }
61 61 context['links'] = Link.objects.filter(topic = topic)
62   - context['slug'] = topic.slug
  62 + context['topic'] = topic
63 63 return context
64 64  
65 65 @register.inclusion_tag('topic/link_topic_list.html')
... ... @@ -68,5 +68,5 @@ def list_topic_link(request,topic):
68 68 'request':request
69 69 }
70 70 context['links'] = Link.objects.filter(topic = topic)
71   - context['slug'] = topic.slug
  71 + context['topic'] = topic
72 72 return context
... ...
courses/urls.py
1 1 from django.conf.urls import url, include
2 2  
3 3 from . import views
4   -from links import views as linkviews
5 4 urlpatterns = [
6 5 url(r'^$', views.IndexView.as_view(), name='manage'),
7 6 url(r'^create/$', views.CreateCourseView.as_view(), name='create'),
8 7 url(r'^edit/(?P<slug>[\w_-]+)/$', views.UpdateCourseView.as_view(), name='update'),
9 8 url(r'^(?P<slug>[\w_-]+)/$', views.CourseView.as_view(), name='view'),
10 9 url(r'^delete/(?P<slug>[\w_-]+)/$', views.DeleteCourseView.as_view(), name='delete'),
  10 + url(r'^subscribe/(?P<slug>[\w_-]+)/$', views.subscribe_course, name='subscribe'),
11 11 url(r'^category/(?P<slug>[\w_-]+)/$', views.FilteredView.as_view(), name='filter'),
12 12 url(r'^categories/view/$', views.IndexCatView.as_view(), name='manage_cat'),
13 13 url(r'^categories/create/$', views.CreateCatView.as_view(), name="create_cat"),
... ... @@ -18,11 +18,9 @@ urlpatterns = [
18 18 url(r'^subjects/create/(?P<slug>[\w_-]+)/$', views.CreateSubjectView.as_view(), name='create_subject'),
19 19 url(r'^subjects/update/(?P<slug>[\w_-]+)/$', views.UpdateSubjectView.as_view(), name='update_subject'),
20 20 url(r'^subjects/delete/(?P<slug>[\w_-]+)/$', views.DeleteSubjectView.as_view(), name='delete_subject'),
  21 + url(r'^subjects/subscribe/(?P<slug>[\w_-]+)/$', views.subscribe_subject, name='subscribe_subject'),
21 22 url(r'^topics/create/(?P<slug>[\w_-]+)/$', views.CreateTopicView.as_view(), name='create_topic'),
22 23 url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'),
23   - url(r'^topics/createlink/$', linkviews.CreateLink.as_view(),name = 'create_link'),
24   - url(r'^topics/deletelink/(?P<linkname>[\w_-]+)/$', linkviews.deleteLink,name = 'delete_link'),
25   - url(r'^topics/updatelink/(?P<linkname>[\w_-]+)/$', linkviews.UpdateLink.as_view(),name = 'update_link'),
26 24 url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'),
27 25 url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'),
28 26 url(r'^forum/', include('forum.urls', namespace = 'forum')),
... ... @@ -31,7 +29,4 @@ urlpatterns = [
31 29 url(r'^files/', include('files.urls', namespace = 'file')),
32 30 url(r'^upload-material/$', views.UploadMaterialView.as_view(), name='upload_material'),
33 31 url(r'^links/',include('links.urls',namespace = 'links')),
34   -
35   -
36   -
37 32 ]
... ...
courses/views.py
... ... @@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _
10 10 from rolepermissions.verifications import has_role
11 11 from django.db.models import Q
12 12 from rolepermissions.verifications import has_object_permission
13   -from django.http import HttpResponseRedirect
  13 +from django.http import HttpResponseRedirect, JsonResponse
14 14  
15 15 from .forms import CourseForm, UpdateCourseForm, CategoryCourseForm, SubjectForm,TopicForm,ActivityForm
16 16 from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity, CategorySubject
... ... @@ -19,6 +19,8 @@ from users.models import User
19 19 from files.forms import FileForm
20 20 from files.models import TopicFile
21 21  
  22 +from django.urls import reverse
  23 +
22 24 from datetime import date
23 25  
24 26 class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
... ... @@ -35,14 +37,13 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
35 37 list_courses = None
36 38 categorys_courses = None
37 39 if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'):
38   - list_courses = Course.objects.filter(professors__name = self.request.user.name).order_by('name')
  40 + list_courses = Course.objects.filter(Q(professors = True)|Q(professors__name = self.request.user.name)).order_by('name')
39 41 categorys_courses = CourseCategory.objects.filter(course_category__professors__name = self.request.user.name).distinct()
40 42 else:
41   - list_courses = Course.objects.filter(students__name = self.request.user.name)
  43 + list_courses = Course.objects.filter(Q(students = True)|Q(students__name = self.request.user.name)).order_by('name')
42 44 categorys_courses = CourseCategory.objects.filter(course_category__students__name = self.request.user.name).distinct()
43 45  
44 46 courses_category = Course.objects.filter(category__name = self.request.GET.get('category'))
45   -
46 47 none = None
47 48 q = self.request.GET.get('category', None)
48 49 if q is None:
... ... @@ -187,7 +188,7 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView):
187 188 if has_role(self.request.user,'system_admin'):
188 189 courses = Course.objects.all()
189 190 elif has_role(self.request.user,'professor'):
190   - courses = self.request.user.courses.all()
  191 + courses = self.request.user.courses_professors.all()
191 192 elif has_role(self.request.user, 'student'):
192 193 courses = self.request.user.courses_student.all()
193 194  
... ... @@ -227,6 +228,17 @@ class DeleteView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.De
227 228  
228 229 return self.response_class(request=self.request, template=self.get_template_names(), context=context, using=self.template_engine)
229 230  
  231 +@login_required
  232 +def subscribe_course(request, slug):
  233 + course = get_object_or_404(Course, slug = slug)
  234 +
  235 + course.students.add(request.user)
  236 +
  237 + if request.user in course.students.all():
  238 + return JsonResponse({"status": "ok", "message": _("Successfully subscribed to the course!")})
  239 + else:
  240 + return JsonResponse({"status": "erro", "message": _("An error has occured. Could not subscribe to this course, try again later")})
  241 +
230 242 class FilteredView(LoginRequiredMixin, generic.ListView):
231 243  
232 244 login_url = reverse_lazy("core:home")
... ... @@ -296,6 +308,19 @@ class DeleteCatView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView):
296 308 model = CourseCategory
297 309 template_name = 'category/delete.html'
298 310  
  311 + def dispatch(self, *args, **kwargs):
  312 + category = get_object_or_404(CourseCategory, slug = self.kwargs.get('slug'))
  313 + if(not has_object_permission('delete_category', self.request.user, category)):
  314 + return self.handle_no_permission()
  315 + return super(DeleteCatView, self).dispatch(*args, **kwargs)
  316 +
  317 +
  318 + def get_context_data(self, **kwargs):
  319 + context = super(DeleteCatView, self).get_context_data(**kwargs)
  320 + context['course'] = self.object.course_category
  321 + context['category'] = self.object
  322 + return context
  323 +
299 324 def get_success_url(self):
300 325 messages.success(self.request, _('Category deleted successfully!'))
301 326 return reverse_lazy('course:manage_cat')
... ... @@ -405,7 +430,11 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, gener
405 430 self.object.subject = subject
406 431 self.object.owner = self.request.user
407 432 self.object.save()
408   -
  433 + action = super(CreateTopicView, self).createorRetrieveAction("create Topic")
  434 + super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created",
  435 + resource_name=self.object.name, resource_link= reverse('course:view_topic',args=[self.object.slug]),
  436 + actor=self.request.user, users = self.object.subject.course.students.all() )
  437 +
409 438 return super(CreateTopicView, self).form_valid(form)
410 439  
411 440 class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView):
... ... @@ -526,6 +555,19 @@ class DeleteSubjectView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView):
526 555 def get_success_url(self):
527 556 return reverse_lazy('course:view', kwargs={'slug' : self.object.course.slug})
528 557  
  558 +@login_required
  559 +def subscribe_subject(request, slug):
  560 + subject = get_object_or_404(Subject, slug = slug)
  561 +
  562 + if request.user in subject.course.students.all():
  563 + subject.students.add(request.user)
  564 +
  565 + if request.user in subject.students.all():
  566 + return JsonResponse({"status": "ok", "message": _("Successfully subscribed to the subject!")})
  567 + else:
  568 + return JsonResponse({"status": "erro", "message": _("An error has occured. Could not subscribe to this subject, try again later")})
  569 + else:
  570 + return JsonResponse({"status": "erro", "message": _("You're not subscribed in the course yet.")})
529 571  
530 572 class IndexSubjectCategoryView(LoginRequiredMixin, generic.ListView):
531 573 allowed_roles = ['professor', 'system_admin']
... ...
exam/migrations/0001_initial.py
1 1 # -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
  2 +# Generated by Django 1.10 on 2016-10-22 04:32
3 3 from __future__ import unicode_literals
4 4  
  5 +from django.conf import settings
5 6 from django.db import migrations, models
6 7 import django.db.models.deletion
7 8  
... ... @@ -11,6 +12,7 @@ class Migration(migrations.Migration):
11 12 initial = True
12 13  
13 14 dependencies = [
  15 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14 16 ('courses', '0001_initial'),
15 17 ]
16 18  
... ... @@ -23,9 +25,22 @@ class Migration(migrations.Migration):
23 25 ('order', models.PositiveSmallIntegerField(verbose_name='Order')),
24 26 ],
25 27 options={
26   - 'ordering': ('order',),
27   - 'verbose_name': 'Answer',
28 28 'verbose_name_plural': 'Answers',
  29 + 'verbose_name': 'Answer',
  30 + 'ordering': ('order',),
  31 + },
  32 + ),
  33 + migrations.CreateModel(
  34 + name='AnswersStudent',
  35 + fields=[
  36 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  37 + ('status', models.BooleanField(default=False, verbose_name='Answered')),
  38 + ('answered_in', models.DateTimeField(auto_now=True, verbose_name='Answered Date')),
  39 + ('answer', models.ManyToManyField(related_name='student_answer', to='exam.Answer', verbose_name='Answers Students')),
  40 + ],
  41 + options={
  42 + 'verbose_name_plural': 'Answers Student',
  43 + 'verbose_name': 'Answer Stundent',
29 44 },
30 45 ),
31 46 migrations.CreateModel(
... ... @@ -35,12 +50,22 @@ class Migration(migrations.Migration):
35 50 ('begin_date', models.DateField(blank=True, verbose_name='Begin of Course Date')),
36 51 ],
37 52 options={
38   - 'verbose_name': 'Exam',
39 53 'verbose_name_plural': 'Exams',
  54 + 'verbose_name': 'Exam',
40 55 },
41 56 bases=('courses.activity',),
42 57 ),
43 58 migrations.AddField(
  59 + model_name='answersstudent',
  60 + name='exam',
  61 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student_exam', to='exam.Exam', verbose_name='Exam'),
  62 + ),
  63 + migrations.AddField(
  64 + model_name='answersstudent',
  65 + name='student',
  66 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'),
  67 + ),
  68 + migrations.AddField(
44 69 model_name='answer',
45 70 name='exam',
46 71 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'),
... ...
exam/models.py
... ... @@ -32,9 +32,9 @@ class Answer(models.Model):
32 32  
33 33 class AnswersStudent(models.Model):
34 34 status = models.BooleanField(_("Answered"), default=False)
35   - exam = models.ForeignKey(Exam, verbose_name = _('Exam'), related_name='answers_stundet')
36   - answer = models.ManyToManyField(Answer,verbose_name = _('Answers Students'), related_name='answers_stundet')
37   - student = models.ForeignKey(User, verbose_name = _('Student'), related_name='answers_stundent_exam')
  35 + exam = models.ForeignKey(Exam, verbose_name = _('Exam'), related_name='student_exam')
  36 + answer = models.ManyToManyField(Answer,verbose_name = _('Answers Students'), related_name='student_answer')
  37 + student = models.ForeignKey(User, verbose_name = _('Student'), related_name='student')
38 38 answered_in = models.DateTimeField(_("Answered Date"),auto_now=True)
39 39  
40 40 class Meta:
... ...
exam/templates/exam/create.html
1   -ma {% extends "base.html" %}
2   -{% block content %}
3   -<div class="modal fade" id="poll" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
4   - <div class="modal-dialog" role="document">
5   - <div class="modal-content">
6   -
7   - <!-- Modal Header -->
8   - <div class="modal-header">
9   -
10   - {% block title_poll %}
11   - <!-- Put your title here!!! -->
12   - <h4 class="modal-title" id="myModalLabel">{% trans "Create a Exam" %}</h4>
13   - {% endblock title_poll %}
14   - </div>
15   - <!-- Modal Body -->
16   - <div class="modal-body">
17   -
18   - {# <form id="ac" class="form-horizontal"> #}
19   - {# <fieldset> #}
20   -
21   - <div class="form-group">
22   - <label for="examName" class="col-md-2 control-label">Exam Name</label>
23   -
24   - <div class="col-md-10">
25   - <input type="text" class="form-control" id="examName" placeholder="Exam Name">
26   - </div>
27   -
28   -
29   - </div>
30   - <div class="form-group">
31   - <label for="Date" class="col-md-2 control-label">Exam Period</label>
32   - <div class="col-md-5">
33   - <input type="date" class="form-control" id="beginDate" placeholder="Begin Date">
34   - </div>
35   - <div class="col-md-5">
36   - <input type="text" class="form-control" id="datepicker" placeholder="End Date">
37   -
38   - </div>
39   - </div>
40   - <div class="form-group">
41   - <label for="deadline" class="col-md-2 control-label">Allow submissions after deadline?</label>
42   - <div class="col-md-10">
43   - <label>
44   - <input type="checkbox">
45   - </label>
46   - </div>
47   - </div>
48   - <div class="form-group">
49   - <label for="questionType" class="col-md-2 control-label">Question Type</label>
50   - <div class="col-md-10">
51   - <select id="questionType" class="form-control" onchange="showDiv (this)">
52   - <option selected disabled>Question Type</option>
53   - <option value="0">Multiple Choice</option>
54   - <option value="1">True or False</option>
55   - <option value="2">Gap Filling</option>
56   - <option value="3">Discursive Question</option>
57   - </select>
58   - </div>
59   - </div>
60   - <div class="form-group" id="multipleChoice" style="display: none;">
61   - <form class="form-horizontal">
62   - <fieldset>
63   - <div class="form-group" id="multipleChoice">
64   -
65   - <label for="questionName" class="col-md-2 control-label">Question</label>
  1 +{% extends "base.html" %}
66 2  
  3 +{% load i18n %}
67 4  
  5 +{% block content %}
  6 +<div class="panel panel-info">
  7 + <div class="panel-heading">
  8 + {% block title_poll %}
  9 + <h1 class="panel-title">{% trans "New Exam" %}</h1>
  10 + {% endblock title_poll %}
  11 + </div>
  12 + <div class="panel-body">
  13 + <div class="row form-group">
  14 + <label for="exam_name" class="col-md-2 control-label">{% trans "Exam Name" %}</label>
68 15 <div class="col-md-10">
69   - <textarea class="form-control" rows="1" id="questionName" placeholder="Wording"></textarea>
70   - </div>
71   -
72   -
73   - </div>
74   - <div class="form-group">
75   - <label for="alternative" class="col-md-2 control-label">Alternatives</label>
76   - <div class="col-md-10" id="radios">
77   - <div class="radio radio-primary">
78   - <label>
79   - <input checked type="radio" name="alternatives" id="alternative1" value="1">
80   - <textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>
81   - </label>
82   - </div>
83   - <div class="radio radio-primary">
84   - <label>
85   - <input type="radio" name="alternatives" id="alternative2" value="2">
86   - <textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>
87   - </label>
88   - </div>
89   - </div>
90   - </div>
91   - <!-- new alternative button -->
92   - <div class="form-group">
93   - <div class="col-md-12 col-md-offset-2">
94   - <button type="button" class="btn btn-primary" id="newAlternative">New Alternative</button>
  16 + <input type="text" name="exam_name" class="form-control" id="exam_name" placeholder="{% trans 'Exam Name' %}">
95 17 </div>
96 18 </div>
97   - <div class="form-group">
98   - <div class="col-md-12 col-md-offset-2">
99   - <button type="submit" class="btn btn-primary">Save</button>
100   - <button type="cancel" class="btn btn-default">Cancel</button>
  19 + <div class="row form-group">
  20 + <label for="begin_date" class="col-md-2 control-label">{% trans "Exam's begin date" %}</label>
  21 + <div class="col-md-10">
  22 + <input type="date" name="begin_date" class="form-control" id="begin_date" placeholder='{% trans "Begin Date" %}'>
101 23 </div>
102 24 </div>
103   -
104   - </fieldset>
105   -</form>
106   -
107   -<script>
108   - var alternativeValue = 3;
109   -
110   - $('#newAlternative').click(function () {
111   - var element = '<div class="radio radio-primary">' +
112   - '<label>' +
113   - '<input type="radio" name="alternatives" id="alternative4"' + 'value="' +alternativeValue + '">' +
114   - '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>' +
115   - '</label>' +
116   - '</div>';
117   - $('#radios').append(element);
118   -
119   - alternativeValue++;
120   - });
121   -</script>
122   - </div>
123   - <div class="form-group" id="trueOrFalse" style="display: none;">
124   - <form class="form-horizontal" id="true-or-false">
125   - <fieldset>
126   - <div class="form-group" id="trueOrFalse">
127   -
128   - <label for="questionName" class="col-md-2 control-label">Question</label>
129   -
130   -
  25 + <div class="row form-group">
  26 + <label for="end_date" class="col-md-2 control-label">{% trans "Exam's end date" %}</label>
131 27 <div class="col-md-10">
132   - <textarea class="form-control" rows="1" id="questionName" placeholder="Wording"></textarea>
  28 + <input type="text" name="end_date" class="form-control" id="end_date" placeholder='{% trans "End Date" %}'>
133 29 </div>
134   -
135   -
136 30 </div>
137   - <div class="form-group">
138   - <label for="alternative" class="col-md-2 control-label">Alternatives: T/F</label>
139   - <div class="col-md-10" id="radiosTF">
140   - <!-- alternative -->
141   - <div class="radio radio-primary">
142   - <label>
143   - <textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>
144   - </label>
145   - <label>
146   - <input type="radio" name="alternative1" value="T">
147   - </label>
148   - <label>
149   - <input type="radio" name="alternative1" value="F">
150   - </label>
151   - </div>
152   - <!-- alternative -->
153   - <div class="radio radio-primary">
154   - <label>
155   - <textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>
156   - </label>
157   - <label>
158   - <input type="radio" name="alternative2" value="T">
159   - </label>
  31 + <div class="row form-group">
  32 + <div class="col-md-10">
  33 + <div class="checkbox">
160 34 <label>
161   - <input type="radio" name="alternative2" value="F">
  35 + <input type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans "Allow submissions after deadline?" %}
162 36 </label>
163 37 </div>
164 38 </div>
165 39 </div>
166   - <div class="form-group">
167   - <div class="col-md-12 col-md-offset-2">
168   - <button type="button" class="btn btn-primary" id="tfAlternative">New Alternative</button>
169   - </div>
170   - </div>
171   - <div class="form-group">
172   - <div class="col-md-12 col-md-offset-2">
173   - <button type="submit" class="btn btn-primary">Save</button>
174   - <button type="cancel" class="btn btn-default">Cancel</button>
175   - </div>
176   - </div>
177   -
178   - </fieldset>
179   -</form>
180   -
181   -<script>
182   - var tfAlternativeValue = 3;
183   -
184   - $('#tfAlternative').click(function () {
185   - var element = '<div class="radio radio-primary">' +
186   - '<label>' +
187   - '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>' +
188   - '</label>' +
189   - '<label>' +
190   - '<input type="radio" name="alternative' + tfAlternativeValue +'" value="T">' +
191   - '</label>' +
192   - '<label>' +
193   - '<input type="radio" name="alternative2" value="F">' +
194   - '</label>' +
195   - '</div>';
196   - $('#radiosTF').append(element);
197   -
198   - tfAlternativeValue++;
199   - });
200   -</script>
201   - </div>
202   - <div class="form-group" id="gapFilling" style="display: none;">
203   - <p>Gap Filling Question</p>
204   - </div>
205   - <div class="form-group" id="discursiveQuestion" style="display: none;">
206   - <form class="form-horizontal" id="discursive-question">
207   - <fieldset>
208   - <div class="form-group" id="discursiveQuestion">
209   -
210   - <label for="question" class="col-md-2 control-label">Question</label>
211   -
212   -
213   - <div class="col-md-10">
214   - <textarea class="form-control" rows="1" id="question" placeholder="Wording"></textarea>
215   - </div>
216   -
  40 + <div class="row form-group" id="questions">
217 41  
218 42 </div>
219   -
220   - <div class="form-group">
221   - <div class="col-md-10 col-md-offset-2">
222   - <button type="submit" class="btn btn-primary">Save</button>
223   - <button type="cancel" class="btn btn-default">Cancel</button>
  43 + <div class="row form-group">
  44 + <label for="questionType" class="col-md-2 control-label">{% trans "Question Type" %}</label>
  45 + <div class="col-md-10">
  46 + <select id="questionType" class="form-control" name="option_question" onchange="showDiv (this)">
  47 + <option selected disabled>{% trans "Question Type" %}</option>
  48 + <option value="0">{% trans "Multiple Choice" %}</option>
  49 + <option value="1">{% trans "True or False" %}</option>
  50 + <option value="2">{% trans "Gap Filling" %}</option>
  51 + <option value="3">{% trans "Discursive Question" %}</option>
  52 + </select>
224 53 </div>
225 54 </div>
226   -
227   - </fieldset>
228   -</form>
229   - </div>
230   - <div class="form-group">
231   - <div class="col-md-12 col-md-offset-2">
232   - <button type="submit" class="btn btn-primary">Save</button>
233   - <button type="cancel" class="btn btn-default">Cancel</button>
  55 + <div class="row">
  56 + <div class="col-md-12">
  57 + <button type="button" class="btn btn-primary btn-raised" id="add_question">{% trans "add question" %}</button>
234 58 </div>
235 59 </div>
236   - </form>
237   - </fieldset>
  60 + </div>
  61 + <div class="panel-footer text-right">
  62 + <button type="submite" id="button" form="form" class="btn btn-primary btn-raised">{% trans "Create" %}</button>
238 63 </div>
239 64 </div>
240   -
241 65 <script>
242   - function showDiv (elem) {
243   - if (elem.value == 0) {
244   - document.getElementById('multipleChoice').style.display = "block";
245   - document.getElementById('trueOrFalse').style.display = "none";
246   - document.getElementById('gapFilling').style.display = "none";
247   - document.getElementById('discursiveQuestion').style.display = "none";
248   - } else if (elem.value == 1) {
249   - document.getElementById('trueOrFalse').style.display = "block";
250   - document.getElementById('multipleChoice').style.display = "none";
251   - document.getElementById('gapFilling').style.display = "none";
252   - document.getElementById('discursiveQuestion').style.display = "none";
253   - } else if (elem.value == 2) {
254   - document.getElementById('gapFilling').style.display = "block";
255   - document.getElementById('multipleChoice').style.display = "none";
256   - document.getElementById('trueOrFalse').style.display = "none";
257   - document.getElementById('discursiveQuestion').style.display = "none";
258   - } else if (elem.value == 3) {
259   - document.getElementById('discursiveQuestion').style.display = "block";
260   - document.getElementById('multipleChoice').style.display = "none";
261   - document.getElementById('trueOrFalse').style.display = "none";
262   - document.getElementById('gapFilling').style.display = "none";
263   - }
264   - }
265   -
266   - $(function() {
267   - $( "#datepicker" ).datepicker();
  66 +var id = 1;
  67 +$("#add_question").click(function(){
  68 + $.get("{% url 'course:exam:true_or_false_question' %}", function(data){
  69 + // var teste = String(data);
  70 + // teste.replace("#radiosTF", "W3Schools");
  71 + // alert(teste);
  72 + $("#questions").append(data);
  73 + // $("#radiosTF").attr("id", "true_id_" + id);
  74 + $("#0").attr("id","true_" + id++);
268 75 });
  76 +});
  77 +var alternativeValue = 3;
  78 +$('#newAlternative').click(function () {
  79 + var element = '<div class="radio radio-primary">' +
  80 + '<label>' +
  81 + '<input type="radio" name="alternatives" id="alternative4"' + 'value="' +alternativeValue + '">' +
  82 + '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>' +
  83 + '</label>' +
  84 + '</div>';
  85 + $('#radios').append(element);
  86 + alternativeValue++;
  87 +});
  88 +var tfAlternativeValue = 3;
  89 +$('#tfAlternative').click(function () {
  90 + var element = '<div class="radio radio-primary">' +
  91 + '<label>' +
  92 + '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>' +
  93 + '</label>' +
  94 + '<label>' +
  95 + '<input type="radio" name="alternative' + tfAlternativeValue +'" value="T">' +
  96 + '</label>' +
  97 + '<label>' +
  98 + '<input type="radio" name="alternative2" value="F">' +
  99 + '</label>' +
  100 + '</div>';
  101 + $('#radiosTF').append(element);
  102 + tfAlternativeValue++;
  103 +});
  104 +$(function() {
  105 + $( "#begin_date,#end_date" ).datepicker();
  106 +});
269 107 </script>
  108 +
270 109 {% endblock content %}
... ...
exam/templates/exam/create.html.py 0 → 100644
... ... @@ -0,0 +1,116 @@
  1 +BBBBBBB BBBBBBBBBBB
  2 +
  3 +BBBB BBBB
  4 +
  5 +BBBBB BBBBBBB
  6 +XXXX XXXXXXXXXXXX XXXXXXXXXXXX
  7 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  8 + BBBBB BBBBBBBBBB
  9 + XXX XXXXXXXXXXXXXXXXXXXX gettext(u'New Exam') XXXXX
  10 + BBBBBBBB BBBBBBBBBB
  11 + XXXXXX
  12 + XXXX XXXXXXXXXXXXXXXXXXX
  13 + XXXX XXXXXXXXXX XXXXXXXXXXXX
  14 + XXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX gettext(u'Exam Name') XXXXXXXX
  15 + XXXX XXXXXXXXXXXXXXXXXX
  16 + XXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'Exam Name') XX
  17 + XXXXXX
  18 + XXXXXX
  19 + XXXX XXXXXXXXXX XXXXXXXXXXXX
  20 + XXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX gettext(u"Exam's begin date") XXXXXXXX
  21 + XXXX XXXXXXXXXXXXXXXXXX
  22 + XXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'Begin Date') XX
  23 + XXXXXX
  24 + XXXXXX
  25 + XXXX XXXXXXXXXX XXXXXXXXXXXX
  26 + XXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX gettext(u"Exam's end date") XXXXXXXX
  27 + XXXX XXXXXXXXXXXXXXXXXX
  28 + XXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'End Date') XX
  29 + XXXXXX
  30 + XXXXXX
  31 + XXXX XXXXXXXXXX XXXXXXXXXXXX
  32 + XXXX XXXXXXXXXXXXXXXXXX
  33 + XXXX XXXXXXXXXXXXXXXXX
  34 + XXXXXXX
  35 + XXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Allow submissions after deadline?')
  36 + XXXXXXXX
  37 + XXXXXX
  38 + XXXXXX
  39 + XXXXXX
  40 + XXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXX
  41 +
  42 + XXXXXX
  43 + XXXX XXXXXXXXXX XXXXXXXXXXXX
  44 + XXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX gettext(u'Question Type') XXXXXXXX
  45 + XXXX XXXXXXXXXXXXXXXXXX
  46 + XXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXX
  47 + XXXXXXX XXXXXXXX XXXXXXXXX gettext(u'Question Type') XXXXXXXXX
  48 + XXXXXXX XXXXXXXXXX gettext(u'Multiple Choice') XXXXXXXXX
  49 + XXXXXXX XXXXXXXXXX gettext(u'True or False') XXXXXXXXX
  50 + XXXXXXX XXXXXXXXXX gettext(u'Gap Filling') XXXXXXXXX
  51 + XXXXXXX XXXXXXXXXX gettext(u'Discursive Question') XXXXXXXXX
  52 + XXXXXXXXX
  53 + XXXXXX
  54 + XXXXXX
  55 + XXXX XXXXXXXXXXXX
  56 + XXXX XXXXXXXXXXXXXXXXXX
  57 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXX gettext(u'add question') XXXXXXXXX
  58 + XXXXXX
  59 + XXXXXX
  60 + XXXXXX
  61 + XXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX
  62 + XXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXX gettext(u'Create') XXXXXXXXX
  63 + XXXXXX
  64 +XXXXXX
  65 +XXXXXXXX
  66 +XXX XX X XX
  67 +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  68 + XXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBXX XXXXXXXXXXXXXXX
  69 + XX XXX XXXXX X XXXXXXXXXXXXX
  70 + XX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  71 + XX XXXXXXXXXXXXX
  72 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  73 + XX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX X XXXX
  74 + XXXXXXXXXXXXXXXXXXXXXXXXX X XXXXXX
  75 + XXX
  76 +XXX
  77 +
  78 +XXX XXXXXXXXXXXXXXXX X XX
  79 +
  80 +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX X
  81 + XXX XXXXXXX X XXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXX X
  82 + XXXXXXXXX X
  83 + XXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX X XXXXXXXXX XXXXXXXXXXXXXXXXX X XXXX X
  84 + XXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXX X
  85 + XXXXXXXXXX X
  86 + XXXXXXXXX
  87 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  88 +
  89 + XXXXXXXXXXXXXXXXXXX
  90 +XXX
  91 +
  92 +XXX XXXXXXXXXXXXXXXXXX X XX
  93 +
  94 +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX X
  95 + XXX XXXXXXX X XXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXX X
  96 + XXXXXXXXX X
  97 + XXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXX X
  98 + XXXXXXXXXX X
  99 + XXXXXXXXX X
  100 + XXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXX X XXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXX X
  101 + XXXXXXXXXX X
  102 + XXXXXXXXX X
  103 + XXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXX X
  104 + XXXXXXXXXX X
  105 + XXXXXXXXX
  106 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  107 +
  108 + XXXXXXXXXXXXXXXXXXXXX
  109 +XXX
  110 +
  111 +XXXXXXXXXXXX X
  112 + XX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX
  113 +XXX
  114 +XXXXXXXXX
  115 +
  116 +BBBBBBBB BBBBBBB
... ...
exam/templates/exam/discursive_question.html 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<div class="form-group" id="discursiveQuestion">
  2 + <label for="question" class="col-md-2 control-label">{% trans "Question" %}</label>
  3 + <div class="col-md-10">
  4 + <textarea class="form-control" rows="1" id="question" placeholder="{% trans 'Question' %}"></textarea>
  5 + </div>
  6 +</div>
... ...
exam/templates/exam/discursive_question.html.py 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +XXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX
  2 + XXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX gettext(u'Question') XXXXXXXX
  3 + XXXX XXXXXXXXXXXXXXXXXX
  4 + XXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'Question') XXXXXXXXXXXXX
  5 + XXXXXX
  6 +XXXXXX
... ...
exam/templates/exam/gap_filling_answer.html 0 → 100644
exam/templates/exam/gap_filling_answer.html.py 0 → 100644
exam/templates/exam/gap_filling_question.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<div class="form-group" id="gapFilling" style="display: none;">
  2 + <p>Gap Filling Question</p>
  3 +</div>
... ...
exam/templates/exam/gap_filling_question.html.py 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +XXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXX
  2 + XXXXXX XXXXXXX XXXXXXXXXXXX
  3 +XXXXXX
... ...
exam/templates/exam/multiple_choice_answer.html 0 → 100644
exam/templates/exam/multiple_choice_answer.html.py 0 → 100644
exam/templates/exam/multiple_choice_question.html 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<div class="form-group" id="multipleChoice">
  2 +
  3 + <label for="questionName" class="col-md-2 control-label">Question</label>
  4 +
  5 +
  6 + <div class="col-md-10">
  7 + <textarea class="form-control" rows="1" id="questionName" placeholder="Wording"></textarea>
  8 + </div>
  9 +
  10 +
  11 +</div>
  12 +<div class="form-group">
  13 + <label for="alternative" class="col-md-2 control-label">Alternatives</label>
  14 + <div class="col-md-10" id="radios">
  15 + <div class="radio radio-primary">
  16 + <label>
  17 + <input checked type="radio" name="alternatives" id="alternative1" value="1">
  18 + <textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>
  19 + </label>
  20 + </div>
  21 + <div class="radio radio-primary">
  22 + <label>
  23 + <input type="radio" name="alternatives" id="alternative2" value="2">
  24 + <textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>
  25 + </label>
  26 + </div>
  27 + </div>
  28 +</div>
  29 +<!-- new alternative button -->
  30 +<div class="form-group">
  31 + <div class="col-md-12 col-md-offset-2">
  32 + <button type="button" class="btn btn-primary" id="newAlternative">New Alternative</button>
  33 + </div>
  34 +</div>
  35 +<div class="form-group">
  36 + <div class="col-md-12 col-md-offset-2">
  37 + <button type="submit" class="btn btn-primary">Save</button>
  38 + <button type="cancel" class="btn btn-default">Cancel</button>
  39 + </div>
  40 +</div>
... ...
exam/templates/exam/multiple_choice_question.html.py 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +XXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
  2 +
  3 + XXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  4 +
  5 +
  6 + XXXX XXXXXXXXXXXXXXXXXX
  7 + XXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  8 + XXXXXX
  9 +
  10 +
  11 +XXXXXX
  12 +XXXX XXXXXXXXXXXXXXXXXXX
  13 + XXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  14 + XXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXX
  15 + XXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX
  16 + XXXXXXX
  17 + XXXXXX XXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXX
  18 + XXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXX
  19 + XXXXXXXX
  20 + XXXXXX
  21 + XXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX
  22 + XXXXXXX
  23 + XXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXX
  24 + XXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXX
  25 + XXXXXXXX
  26 + XXXXXX
  27 + XXXXXX
  28 +XXXXXX
  29 +XXXX XXX XXXXXXXXXXX XXXXXX XXX
  30 +XXXX XXXXXXXXXXXXXXXXXXX
  31 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  32 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
  33 + XXXXXX
  34 +XXXXXX
  35 +XXXX XXXXXXXXXXXXXXXXXXX
  36 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  37 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  38 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
  39 + XXXXXX
  40 +XXXXXX
... ...
exam/templates/exam/remove.html.py 0 → 100644
exam/templates/exam/true_or_false_answer.html 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +{% load i18n %}
  2 +
  3 +<div class="row form-group" >
  4 + <div class="col-md-1">
  5 + </br>
  6 + <label><span class="glyphicon glyphicon-move"></span></label>
  7 + </div>
  8 + <div class="col-md-10">
  9 + <input class="form-control" placeholder='{% trans "Write your alternative" %}'></input>
  10 + </div>
  11 + <div class="col-md-1">
  12 + </br>
  13 + <label><span class="glyphicon glyphicon-remove" onclick="this.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode);"></span></label>
  14 + </div>
  15 +</div>
... ...
exam/templates/exam/true_or_false_answer.html.py 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +BBBB BBBB
  2 +
  3 +XXXX XXXXXXXXXX XXXXXXXXXXX X
  4 + XXXX XXXXXXXXXXXXXXXXX
  5 + XXXXX
  6 + XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  7 + XXXXXX
  8 + XXXX XXXXXXXXXXXXXXXXXX
  9 + XXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'Write your alternative') XXXXXXXXXX
  10 + XXXXXX
  11 + XXXX XXXXXXXXXXXXXXXXX
  12 + XXXXX
  13 + XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  14 + XXXXXX
  15 +XXXXXX
... ...
exam/templates/exam/true_or_false_question.html 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +{# {% extends "base.html" %} #}
  2 +
  3 +{% load i18n %}
  4 +{# {% block content %} #}
  5 +<style>
  6 + .glyphicon-remove:hover {
  7 + cursor: pointer;
  8 + }
  9 + .glyphicon-move:hover {
  10 + cursor: move;
  11 + }
  12 +</style>
  13 +<div class="" id="0">
  14 + <div class="row form-group">
  15 + <div class="col-md-1">
  16 + </br>
  17 + <label><span class="glyphicon glyphicon-move"></span></label>
  18 + </div>
  19 + <div class="col-md-2">
  20 + <label for="questionName" class="control-label">{% trans "Question" %}</label>
  21 + </div>
  22 + <div class="col-md-9">
  23 + <div class="row">
  24 + <div class="col-md-11">
  25 + <input class="form-control" id="questionName" placeholder="{% trans 'Question' %}"></input>
  26 + </div>
  27 + <div class="col-md-1">
  28 + </br>
  29 + <label><span class="glyphicon glyphicon-remove"></span></label>
  30 + </div>
  31 + </div>
  32 + </div>
  33 +
  34 + </div>
  35 + <div class="row">
  36 + <div class="col-md-offset-1 col-md-2">
  37 + <label class="control-label">{% trans "Alternatives: T/F" %}</label>
  38 + </div>
  39 + <div class="col-md-9" id="radiosTF">
  40 + {% include "exam/true_or_false_answer.html" %}
  41 + </div>
  42 + </div>
  43 + <div class="form-group">
  44 + <div class="col-md-9 col-md-offset-3">
  45 + <button type="button" class="btn btn-primary btn-raised" id="new_alternative">{% trans "New Alternative" %}</button>
  46 + </div>
  47 + </div>
  48 +</div>
  49 +<script type="text/javascript">
  50 + $("#new_alternative").click(function(){
  51 + $.get("{% url 'course:exam:true_or_false_answer' %}", function(data){
  52 + $("#radiosTF").append(data);
  53 + });
  54 + });
  55 + //deve ser importado apenas depois do html
  56 + $( "#radiosTF" ).sortable({ // utilizado para fazer a re-organização das respostas
  57 + delay: 100,
  58 + distance: 5,
  59 + update: function( event, ui ) {
  60 + var cont = 1;
  61 + $("#radiosTF div div input").each(function(){
  62 + $(this).attr('name',cont++);
  63 + });
  64 + },
  65 + });
  66 +</script>
  67 +{# {% endblock content %} #}
... ...
exam/templates/exam/true_or_false_question.html.py 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +
  2 +
  3 +BBBB BBBB
  4 +
  5 +XXXXXXX
  6 + XXXXXXXXXXXXXXXXXXXXXXX X
  7 + XXXXXXX XXXXXXXX
  8 + X
  9 + XXXXXXXXXXXXXXXXXXXXX X
  10 + XXXXXXX XXXXX
  11 + X
  12 +XXXXXXXX
  13 +XXXX XXXXXXXX XXXXXXX
  14 + XXXX XXXXXXXXXX XXXXXXXXXXXX
  15 + XXXX XXXXXXXXXXXXXXXXX
  16 + XXXXX
  17 + XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  18 + XXXXXX
  19 + XXXX XXXXXXXXXXXXXXXXX
  20 + XXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX gettext(u'Question') XXXXXXXX
  21 + XXXXXX
  22 + XXXX XXXXXXXXXXXXXXXXX
  23 + XXXX XXXXXXXXXXXX
  24 + XXXX XXXXXXXXXXXXXXXXXX
  25 + XXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'Question') XXXXXXXXXX
  26 + XXXXXX
  27 + XXXX XXXXXXXXXXXXXXXXX
  28 + XXXXX
  29 + XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  30 + XXXXXX
  31 + XXXXXX
  32 + XXXXXX
  33 +
  34 + XXXXXX
  35 + XXXX XXXXXXXXXXXX
  36 + XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX
  37 + XXXXXX XXXXXXXXXXXXXXXXXXXXXX gettext(u'Alternatives: T/F') XXXXXXXX
  38 + XXXXXX
  39 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXX
  40 + BBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
  41 + XXXXXX
  42 + XXXXXX
  43 + XXXX XXXXXXXXXXXXXXXXXXX
  44 + XXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  45 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'New Alternative') XXXXXXXXX
  46 + XXXXXX
  47 + XXXXXX
  48 +XXXXXX
  49 +XXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
  50 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  51 + XXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBXX XXXXXXXXXXXXXXX
  52 + XXXXXXXXXXXXXXXXXXXXXXXXXXXX
  53 + XXX
  54 + XXX
  55 + XXXXXX XXX XXXXXXXXX XXXXXX XXXXXX XX XXXX
  56 + XX XXXXXXXXXXX XXXXXXXXXXXX XX XXXXXXXXX XXXX XXXXX X XXXXXXXXXXXXXX XXX XXXXXXXXX
  57 + XXXXXX XXXX
  58 + XXXXXXXXX XX
  59 + XXXXXXX XXXXXXXXX XXXXXX XX X X
  60 + XXX XXXX X XX
  61 + XXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXXXXXXXXXXX
  62 + XXXXXXXXXXXXXXXXXXXXXXXXXXXX
  63 + XXX
  64 + XX
  65 + XXX
  66 +XXXXXXXXX
  67 +
... ...
exam/templates/exam/update.html.py 0 → 100644
exam/templates/exam/view.html.py 0 → 100644
exam/urls.py
... ... @@ -9,4 +9,11 @@ urlpatterns = [
9 9 url(r'^delete/(?P<slug>[\w\-_]+)/$', views.DeleteExam.as_view(), name='delete_exam'), # exam
10 10 url(r'^answer/$', views.AnswerExam.as_view(), name='answer_exam'), # exam
11 11 url(r'^answer-exam/(?P<slug>[\w\-_]+)/$', views.AnswerStudentExam.as_view(), name='answer_student_exam'), # exam slug
  12 + url(r'^discursive-question/$',views.DiscursiveQuestion.as_view(), name="discursive_question"),
  13 + url(r'^gap-filling-question/$',views.GapFillingQuestion.as_view(), name="gap_filling_question"),
  14 + url(r'^gap-filling-answer/$',views.GapFillingAnswer.as_view(), name="gap_filling_answer"),
  15 + url(r'^multiple-choice-question/$',views.MultipleChoiceQuestion.as_view(), name="multiple_choice_question"),
  16 + url(r'^multiple-choice-answer/$',views.MultipleChoiceAnswer.as_view(), name="multiple_choice_answer"),
  17 + url(r'^true-or-false-question/$',views.TrueOrFalseQuestion.as_view(), name="true_or_false_question"),
  18 + url(r'^true-or-false-answer/$',views.TrueOrFalseAnswer.as_view(), name="true_or_false_answer"),
12 19 ]
... ...
exam/views.py
... ... @@ -24,7 +24,7 @@ class ViewExam(LoginRequiredMixin,generic.DetailView):
24 24 template_name = 'exam/view.html'
25 25  
26 26 def get_object(self, queryset=None):
27   - return get_object_or_404(Exam, slug = self.kwargs.get('slug'))
  27 + return get_object_or_404(Topic, slug = self.kwargs.get('slug'))
28 28  
29 29 def get_context_data(self, **kwargs):
30 30 context = super(ViewExam, self).get_context_data(**kwargs)
... ... @@ -44,7 +44,7 @@ class ViewExam(LoginRequiredMixin,generic.DetailView):
44 44  
45 45  
46 46  
47   -class CreateExam(LoginRequiredMixin,HasRoleMixin,generic.CreateView):
  47 +class CreateExam(LoginRequiredMixin,HasRoleMixin, NotificationMixin,generic.CreateView):
48 48  
49 49 allowed_roles = ['professor', 'system_admin']
50 50 login_url = reverse_lazy("core:home")
... ... @@ -72,8 +72,12 @@ class CreateExam(LoginRequiredMixin,HasRoleMixin,generic.CreateView):
72 72 self.object = form.save(commit = False)
73 73 topic = get_object_or_404(Topic, slug = self.kwargs.get('slug'))
74 74 self.object.topic = topic
  75 + self.object.name = str(self.object)
75 76 self.object.save()
76 77  
  78 + super(CreateExam, self).createNotification(message="created an Exam "+ self.object.name, actor=self.request.user,
  79 + resource_name=self.object.name, resource_link= reverse('course:exam:view_exam', args=[self.object.slug]),
  80 + users=self.object.topic.subject.students.all())
77 81 for key in self.request.POST:
78 82 if(key != 'csrfmiddlewaretoken' and key != 'name' and key != 'begin_date' and key != 'limit_date' and key != 'all_students' and key != 'students'):
79 83 answer = Answer(answer=self.request.POST[key],order=key,exam=self.object)
... ... @@ -227,3 +231,29 @@ class AnswerStudentExam(LoginRequiredMixin,generic.CreateView):
227 231 context['keys'] = keys
228 232  
229 233 return context
  234 +
  235 +class MultipleChoiceQuestion(generic.TemplateView):
  236 + template_name = 'exam/multiple_choice_question.html'
  237 +
  238 +
  239 +class MultipleChoiceAnswer(generic.TemplateView):
  240 + template_name = 'exam/multiple_choice_answer.html'
  241 +
  242 +
  243 +class DiscursiveQuestion(generic.TemplateView):
  244 + template_name = 'exam/discursive_question.html'
  245 +
  246 +
  247 +class TrueOrFalseQuestion(generic.TemplateView):
  248 + template_name = 'exam/true_or_false_question.html'
  249 +
  250 +
  251 +class TrueOrFalseAnswer(generic.TemplateView):
  252 + template_name = 'exam/true_or_false_answer.html'
  253 +
  254 +
  255 +class GapFillingQuestion(generic.TemplateView):
  256 + template_name = 'exam/gap_filling_question.html'
  257 +
  258 +class GapFillingAnswer(generic.TemplateView):
  259 + template_name = 'exam/gap_filling_answer.html'
... ...
files/migrations/0001_initial.py
1 1 # -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
  2 +# Generated by Django 1.10 on 2016-10-22 04:32
3 3 from __future__ import unicode_literals
4 4  
  5 +from django.conf import settings
5 6 from django.db import migrations, models
6 7 import django.db.models.deletion
7 8 import files.models
... ... @@ -14,6 +15,7 @@ class Migration(migrations.Migration):
14 15 dependencies = [
15 16 ('courses', '0001_initial'),
16 17 ('core', '0001_initial'),
  18 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
17 19 ]
18 20  
19 21 operations = [
... ... @@ -24,10 +26,11 @@ class Migration(migrations.Migration):
24 26 ('description', models.TextField(blank=True, verbose_name='Description')),
25 27 ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')),
26 28 ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')),
  29 + ('professor', models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')),
27 30 ],
28 31 options={
29   - 'ordering': ('-id',),
30 32 'verbose_name': 'File',
  33 + 'ordering': ('-id',),
31 34 'verbose_name_plural': 'Files',
32 35 },
33 36 bases=('courses.material',),
... ...
files/migrations/0002_topicfile_professor.py
... ... @@ -1,24 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
3   -from __future__ import unicode_literals
4   -
5   -from django.conf import settings
6   -from django.db import migrations, models
7   -
8   -
9   -class Migration(migrations.Migration):
10   -
11   - initial = True
12   -
13   - dependencies = [
14   - migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15   - ('files', '0001_initial'),
16   - ]
17   -
18   - operations = [
19   - migrations.AddField(
20   - model_name='topicfile',
21   - name='professor',
22   - field=models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),
23   - ),
24   - ]
files/templates/files/create_file.html
... ... @@ -99,8 +99,8 @@
99 99 contentType: false,
100 100 success: function(data) {
101 101 $('#fileModal').modal('hide');
102   - alert(data);
103   - // $('#list-topic-files').append(data);
  102 + $('#list-topic{{ topic.id }}-files').append(data);
  103 + $('#list-topic{{ topic.id }}-files-edit').append(data);
104 104 },
105 105 error: function(data){
106 106 $('.erro').html(data.responseText);
... ... @@ -110,5 +110,5 @@
110 110 });
111 111 event.preventDefault();
112 112 });
113   - </script>
  113 + </script>
114 114 {% endblock script_file %}
115 115 \ No newline at end of file
... ...
files/templates/files/create_file.html.py 0 → 100644
... ... @@ -0,0 +1,114 @@
  1 +BBBB BBBBBB BBBBBBBBBBBBB BBBB
  2 +
  3 +XXXX XXXXX XXXXXX XXXX XXX
  4 +XXXX XXXXXXXXXXXXX
  5 + XXXX XXXXXXXXXXXX XXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  6 + XXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  7 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  8 + XXXX XXXXXXXXXXXXXXXXXXXXX
  9 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  10 + XXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'Add File') XXXXX
  11 + XXXXXX
  12 + XXXX XXXXXXXXXXXXXXXXXXX
  13 + XXXX XXXX XXX
  14 + XXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  15 + BBBBBBBBBB
  16 + BB BBBBBBBB
  17 + BBB BBBBBBB BB BBBBBBBB
  18 + XXXX XXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  19 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  20 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  21 + XXXXXXXXX
  22 + XXXXXXX
  23 + XXXXXX
  24 + BBBBBB
  25 + BBBBB
  26 + XXXXXXXXXX
  27 + BBB BBBBB BB BBBB
  28 + XXXX XXXXXXXXXXXXXXXXX XXXXXXXBB BBBBBBBBBBBBBB XXXXXXXXX BBBBB XXXXXXXXXXXXXX
  29 + XXXX XXXXXXXXXXXXXXXXXX
  30 + BB BBBBBBBBBBBBBBBBBBBB
  31 + XXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  32 + BBBB
  33 + XXXXXX XXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
  34 + BBBBB
  35 + BB BBBBBBBBBBBBB BB BBBBBBBBBBBBB
  36 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBB BBBBBBBBB
  37 + XXXX XXXXXXXXXXXXXXXXXXXX
  38 + XXXXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'Choose your file...') XX
  39 + XXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  40 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXX XXXXXXXXXXXXXX
  41 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  42 + XXXXXXXXX
  43 + XXXXXXX
  44 + XXXXXX
  45 + BBBB
  46 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBB BBBBBBBBB
  47 + XXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  48 + BBBBB
  49 + XXXXXX
  50 +
  51 + BB BBBBBBBBBBBB
  52 + XXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXX
  53 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  54 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  55 + XXXXXXXXX
  56 + XXXX
  57 + BBB BBBBB BB BBBBBBBBBBBB
  58 + XXXXXXXXX
  59 + BBBBBB
  60 + XXXXX
  61 + XXXXXX
  62 + BBBBB
  63 + XXXXXX
  64 + BBBBBB
  65 +
  66 + XXXX XXXXXXXXXXXXXXXXXXX
  67 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  68 + XXXXXXXXX XXXX XXXX XXXXXXXXX XXXXXX XXXXXXXXXXXX
  69 + XXXXXX
  70 + XXXXXX
  71 +
  72 + XXXX XXXXXXXXXXXXXXXXXXX
  73 + XXXX XXXXXXXXXXXXXXXXXX
  74 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'Close') XXXXXXXXX
  75 + XXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  76 + XXXXXX
  77 + XXXXXX
  78 + XXXXXXXXXXX
  79 + XXXXXXX
  80 + XXXX XXXX XXXX XXX
  81 + XXXXXX
  82 + XXXXXX
  83 + XXXXXX
  84 + XXXXXX
  85 +XXXXXX
  86 +
  87 +BBBBB BBBBBBBBBBB
  88 +
  89 +
  90 + XXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
  91 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X
  92 + XXX XXXX X XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  93 + XXXXXXXX
  94 + XXXX XBBB BBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBBXX
  95 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  96 + XXXXX XXXXX
  97 + XXXXXX XXXXXX
  98 + XXXXXXXXXXXX XXXXXX
  99 + XXXXXXXXXXXX XXXXXX
  100 + XXXXXXXX XXXXXXXXXXXXXX X
  101 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  102 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  103 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  104 + XX
  105 + XXXXXX XXXXXXXXXXXXXXX
  106 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  107 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  108 + XXXXXXXXXXXXXXXXXXXXXXXX
  109 + X
  110 + XXX
  111 + XXXXXXXXXXXXXXXXXXXXXXX
  112 + XXX
  113 + XXXXXXXXX
  114 +BBBBBBBB BBBBBBBBBBB
0 115 \ No newline at end of file
... ...
files/templates/files/delete_file.html
... ... @@ -59,8 +59,9 @@
59 59 contentType: false,
60 60 success: function(data) {
61 61 $('#fileDeleteModal').modal('hide');
62   - $('#file_eidt_{{ file.slug }}').remove();
63   - $('#file_eidt_icon_{{ file.slug }}').remove();
  62 + $('#file_{{ file.slug }}').remove();
  63 + $('#file_edit_icon_{{ file.slug }}').remove();
  64 + $('#file_edit_{{ file.slug }}').remove();
64 65 },
65 66 error: function(data){
66 67 // $('.erro-update').html(data.responseText);
... ...
files/templates/files/delete_file.html.py 0 → 100644
... ... @@ -0,0 +1,77 @@
  1 +BBBB BBBBBB BBBBBBBBBBBBB BBBB
  2 +
  3 +XXXX XXXXX XXXXXX XXXX XXX
  4 +XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXBBBBBB BBBBBBBBBBBBBBXX
  5 +
  6 +XXXX XXXXXXXXXXXXXXXXXXXX
  7 + XXXX XXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXX
  8 + XXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  9 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  10 + XXXX XXXXXXXXXXXXXXXXXXXXX
  11 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  12 + XXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'Delete File') XXXXX
  13 + XXXXXX
  14 + XXXX XXXXXXXXXXXXXXXXXXX
  15 + XXXX XXXX XXX
  16 + XXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  17 + BBBBBBBBBB
  18 + BB BBBBBBBB
  19 + BBB BBBBBBB BB BBBBBBBB
  20 + XXXX XXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  21 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  22 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  23 + XXXXXXXXX
  24 + XXXXXXX
  25 + XXXXXX
  26 + BBBBBB
  27 + BBBBB
  28 + XXXXXXXXXX
  29 + XXXX XXXXXXXXXXXXXXXXXX
  30 + gettext(u'Are you sure to delete ') XX XXXXXXX XXXXXXXXXXXXXXX X XXXX XX X
  31 + XXXXXX
  32 + XXXX XXXXXXXXXXXXXXXXXXX
  33 + XXXX XXXXXXXXXXXXXXXXXX
  34 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'Close') XXXXXXXXX
  35 + XXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  36 + XXXXXX
  37 + XXXXXX
  38 + XXXXXXXXXXX
  39 + XXXXXXX
  40 + XXXX XXXX XXXX XXX
  41 + XXXXXX
  42 + XXXXXX
  43 + XXXXXX
  44 + XXXXXX
  45 +XXXXXX
  46 +
  47 +BBBBB BBBBBBBBBBB
  48 +
  49 +
  50 + XXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
  51 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X
  52 + XXX XXXX X XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  53 + XXXXXXXX
  54 + XXXX XBBB BBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBXX
  55 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  56 + XXXXX XXXXX
  57 + XXXXXX XXXXXX
  58 + XXXXXXXXXXXX XXXXXX
  59 + XXXXXXXXXXXX XXXXXX
  60 + XXXXXXXX XXXXXXXXXXXXXX X
  61 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  62 + XXXXXXXXXXXXXXXXXXXXX
  63 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  64 + XXXXXXXXXXXXXXXXXXXXXXXXXX
  65 + XX
  66 + XXXXXX XXXXXXXXXXXXXXX
  67 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  68 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  69 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  70 + XXXXXXXXXXXXXX
  71 + X
  72 + XXX
  73 + XXXXXXXXXXXXXXXXXXXXXXX
  74 + XXX
  75 + XXXXXXXXX
  76 +BBBBBBBB BBBBBBBBBBB
  77 +XXXX XXXXXXXX XXX
0 78 \ No newline at end of file
... ...
files/templates/files/render_file.html.py 0 → 100644
... ... @@ -0,0 +1 @@
  1 +XXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
0 2 \ No newline at end of file
... ...
files/templates/files/update_file.html
... ... @@ -104,8 +104,8 @@
104 104 contentType: false,
105 105 success: function(data) {
106 106 $('#fileUpdateModal').modal('hide');
107   - alert(data);
108   - // $('#list-topic-files').append(data);
  107 + $('#file_edit_{{ file.slug }}').replaceWith(data);
  108 + $('#file_{{ file.slug }}').replaceWith(data);
109 109 },
110 110 error: function(data){
111 111 $('.erro-update').html(data.responseText);
... ...
files/templates/files/update_file.html.py 0 → 100644
... ... @@ -0,0 +1,120 @@
  1 +BBBB BBBBBB BBBBBBBBBBBBB BBBB
  2 +
  3 +XXXX XXXXX XXXXXX XXXX XXX
  4 +XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXBBBBBB BBBBBBBBBBBBBBXX
  5 +
  6 +XXXX XXXXXXXXXXXXXXXXXXXX
  7 + XXXX XXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXX
  8 + XXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  9 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  10 + XXXX XXXXXXXXXXXXXXXXXXXXX
  11 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  12 + XXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'Edit File') XXXXX
  13 + XXXXXX
  14 + XXXX XXXXXXXXXXXXXXXXXXX
  15 + XXXX XXXX XXX
  16 + XXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  17 + BBBBBBBBBB
  18 + BB BBBBBBBB
  19 + BBB BBBBBBB BB BBBBBBBB
  20 + XXXX XXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  21 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  22 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  23 + XXXXXXXXX
  24 + XXXXXXX
  25 + XXXXXX
  26 + BBBBBB
  27 + BBBBB
  28 + XXXXXXXXXX
  29 + BBB BBBBB BB BBBB
  30 + XXXX XXXXXXXXXXXXXXXXX XXXXXXXBB BBBBBBBBBBBBBB XXXXXXXXX BBBBB XXXXXXXXXXXXXX
  31 + XXXX XXXXXXXXXXXXXXXXXX
  32 + BB BBBBBBBBBBBBBBBBBBBB
  33 + XXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  34 + BBBB
  35 + XXXXXX XXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
  36 + BBBBB
  37 + BB BBBBBBBBBBBBB BB BBBBBBBBBBBBB
  38 + XXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXX
  39 + XXXX XXXXXXXXXXXXXXXXXXXX
  40 + XXXXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX gettext(u'Choose your file...') XX
  41 + XXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  42 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXX XXXXXXXXXXXXXX
  43 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  44 + XXXXXXXXX
  45 + XXXXXXX
  46 + XXXXXX
  47 + XXXX XXXXXXXXXXXXXXXXX
  48 + XX XXXXXXX XXXXXXXXXXXXXXXX gettext(u'See current file') XXXX
  49 + XXXXXX
  50 + BBBB
  51 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBB BBBBBBBBB
  52 + XXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  53 + BBBBB
  54 + XXXXXX
  55 +
  56 + BB BBBBBBBBBBBB
  57 + XXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXX
  58 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  59 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  60 + XXXXXXXXX
  61 + XXXX
  62 + BBB BBBBB BB BBBBBBBBBBBB
  63 + XXXXXXXXX
  64 + BBBBBB
  65 + XXXXX
  66 + XXXXXX
  67 + BBBBB
  68 + XXXXXX
  69 + BBBBBB
  70 +
  71 + XXXX XXXXXXXXXXXXXXXXXXX
  72 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  73 + XXXXXXXXX XXXX XXXX XXXXXXXXX XXXXXX XXXXXXXXXXXX
  74 + XXXXXX
  75 + XXXXXX
  76 +
  77 + XXXX XXXXXXXXXXXXXXXXXXX
  78 + XXXX XXXXXXXXXXXXXXXXXX
  79 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'Close') XXXXXXXXX
  80 + XXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  81 + XXXXXX
  82 + XXXXXX
  83 + XXXXXXXXXXX
  84 + XXXXXXX
  85 + XXXX XXXX XXXX XXX
  86 + XXXXXX
  87 + XXXXXX
  88 + XXXXXX
  89 + XXXXXX
  90 +XXXXXX
  91 +
  92 +BBBBB BBBBBBBBBBB
  93 +
  94 +
  95 + XXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
  96 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X
  97 + XXX XXXX X XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  98 + XXXXXXXX
  99 + XXXX XBBB BBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBXX
  100 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  101 + XXXXX XXXXX
  102 + XXXXXX XXXXXX
  103 + XXXXXXXXXXXX XXXXXX
  104 + XXXXXXXXXXXX XXXXXX
  105 + XXXXXXXX XXXXXXXXXXXXXX X
  106 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  107 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  108 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  109 + XX
  110 + XXXXXX XXXXXXXXXXXXXXX
  111 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  112 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  113 + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  114 + X
  115 + XXX
  116 + XXXXXXXXXXXXXXXXXXXXXXX
  117 + XXX
  118 + XXXXXXXXX
  119 +BBBBBBBB BBBBBBBBBBB
  120 +XXXX XXXXXXXX XXX
0 121 \ No newline at end of file
... ...
files/views.py
... ... @@ -5,14 +5,16 @@ from django.contrib import messages
5 5 from django.core.urlresolvers import reverse_lazy
6 6 from django.contrib.auth.mixins import LoginRequiredMixin
7 7 from rolepermissions.mixins import HasRoleMixin
  8 +from rolepermissions.verifications import has_role
8 9 from .forms import FileForm, UpdateFileForm
9 10 from .models import TopicFile
10 11 from .utils import mime_type_to_material_icons
11 12 from courses.models import Topic
12 13 from core.models import MimeType
  14 +from core.mixins import NotificationMixin
13 15  
14 16 # Create your views here.
15   -class CreateFile(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView):
  17 +class CreateFile(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView):
16 18 allowed_roles = ['professor', 'system_admin']
17 19 login_url = reverse_lazy("core:home")
18 20 redirect_field_name = 'next'
... ... @@ -31,6 +33,10 @@ class CreateFile(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView):
31 33 self.object = form.save(commit = False)
32 34 topic = get_object_or_404(Topic, slug = self.kwargs.get('slug'))
33 35 self.object.topic = topic
  36 +
  37 + self.object.name = str(self.object)
  38 +
  39 +
34 40 # Set MimeType
35 41 file = self.request.FILES['file_url']
36 42 try:
... ... @@ -53,8 +59,12 @@ class CreateFile(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView):
53 59 # self.object.file_type = MimeType.objects.get(id = 1)
54 60  
55 61 self.object.save()
  62 + #CREATE NOTIFICATION
  63 + super(CreateFile, self).createNotification(message="uploaded a File "+ self.object.name, actor=self.request.user,
  64 + resource_name=self.object.name, resource_link= reverse('course:file:create_file', args=[self.object.slug]),
  65 + users=self.object.topic.subject.students.all())
56 66  
57   - return self.render_to_response(self.get_context_data(form = form), status = 200)
  67 + return self.get_success_url()
58 68  
59 69 def get_context_data(self, **kwargs):
60 70 context = super(CreateFile, self).get_context_data(**kwargs)
... ... @@ -69,7 +79,7 @@ class CreateFile(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView):
69 79 return context
70 80  
71 81 def get_success_url(self):
72   - self.success_url = reverse('course:file:render_file', args = (self.object.id, ))
  82 + self.success_url = redirect('course:file:render_file', id = self.object.id)
73 83  
74 84 return self.success_url
75 85  
... ... @@ -115,7 +125,7 @@ class DeleteFile(LoginRequiredMixin, HasRoleMixin, generic.DeleteView):
115 125  
116 126 def dispatch(self, *args, **kwargs):
117 127 file = get_object_or_404(TopicFile, slug = self.kwargs.get('slug'))
118   - if(not (file.topic.owner == self.request.user)):
  128 + if(not (file.topic.owner == self.request.user) and not(has_role(self.request.user, 'system_admin')) ):
119 129 return self.handle_no_permission()
120 130 return super(DeleteFile, self).dispatch(*args, **kwargs)
121 131  
... ...
forum/migrations/0001_initial.py
1 1 # -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
  2 +# Generated by Django 1.10 on 2016-10-22 04:32
3 3 from __future__ import unicode_literals
4 4  
  5 +from django.conf import settings
5 6 from django.db import migrations, models
6 7 import django.db.models.deletion
7 8  
... ... @@ -12,6 +13,7 @@ class Migration(migrations.Migration):
12 13  
13 14 dependencies = [
14 15 ('courses', '0001_initial'),
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 17 ]
16 18  
17 19 operations = [
... ... @@ -24,8 +26,8 @@ class Migration(migrations.Migration):
24 26 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')),
25 27 ],
26 28 options={
27   - 'verbose_name': 'Forum',
28 29 'verbose_name_plural': 'Foruns',
  30 + 'verbose_name': 'Forum',
29 31 },
30 32 bases=('courses.activity',),
31 33 ),
... ... @@ -36,10 +38,12 @@ class Migration(migrations.Migration):
36 38 ('message', models.TextField(verbose_name='Post message')),
37 39 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
38 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 44 options={
41   - 'verbose_name': 'Post',
42 45 'verbose_name_plural': 'Posts',
  46 + 'verbose_name': 'Post',
43 47 },
44 48 ),
45 49 migrations.CreateModel(
... ... @@ -50,10 +54,11 @@ class Migration(migrations.Migration):
50 54 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
51 55 ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')),
52 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 59 options={
55   - 'verbose_name': 'Post Answer',
56 60 'verbose_name_plural': 'Post Answers',
  61 + 'verbose_name': 'Post Answer',
57 62 },
58 63 ),
59 64 ]
... ...
forum/migrations/0002_auto_20161018_1842.py
... ... @@ -1,35 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
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   - ]
forum/templates/forum/forum_form.html.py 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +BBBB BBBBBB BBBB
  2 +BBBB BBBBBBBBBBBBB
  3 +
  4 +XXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXBB BBBBBBBB BBBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5 + BBBBBBBBBB
  6 + BBB BBBBB BB BBBB
  7 + XXXX XXXXXXXXXXXXXXXXX BB BBBBBBBBBBBBBB XXXXXXXXX BBBBB XXXXXXXXXXXXXX
  8 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBB
  9 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB
  10 + BBBB
  11 + XXXXXX XXXXXXXXXXXXXXX
  12 + BBBBBBBBBBBB BBBBB
  13 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  14 + BB BBBBBBBBBBBB
  15 + XXXX XXXXXXXXXXXX
  16 + XXX XX
  17 + XXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  18 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  19 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  20 + XXXXXXXXX
  21 + XXXX
  22 + BBB BBBBB BB BBBBBBBBBBBB
  23 + XXXXXXXXX
  24 + BBBBBB
  25 + XXXXX
  26 + XXXXXX
  27 + XXXXXX
  28 + BBBBB
  29 + BBBBB
  30 + XXXXXX
  31 + BBBBBB
  32 +XXXXXXX
0 33 \ No newline at end of file
... ...
forum/templates/forum/forum_list.html.py 0 → 100644
... ... @@ -0,0 +1,66 @@
  1 +BBBB BBBB BBBBBBBBBBBBBBB BBBBBBBBB
  2 +BBBB BBBBBBBBBBBBB
  3 +
  4 +XXXX XXXXXXXXXXXXXXXXXXXXXX
  5 + XXXX XXXXXXXXXXXXXXXXXXXXXXXX
  6 + XXXX
  7 +
  8 + XXXX XXXXXXXXXXXXXXXXXXX
  9 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBB BBBBBBBBBBBB BB BBBBBBBBB
  10 + BBBBBBBBBB
  11 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  12 + XX XXXXXXXXXX XXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
  13 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  14 + XXXX
  15 + XXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  16 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Edit') XXXXXXXXX
  17 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBB BBBBBBBBXX XXX X gettext(u'Are you sure you want to delete this forum?') XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Delete') XXXXXXXXX
  18 + XXXXX
  19 + XXXXXX
  20 + BBBBB
  21 + XXXXXX
  22 + XXXXX
  23 + XXXXXXX gettext(u'Description') XXXXX XXXXX
  24 + XXXXXXX gettext(u'Opened in') XXXXX XXXXX
  25 + XXXXXX
  26 +XXXXXX
  27 +
  28 +XXXX XXXXXXXXXXXXXXXX
  29 + BBBBBBBBBB BBBBBBB BBBBB
  30 +XXXXXX
  31 +
  32 +XXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  33 + BBBBBBBBBB
  34 + BBB BBBBB BB BBBB
  35 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBB
  36 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBB
  37 + BBBB
  38 + XXXX XXXXXXXXXXXXXXXXX BB BBBBBBBBBBBBBB XXXXXXXXX BBBBB XXXXXXXXXXXXXX
  39 + XXXX XXXXXXXXXXXXXXXXXXXX
  40 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB B BBBBBBBB
  41 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  42 + BB BBBBBBBBBBBB
  43 + XXXX XXXXXXXXXXXX
  44 + XXX XX
  45 + XXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  46 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  47 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  48 + XXXXXXXXX
  49 + XXXX
  50 + BBB BBBBB BB BBBBBBBBBBBB
  51 + XXXXXXXXX
  52 + BBBBBB
  53 + XXXXX
  54 + XXXXXX
  55 + XXXXXX
  56 + BBBBB
  57 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXX
  58 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXX XXXXXXXXXXXXXX
  59 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  60 + XXXXXXXXX
  61 + XXXXXXX
  62 + XXXXXX
  63 + XXXXXX
  64 + BBBBB
  65 + BBBBBB
  66 +XXXXXXX
0 67 \ No newline at end of file
... ...
forum/templates/forum/forum_view.html.py 0 → 100644
... ... @@ -0,0 +1,131 @@
  1 +BBBBBBB BBBBBBBBBBB
  2 +
  3 +BBBB BBBBBB BBBB BBBBBBBBBBBBBBB BBBBBBBBB
  4 +BBBB BBBBBBBBBBBBB
  5 +
  6 +BBBBB BBBBBBBBBB
  7 + XXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXBBBBBB BBBBBBBBBBBBBXXXXXXXXXXX
  8 +BBBBBBBB
  9 +
  10 +BBBBB BBBBBBBBBBB
  11 +
  12 + XXX XXXXXXXXXXXXXXXXXXX
  13 + XXXXXX XXXXXXBBB BBBBBBBBBBBXX gettext(u'Home') XXXXXXXXX
  14 + XXXXXX XXXXXXBBB BBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBXXXXXXXXXXX
  15 + BB BBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBBBBBBBBBBBBBB
  16 + XXX XXXXXXXXXXXXXXX gettext(u'Forum') XXXXX
  17 + BBBB
  18 + XXX XXXXXXXXXXXXXXXXXXXX
  19 + BBBBB
  20 +
  21 + XXXXX
  22 +BBBBBBBB
  23 +
  24 +BBBBB BBBBBBB
  25 + XXXX XXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXX
  26 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  27 + XXXX gettext(u'Menu') XXXXX
  28 + XXXXXX
  29 + XXXX XXXXXXXXXXXXXXXXXXX
  30 + XXX XXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXX
  31 + XXXXXX XXXXXXBBB BBBBBBBBBBBBBBBXX gettext(u'Profile') XXXXXXXXX
  32 + XXXXXX XXXXXXBBB BBBBBBBBBBBBBBBXX gettext(u'My Courses') XXXXXXXXX
  33 + XXXXX
  34 + XXXXXX
  35 + XXXXXX
  36 +
  37 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBB BBBBBBBBBBBB BB BBBBBBBBB
  38 + XXXX XXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXX
  39 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  40 + XXX XXXXXXXXXXXXXXXXXXXX gettext(u'Actions') XXXXX
  41 + XXXXXX
  42 + XXXX XXXXXXXXXXXXXXXXXXX
  43 + XXX XXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXX
  44 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBB BBBBBBBBXX XXX X gettext(u'Forum edited successfully!') XXXX gettext(u'Edit') XXXXXXXXX
  45 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBB BBBBBBBBXX XXX X gettext(u'Are you sure you want to delete this forum?') XX XBBB BBBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBXXXX gettext(u'Delete') XXXXXXXXX
  46 + XXXXX
  47 + XXXXXX
  48 + XXXXXX
  49 + BBBBB
  50 +BBBBBBBB
  51 +
  52 +BBBBB BBBBBBB
  53 + XXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX
  54 + XXXX XXXXXXXXXXXXXXXXXXX
  55 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  56 + XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX
  57 + XXXXXXXXX
  58 + XXXXXXX gettext(u'Description') XXXXX XXXXX
  59 + XXXXXXX gettext(u'Opened in') XXXXX XXXXX
  60 + XXXXXX
  61 + XXXXXX
  62 + XXXX XXXXXXXXXXXXXXXXXXXXXXXX
  63 + XXX XX
  64 + XXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  65 + BBBBBBBBBB
  66 + BBB BBBBB BB BBBB
  67 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBB
  68 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBB
  69 + BBBB
  70 + XXXX XXXXXXXXXXXXXXXXX BB BBBBBBBBBBBBBB XXXXXXXXX BBBBB XXXXXXXXXXXXXX
  71 + XXXX XXXXXXXXXXXXXXXXXXXX
  72 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB B BBBBBBBB
  73 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  74 + BB BBBBBBBBBBBB
  75 + XXXX XXXXXXXXXXXX
  76 + XXX XX
  77 + XXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  78 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  79 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  80 + XXXXXXXXX
  81 + XXXX
  82 + BBB BBBBB BB BBBBBBBBBBBB
  83 + XXXXXXXXX
  84 + BBBBBB
  85 + XXXXX
  86 + XXXXXX
  87 + XXXXXX
  88 + BBBBB
  89 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXX
  90 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXX XXXXXXXXXXXXXX
  91 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  92 + XXXXXXXXX
  93 + XXXXXXX
  94 + XXXXXX
  95 + XXXXXX
  96 + BBBBB
  97 + BBBBBB
  98 + XXXXXXX
  99 + XXX XX
  100 + XXXXXX
  101 + XXXX XXXXXXXXXXXXXXXX
  102 + BBBBBBBBBB BBBBBBB BBBBB
  103 + XXXXXX
  104 + XXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXX
  105 + XXXXXXXX
  106 + XXXXX XXXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  107 + XXXXXXXXX
  108 + XXXXXX
  109 + XXXXXX
  110 + XXXXXX
  111 + XXXX XXXXX XX XXXX XXXXX XXXX XXXX XXX
  112 + XXXX XXXXXXXXXXXX XXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  113 + XXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  114 + XXXX XXXXXXXXXXXXXXXXXXXXXX
  115 + XXXX XXXXXXXXXXXXXXXXXXXXX
  116 + XXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX gettext(u'Forum') XXXXX
  117 + XXXXXX
  118 + XXXX XXXXXXXXXXXXXXXXXXX
  119 + XXXXXXXXX
  120 + XXXX XXXXXXXXXXXXXXXXXXXXXXXXX
  121 + XXXXXXXXXX
  122 + XXXXXX
  123 + XXXX XXXXXXXXXXXXXXXXXXXXX
  124 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX gettext(u'Close') XXXXXXXXX
  125 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXX gettext(u'Update') XXXXXXXXX
  126 + XXXXXX
  127 + XXXXXX
  128 + XXXXXX
  129 + XXXXXX
  130 +BBBBBBBB
  131 +
... ...
forum/templates/forum/render_forum.html.py 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +BBBB BBBB
  2 +
  3 +XXXXXXXXX
  4 +XXXXXXX gettext(u'Description') XXXXX XXXXX
  5 +XXXXXXX gettext(u'Opened in') XXXXX XXXXX
0 6 \ No newline at end of file
... ...
forum/templates/post/post_list.html.py 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +BBBB BBBB BBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
  2 +
  3 +BB BBBBBBBBBBBB B B
  4 + BBB BBBB BB BBBBB
  5 + XXXX XXXXXXXXXXXX
  6 + XXXX XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXX
  7 + XXX XXXXXXXXXXXXXXXXXX
  8 +
  9 + XXXX XXXXXXXXXXXXXXXXXXX
  10 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXX XBBB BBBBBBBBBBBBBBBBBBBBBBBBBXXXXX
  11 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  12 + XXXX
  13 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBB BB BBBBBBBBB
  14 + BBBBBBBBBB
  15 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  16 + XX XXXXXXXXXX XXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
  17 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  18 + XXXX
  19 + XXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  20 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBXX XXX X gettext(u'Post edited successfully!') XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Edit') XXXXXXXXX
  21 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Remove') XXXXXXXXX
  22 + XXXXX
  23 + XXXXXX
  24 + BBBBB
  25 + XXXXXX
  26 + XXXXX
  27 + XXXX XXXXXXXXXXXXXXXXXXXXX
  28 + XXXX XXXXXXXXXXXXXXXXXX
  29 + XX XXXXXXXXXXXXXXXXXXXXX
  30 + XX XXXXXXXXX XXXXXXXXXXXXXXXX FFFFFFFFF gettext(u'ago')
  31 + BB BBBBBBBBBBBBBBBB
  32 + XXXX X gettext(u'Edited') XXXXX
  33 + BBBBB
  34 + XXXX
  35 + XXXXXX
  36 + XX XXXXXXXXXXXXXXXXXXXXXFFFFFFFFFFXXXX
  37 + XXXXXX
  38 + XXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  39 + XXXX XXXXXXXXXXXXXXXXXXXX
  40 + BBBBBBBBBBBBBBBB BBBBBBB BBBB
  41 + XXXXXX
  42 + XXXX XXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXX
  43 + XXXXXXXX
  44 + XXXXX XXXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  45 + XXXXXXXXX
  46 + XXXXXX
  47 + XXXXXX
  48 + XXXXXX
  49 + BBBBBB
  50 +BBBBB
  51 +
  52 +BB BBB BBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBBBBB
  53 + XX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X XBBB BBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX
  54 + gettext(u'Load more posts')
  55 + XXXX
  56 +BBBBB
0 57 \ No newline at end of file
... ...
forum/templates/post/post_render.html
... ... @@ -15,7 +15,7 @@
15 15 <i class="material-icons">more_horiz</i>
16 16 </a>
17 17 <ul class="dropdown-menu pull-right" aria-labelledby="dropdownMenu1">
18   - <li><a href="javascript:edit_post('{% url 'course:forum:update_post' post.id %}', '{{ post.id }}', '{% trans 'Post edited successfully!' %}')"></li>
  18 + <li><a href="javascript:edit_post('{% url 'course:forum:update_post' post.id %}', '{{ post.id }}', '{% trans 'Post edited successfully!' %}')"><i class="material-icons">create</i> {% trans 'Edit' %}</a></li>
19 19 <li><a href="javascript:delete_post('{% url 'course:forum:delete_post' post.id %}', '{{ post.id }}')"><i class="material-icons">delete_sweep</i> {% trans 'Remove' %}</a></li>
20 20 </ul>
21 21 </div>
... ... @@ -26,7 +26,7 @@
26 26 <div class="card-data">
27 27 <p class="comment-date">
28 28 <i class="fa fa-clock-o"></i> {{ post.post_date|timesince }} {% trans 'ago' %}
29   - {% if post.post_date != post.modifiction_date %}
  29 + {% if post.is_modified %}
30 30 <em> - {% trans 'Edited' %}</em>
31 31 {% endif %}
32 32 </p>
... ...
forum/templates/post/post_render.html.py 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +BBBB BBBB BBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
  2 +
  3 +XXXX XXXXXXXXXXXX
  4 + XXXX XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXX
  5 + XXX XXXXXXXXXXXXXXXXXX
  6 +
  7 + XXXX XXXXXXXXXXXXXXXXXXX
  8 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXX XBBB BBBBBBBBBBBBBBBBBBBBBBBBBXXXXX
  9 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  10 + XXXX
  11 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBB BBBBBBBBBBBB BB BBBBBBBBB
  12 + BBBBBBBBBB
  13 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  14 + XX XXXXXXXXXX XXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
  15 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  16 + XXXX
  17 + XXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  18 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBXX XXX X gettext(u'Post edited successfully!') XXXXXXXXX
  19 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Remove') XXXXXXXXX
  20 + XXXXX
  21 + XXXXXX
  22 + BBBBB
  23 + XXXXXX
  24 + XXXXX
  25 + XXXX XXXXXXXXXXXXXXXXXXXXX
  26 + XXXX XXXXXXXXXXXXXXXXXX
  27 + XX XXXXXXXXXXXXXXXXXXXXX
  28 + XX XXXXXXXXX XXXXXXXXXXXXXXXX FFFFFFFFF gettext(u'ago')
  29 + BB BBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBBBBBBB
  30 + XXXX X gettext(u'Edited') XXXXX
  31 + BBBBB
  32 + XXXX
  33 + XXXXXX
  34 + XX XXXXXXXXXXXXXXXXXXXXXFFFFFFFFFFXXXX
  35 + XXXXXX
  36 + XXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  37 + XXXX XXXXXXXXXXXXXXXXXXXX
  38 + BBBBBBBBBBBBBBBB BBBBBBB BBBB
  39 + XXXXXX
  40 + XXXXXX
  41 +XXXXXX
0 42 \ No newline at end of file
... ...
forum/templates/post/post_update_form.html.py 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +BBBB BBBB BBBBBBBBBBBBBBB BBBBBBBBB
  2 +BBBB BBBBBBBBBBBBB
  3 +
  4 +XXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5 + BBBBBBBBBB
  6 + BBB BBBBB BB BBBB
  7 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBB
  8 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB
  9 + BBBB
  10 + XXXX XXXXXXXXXXXXXXXXX BB BBBBBBBBBBBBBB XXXXXXXXX BBBBB XXXXXXXXXXXXXX
  11 + XXXX XXXXXXXXXXXXXXXXXXXX
  12 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB B BBBBBBBB
  13 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  14 + BB BBBBBBBBBBBB
  15 + XXXX XXXXXXXXXXXX
  16 + XXX XX
  17 + XXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  18 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  19 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  20 + XXXXXXXXX
  21 + XXXX
  22 + BBB BBBBB BB BBBBBBBBBBBB
  23 + XXXXXXXXX
  24 + BBBBBB
  25 + XXXXX
  26 + XXXXXX
  27 + XXXXXX
  28 + BBBBB
  29 + XXXXXX
  30 + XXXXXX
  31 + XXXX XXXXXXXXXXXXXXXXXXX
  32 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX gettext(u'Cancel') XXXXXXXXX
  33 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXX gettext(u'Save changes') XXXXXXXXX
  34 + XXXXXX
  35 + BBBBB
  36 + BBBBBB
  37 +XXXXXXX
0 38 \ No newline at end of file
... ...
forum/templates/post_answers/post_answer_form.html.py 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +BBBB BBBBBB BBBB
  2 +BBBB BBBBBBBBBBBBB
  3 +
  4 +XXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXBB BBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5 + BBBBBBBBBB
  6 + BBB BBBBB BB BBBB
  7 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBB
  8 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB
  9 + BBBB
  10 + XXXX XXXXXXXXXXXXXXXXX BB BBBBBBBBBBBBBB XXXXXXXXX BBBBB XXXXXXXXXXXXXX
  11 + XXXX XXXXXXXXXXXXXXXXXXXX
  12 + XXXXXX XXXXXXXXXXXXXXX
  13 + BBBBBBBBBBBB BBBBB BBBBBBBBBBBBBBBBBBBB
  14 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
  15 + BB BBBBBBBBBBBB
  16 + XXXX XXXXXXXXXXXX
  17 + XXX XX
  18 + XXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
  19 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
  20 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  21 + XXXXXXXXX
  22 + XXXX
  23 + BBB BBBBB BB BBBBBBBBBBBB
  24 + XXXXXXXXX
  25 + BBBBBB
  26 + XXXXX
  27 + XXXXXX
  28 + XXXXXX
  29 + BBBBB
  30 + BB BBBBBB
  31 + XXXX XXXXXXXXXXXXXXXXXXX
  32 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXX gettext(u'Cancel') XXXXXXXXX
  33 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXX gettext(u'Save changes') XXXXXXXXX
  34 + XXXXXX
  35 + BBBB
  36 + XXXXX XXXXXXXXXXXXXXXXXXXXXXXX
  37 + XXXXXXX XXXXXXXXXXXXX XXXXXXXXXX XXXXXXX XXXXXXXXXXXXXX
  38 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  39 + XXXXXXXXX
  40 + XXXXXXX
  41 + BBBBB
  42 + XXXXXX
  43 + XXXXXX
  44 + BBBBB
  45 + BBBBBB
  46 +XXXXXXX
0 47 \ No newline at end of file
... ...
forum/templates/post_answers/post_answer_list.html.py 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +BBBB BBBB BBBBBBBBBBBBBBB
  2 +
  3 +BB BBBBBBBBBBBBBB B B
  4 + BBB BBBBBB BB BBBBBBB
  5 + XXXXX
  6 + XXXX XXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX
  7 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXX
  8 + XXX XXXXXXXXXXXXXXXXXX
  9 +
  10 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBB BB BBBBBBBBBBB
  11 + XXXX XXXXXXXXXXXXXXXXXXX
  12 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  13 + XX XXXXXXXXXX XXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
  14 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  15 + XXXX
  16 + XXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  17 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBXX XXX X gettext(u'Answer edited sucessfully!') XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Edit') XXXXXXXXX
  18 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBXX XXX X gettext(u'Are you sure you want to delete this answer?') XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Remove') XXXXXXXXX
  19 + XXXXX
  20 + XXXXXX
  21 + XXXXXX
  22 + BBBBB
  23 + XXXXX
  24 + XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
  25 + XXXX XXXXXXXXXXXXXXXXXX
  26 + XX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXX FFFFFFFFF gettext(u'ago')
  27 + BB BBBBBBBBBBBBBBBBBB
  28 + XXXX X gettext(u'Edited') XXXXX
  29 + BBBBB
  30 + XXXX
  31 + XXXXXX
  32 + XX XXXXXXXXXXXXXXXXXXXXXFFFFFFFFFFXXXX
  33 + XXXXXX
  34 + XXXXXX
  35 + XXXXXX
  36 + XXXXXX
  37 + BBBBBB
  38 +BBBBB
  39 +
  40 +BB BBB BBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBBBBB
  41 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X XBBB BBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXX
  42 + gettext(u'Load more answers')
  43 + XXXX
  44 +BBBBB
0 45 \ No newline at end of file
... ...
forum/templates/post_answers/post_answer_render.html.py 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +BBBB BBBB BBBBBBBBBBBBBBB
  2 +
  3 +XXXXX
  4 + XXXX XXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX
  5 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXX
  6 + XXX XXXXXXXXXXXXXXXXXX
  7 +
  8 + BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBB BB BBBBBBBBBBB
  9 + XXXX XXXXXXXXXXXXXXXXXXX
  10 + XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX
  11 + XX XXXXXXXXXX XXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
  12 + XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  13 + XXXX
  14 + XXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  15 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBXX XXX X gettext(u'Answer edited sucessfully!') XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Edit') XXXXXXXXX
  16 + XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBXX XXX X gettext(u'Are you sure you want to delete this answer?') XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Remove') XXXXXXXXX
  17 + XXXXX
  18 + XXXXXX
  19 + XXXXXX
  20 + BBBBB
  21 + XXXXX
  22 + XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
  23 + XXXX XXXXXXXXXXXXXXXXXX
  24 + XX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXX FFFFFFFFF gettext(u'ago')
  25 + BB BBBBBBBBBBBBBBBBBB
  26 + XXXX X gettext(u'Edited') XXXXX
  27 + BBBBB
  28 + XXXX
  29 + XXXXXX
  30 + XX XXXXXXXXXXXXXXXXXXXXXFFFFFFFFFFXXXX
  31 + XXXXXX
  32 + XXXXXX
  33 + XXXXXX
  34 +XXXXXX
0 35 \ No newline at end of file
... ...
forum/views.py
... ... @@ -9,8 +9,11 @@ from django.http import Http404
9 9  
10 10 from .models import Forum, Post, PostAnswer
11 11 from courses.models import Topic
  12 +from core.mixins import NotificationMixin
  13 +from core.models import Action, Resource
12 14  
13 15 from .forms import ForumForm, PostForm, PostAnswerForm
  16 +from django.urls import reverse
14 17  
15 18 """
16 19 Forum Section
... ... @@ -36,7 +39,7 @@ class ForumIndex(LoginRequiredMixin, generic.ListView):
36 39  
37 40 return context
38 41  
39   -class CreateForumView(LoginRequiredMixin, generic.edit.CreateView):
  42 +class CreateForumView(LoginRequiredMixin, generic.edit.CreateView, NotificationMixin):
40 43 login_url = reverse_lazy("core:home")
41 44 redirect_field_name = 'next'
42 45  
... ... @@ -52,6 +55,11 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView):
52 55 def get_success_url(self):
53 56 self.success_url = reverse('course:forum:render_forum', args = (self.object.id, ))
54 57  
  58 +
  59 + action = super(CreateForumView, self).createorRetrieveAction("create Topic")
  60 + super(CreateForumView, self).createNotification("Forum "+ self.object.name + " was created",
  61 + resource_name=self.object.name, resource_link= reverse('course:forum:view', args=[self.object.slug]),
  62 + actor=self.request.user, users = self.object.topic.subject.students.all() )
55 63 return self.success_url
56 64  
57 65 def render_forum(request, forum):
... ... @@ -144,7 +152,7 @@ def load_posts(request, forum_id):
144 152  
145 153 return render(request, 'post/post_list.html', context)
146 154  
147   -class CreatePostView(LoginRequiredMixin, generic.edit.CreateView):
  155 +class CreatePostView(LoginRequiredMixin, generic.edit.CreateView, NotificationMixin):
148 156 login_url = reverse_lazy("core:home")
149 157 redirect_field_name = 'next'
150 158  
... ... @@ -155,6 +163,8 @@ class CreatePostView(LoginRequiredMixin, generic.edit.CreateView):
155 163 self.object.user = self.request.user
156 164  
157 165 self.object.save()
  166 + super(CreatePostView, self).createNotification(self.object.user.username + " posted on " + self.object.forum,name,
  167 + resource_slug = self.object.forum.slug, actor=self.request.user, users= self.object.forum.topic.subject.students.all())
158 168  
159 169 return super(CreatePostView, self).form_valid(form)
160 170  
... ...
links/migrations/0001_initial.py
1 1 # -*- coding: utf-8 -*-
2   -# Generated by Django 1.10 on 2016-10-18 21:42
  2 +# Generated by Django 1.10 on 2016-10-22 04:32
3 3 from __future__ import unicode_literals
4 4  
5 5 from django.db import migrations, models
... ... @@ -23,8 +23,8 @@ class Migration(migrations.Migration):
23 23 ('link_description', models.CharField(max_length=200)),
24 24 ],
25 25 options={
26   - 'verbose_name': 'Link',
27 26 'verbose_name_plural': 'Links',
  27 + 'verbose_name': 'Link',
28 28 },
29 29 bases=('courses.material',),
30 30 ),
... ...
links/static/links.js
1 1 function get_modal_link(url, id,div_content){
2 2 $.get(url, function (data) {
3   - //alert(data);
4   - // $(div_content).empty();
5   - // $(div_content).append(data);
  3 + $(div_content).empty();
  4 + $(div_content).append(data);
6 5 $(id).modal('show');
7 6 });
8 7  
... ...
links/templates/links/create_link.html
  1 +{% load widget_tweaks i18n %}
  2 +
1 3 <!--MODAL CREATE LINK-->
2   -<div class="modal fade" id="createLinksModal" tabindex="-1" role="dialog" aria-labelledby="createLink" style="display: none;">
  4 +<div class="modal fade" id="createLinksModal" tabindex="-1" role="dialog" aria-labelledby="createLink">
3 5 <div class="modal-dialog" role="document">
4 6 <div class="modal-content">
5 7 <div class="modal-header">
... ... @@ -8,25 +10,59 @@
8 10 </div>
9 11 <div class="modal-body">
10 12 <!-- Card -->
11   - <div class="form-group is-empty">
12   - <label class="control-label" for="inputDefault">Name</label>
13   - <input type="text" class="form-control" id="inputDefault">
14   - </div>
15   - <div class="form-group is-empty">
16   - <label class="control-label" for="inputDefault">Url</label>
17   - <input type="text" class="form-control" id="inputDefault">
18   - </div>
19   - <div class="form-group is-empty">
20   - <label class="control-label" for="inputDefault">Descrição</label>
21   - <textarea class="form-control" rows="3"></textarea>
22   - </div>
  13 + <form method="post" action="" id="form-link" enctype="multipart/form-data">
  14 + {% csrf_token %}
  15 + {% if messages %}
  16 + {% for message in messages %}
  17 + <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert">
  18 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  19 + <span aria-hidden="true">&times;</span>
  20 + </button>
  21 + <p>{{ message }}</p>
  22 + </div>
  23 + {% endfor %}
  24 + {% endif %}
  25 + {% for field in form %}
  26 + {% if field.field.required %}
  27 + <label for="{{ field.auto_id }}">{{ field.label }}<span>*</span></label>
  28 + {% else %}
  29 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
  30 + {% endif %}
  31 + {% render_field field class='form-control' %}
  32 + {% endfor %}
23 33 <div class="form-group">
24 34 <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">Cancel</a>
25   - <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a>
26   - </div>
  35 + <button class="btn btn-raised btn-primary" type="submit">Submit</button>
  36 + </div>
27 37 <!-- .end Card -->
28 38 </div>
29 39 </div>
30 40 </div>
31 41 </div>
32 42 <!-- EndModal -->
  43 +
  44 +{# // <script src="{% static '/links.js' %}"></script> #}
  45 +<script type="text/javascript">
  46 + $("#form-link").submit(function(event) {
  47 + var data = new FormData($('#form-link').get(0));
  48 + $.ajax({
  49 + url: "{% url 'course:links:create_link' topic.slug %}",
  50 + type: $("#form-link").attr('method'),
  51 + data: data,
  52 + cache: false,
  53 + processData: false,
  54 + contentType: false,
  55 + success: function(data) {
  56 + $('#createLinksModal').modal('hide');
  57 + $('#list-topic{{ topic.id }}-links').append(data);
  58 + $('#list-topic{{ topic.id }}-links-edit').append(data);
  59 + },
  60 + error: function(data){
  61 + $('.erro').html(data.responseText);
  62 + $('.modal-backdrop').remove();
  63 + $('#createLinksModal').modal();
  64 + }
  65 + });
  66 + event.preventDefault();
  67 + });
  68 +</script>
... ...