Commit 3571e6d321c39a161659c6a72d7a6fe9329c10a4
Exists in
master
and in
5 other branches
Merge
Showing
12 changed files
with
145 additions
and
33 deletions
Show diff stats
courses/templates/subject/form_view_teacher.html
1 | -{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises%} | 1 | +{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises %} |
2 | 2 | ||
3 | <div class="panel panel-default cards-detail"> | 3 | <div class="panel panel-default cards-detail"> |
4 | <div class="panel-heading topic"> | 4 | <div class="panel-heading topic"> |
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | 56 | ||
57 | {# materiais do topico#} | 57 | {# materiais do topico#} |
58 | <div class="row"> | 58 | <div class="row"> |
59 | - <div class="col-xs-4 col-md-4"> | 59 | + <div class="col-xs-6 col-md-6"> |
60 | <div class="resource_inline"> | 60 | <div class="resource_inline"> |
61 | <h4>{% trans 'Material' %}</h4> | 61 | <h4>{% trans 'Material' %}</h4> |
62 | </div> | 62 | </div> |
@@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
90 | </div> | 90 | </div> |
91 | 91 | ||
92 | {# avaliações do topico #} | 92 | {# avaliações do topico #} |
93 | - <div class="col-xs-4 col-md-4"> | 93 | + <div class="col-xs-6 col-md-6"> |
94 | <div class="resource_inline"> | 94 | <div class="resource_inline"> |
95 | <h4>{% trans 'Activities' %}</h4> | 95 | <h4>{% trans 'Activities' %}</h4> |
96 | </div> | 96 | </div> |
@@ -101,8 +101,8 @@ | @@ -101,8 +101,8 @@ | ||
101 | <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> | 101 | <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> |
102 | <ul class="dropdown-menu" aria-labelledby="dLabel"> | 102 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
103 | <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}</a></li> | 103 | <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}</a></li> |
104 | - | ||
105 | <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#requisicoes_ajax');">{% trans 'Create Poll' %}</a></li> | 104 | <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#requisicoes_ajax');">{% trans 'Create Poll' %}</a></li> |
105 | + <li><a href="javascript:modal.get('{% url 'course:exercise:create_exercise' topic.slug %}', '#createExercisesModal','#requisicoes_ajax')">{% trans 'Delivery Material' %}</a></li> | ||
106 | </ul> | 106 | </ul> |
107 | </div> | 107 | </div> |
108 | </div> | 108 | </div> |
@@ -112,6 +112,7 @@ | @@ -112,6 +112,7 @@ | ||
112 | <ul> | 112 | <ul> |
113 | {% list_topic_poll request topic %} | 113 | {% list_topic_poll request topic %} |
114 | {% list_topic_foruns request topic %} | 114 | {% list_topic_foruns request topic %} |
115 | + {% list_topic_exercise request topic %} | ||
115 | </ul> | 116 | </ul> |
116 | </div> | 117 | </div> |
117 | <div class="editation editation_{{topic.slug}}"> | 118 | <div class="editation editation_{{topic.slug}}"> |
@@ -122,19 +123,14 @@ | @@ -122,19 +123,14 @@ | ||
122 | {% list_topic_foruns request topic %} | 123 | {% list_topic_foruns request topic %} |
123 | </ul> | 124 | </ul> |
124 | </div> | 125 | </div> |
125 | - </div> | ||
126 | - <div class="resource_inline"> | ||
127 | - <h4>{% trans 'Exercises' %}</h4> | ||
128 | - </div> | ||
129 | - <div class="resource_inline"> | ||
130 | - {# dropdown de create exercício #} | ||
131 | - <div class="dropdown"> | ||
132 | - <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> | ||
133 | - <ul class="dropdown-menu" aria-labelledby="dLabel"> | ||
134 | - <li><a href="javascript:modal.get('{% url 'course:exercise:create_exercise' topic.slug %}', '#createExercisesModal','#requisicoes_ajax')">{% trans 'Create a general exercise' %}</a></li> | ||
135 | - </ul> | ||
136 | - </div> | 126 | + <div class="editation editation_{{topic.slug}}"> |
127 | + | ||
128 | + {# exercícios do tópico no modo de edição #} | ||
129 | + <ul> | ||
130 | + {% list_topic_exercise_edit request topic %} | ||
131 | + </ul> | ||
137 | </div> | 132 | </div> |
133 | + </div> | ||
138 | </div> | 134 | </div> |
139 | 135 | ||
140 | {# opções de cancelar e editar no modo de edição #} | 136 | {# opções de cancelar e editar no modo de edição #} |
exercise/forms.py
@@ -7,15 +7,26 @@ import requests | @@ -7,15 +7,26 @@ import requests | ||
7 | 7 | ||
8 | class ExerciseForm(forms.ModelForm): | 8 | class ExerciseForm(forms.ModelForm): |
9 | 9 | ||
10 | + def __init__(self, *args, **kwargs): | ||
11 | + super(ExerciseForm, self).__init__(*args, **kwargs) | ||
12 | + self.fields["allowed"].required = False | ||
13 | + self.fields["allowed"].initial = False | ||
14 | + | ||
15 | + # def clean_allowed(self): | ||
16 | + # if('allowed' in self.data): | ||
17 | + # allowed = self.data['allowed'] | ||
18 | + # raise forms.ValidationError(_('It is required one these fields.')) | ||
19 | + # return True | ||
20 | + | ||
10 | class Meta: | 21 | class Meta: |
11 | model = Exercise | 22 | model = Exercise |
12 | - fields = ['name_exercise', 'description', 'init_date', | ||
13 | - 'end_date', 'file'] | 23 | + fields = ['name_exercise', 'description', |
24 | + 'end_date', 'file', 'allowed'] | ||
14 | 25 | ||
15 | 26 | ||
16 | class UpdateExerciseForm(forms.ModelForm): | 27 | class UpdateExerciseForm(forms.ModelForm): |
17 | 28 | ||
18 | class Meta: | 29 | class Meta: |
19 | model = Exercise | 30 | model = Exercise |
20 | - fields = ['name_exercise', 'description', 'init_date', | ||
21 | - 'end_date', 'grade', 'file'] | 31 | + fields = ['name_exercise', 'description', |
32 | + 'end_date', 'file'] |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-21 12:22 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('exercise', '0003_auto_20161118_2242'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.RemoveField( | ||
16 | + model_name='exercise', | ||
17 | + name='init_date', | ||
18 | + ), | ||
19 | + migrations.AlterField( | ||
20 | + model_name='exercise', | ||
21 | + name='end_date', | ||
22 | + field=models.DateField(verbose_name='Delivery Date'), | ||
23 | + ), | ||
24 | + ] |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-21 12:50 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('exercise', '0004_auto_20161121_0922'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.AddField( | ||
16 | + model_name='exercise', | ||
17 | + name='allowed', | ||
18 | + field=models.BooleanField(default=False, verbose_name='Allowed delivery after end date?'), | ||
19 | + ), | ||
20 | + ] |
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-21 13:08 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | +import exercise.models | ||
7 | + | ||
8 | + | ||
9 | +class Migration(migrations.Migration): | ||
10 | + | ||
11 | + dependencies = [ | ||
12 | + ('exercise', '0005_exercise_allowed'), | ||
13 | + ] | ||
14 | + | ||
15 | + operations = [ | ||
16 | + migrations.AlterField( | ||
17 | + model_name='exercise', | ||
18 | + name='file', | ||
19 | + field=models.FileField(upload_to=exercise.models.file_path, verbose_name='File'), | ||
20 | + ), | ||
21 | + ] |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-21 13:19 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('exercise', '0006_auto_20161121_1008'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.AlterField( | ||
16 | + model_name='exercise', | ||
17 | + name='file', | ||
18 | + field=models.FileField(upload_to='uploads/%Y/%m/%d'), | ||
19 | + ), | ||
20 | + ] |
exercise/models.py
@@ -23,14 +23,14 @@ class Exercise(models.Model): | @@ -23,14 +23,14 @@ class Exercise(models.Model): | ||
23 | 23 | ||
24 | name_exercise = models.CharField(_('Name'), max_length=100) | 24 | name_exercise = models.CharField(_('Name'), max_length=100) |
25 | description = models.TextField(_('Description'), blank=True) | 25 | description = models.TextField(_('Description'), blank=True) |
26 | - init_date = models.DateField(_('Begin of Subject Date')) | ||
27 | - end_date = models.DateField(_('End of Subject Date')) | 26 | + end_date = models.DateField(_('Delivery Date')) |
28 | grade = models.DecimalField(max_digits=20, decimal_places=2, default=Decimal('0.00'), null=True) | 27 | grade = models.DecimalField(max_digits=20, decimal_places=2, default=Decimal('0.00'), null=True) |
29 | topic = models.ForeignKey(Topic, verbose_name=_('Topic'), related_name='exercise_topic') | 28 | topic = models.ForeignKey(Topic, verbose_name=_('Topic'), related_name='exercise_topic') |
30 | professors = models.ManyToManyField(User, verbose_name=_('Professors'), related_name='professors_exercise', blank=True) | 29 | professors = models.ManyToManyField(User, verbose_name=_('Professors'), related_name='professors_exercise', blank=True) |
31 | students = models.ManyToManyField(User, verbose_name=_('Students'), related_name='subject_exercise', blank = True) | 30 | students = models.ManyToManyField(User, verbose_name=_('Students'), related_name='subject_exercise', blank = True) |
32 | file = models.FileField(upload_to='uploads/%Y/%m/%d') | 31 | file = models.FileField(upload_to='uploads/%Y/%m/%d') |
33 | file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='exercise_type',null=True) | 32 | file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='exercise_type',null=True) |
33 | + allowed = models.BooleanField(_('Allowed delivery after end date?'), default=False) | ||
34 | 34 | ||
35 | def __str__(self): | 35 | def __str__(self): |
36 | - return self.name_exercise | ||
37 | \ No newline at end of file | 36 | \ No newline at end of file |
37 | + return self.name_exercise |
exercise/templates/exercise/card_topic_exercises.html
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <center><legend>{{exercise.name_exercise}}</legend></center> | 8 | <center><legend>{{exercise.name_exercise}}</legend></center> |
9 | <div class="container-fluid"> | 9 | <div class="container-fluid"> |
10 | <div class="form-group"> | 10 | <div class="form-group"> |
11 | - <label class="col-md-2 col-xs-2 col-sm-2 control-label">Describe: </label><br> | 11 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">{% trans 'Description' %}: </label><br> |
12 | {% if exercise.description%} | 12 | {% if exercise.description%} |
13 | {{exercise.description}} | 13 | {{exercise.description}} |
14 | {% else %} | 14 | {% else %} |
@@ -16,15 +16,14 @@ | @@ -16,15 +16,14 @@ | ||
16 | {% endif %} | 16 | {% endif %} |
17 | </div> | 17 | </div> |
18 | <div class="form-group"> | 18 | <div class="form-group"> |
19 | - <label class="col-md-2 col-xs-2 col-sm-2 control-label">Opening: </label><br>{{exercise.init_date}} | ||
20 | 19 | ||
21 | </div> | 20 | </div> |
22 | <div class="form-group"> | 21 | <div class="form-group"> |
23 | - <label class="col-md-2 col-xs-2 col-sm-2 control-label">Ending: </label><br>{{exercise.end_date}} | 22 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">{% trans 'Delivery Date' %}: </label><br>{{exercise.end_date}} |
24 | 23 | ||
25 | </div> | 24 | </div> |
26 | <div class="form-group"> | 25 | <div class="form-group"> |
27 | - <label for="nota" class="col-md-2 control-label">NOTA: | 26 | + <label for="nota" class="col-md-2 control-label">{% trans 'Grade' %}: |
28 | {% if exercise.grade %} | 27 | {% if exercise.grade %} |
29 | <div class="col-md-4"> | 28 | <div class="col-md-4"> |
30 | <p id="nota" class="form-control"> | 29 | <p id="nota" class="form-control"> |
exercise/templates/exercise/create_exercise.html
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <div class="modal-content"> | 5 | <div class="modal-content"> |
6 | <div class="modal-header"> | 6 | <div class="modal-header"> |
7 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | 7 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
8 | - <h4 class="modal-title" id="createExercise">{% trans 'Create a New Exercise' %}</h4> | 8 | + <h4 class="modal-title" id="createExercise">{% trans 'Create a New Material' %}</h4> |
9 | </div> | 9 | </div> |
10 | <div class="modal-body"> | 10 | <div class="modal-body"> |
11 | <!-- Card --> | 11 | <!-- Card --> |
@@ -41,10 +41,10 @@ | @@ -41,10 +41,10 @@ | ||
41 | </span> | 41 | </span> |
42 | </div> | 42 | </div> |
43 | {% else %} | 43 | {% else %} |
44 | - {% render_field field class='form-control input-sm' %} | ||
45 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | 44 | + {% render_field field class='form-control input-sm' %} |
45 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | ||
46 | {% endif %} | 46 | {% endif %} |
47 | - </div> | 47 | + </div> |
48 | 48 | ||
49 | {% if field.errors %} | 49 | {% if field.errors %} |
50 | <div class="alert alert-danger alert-dismissible clearfix" role="alert"> | 50 | <div class="alert alert-danger alert-dismissible clearfix" role="alert"> |
@@ -97,6 +97,7 @@ | @@ -97,6 +97,7 @@ | ||
97 | $('#list-topic{{ topic.id }}-exercises').append(data); | 97 | $('#list-topic{{ topic.id }}-exercises').append(data); |
98 | $('#list-topic{{ topic.id }}-exercises-edit').append(data); | 98 | $('#list-topic{{ topic.id }}-exercises-edit').append(data); |
99 | alertify.success('Exercise successfully created!') | 99 | alertify.success('Exercise successfully created!') |
100 | + setTimeout(function () { location.reload(1); }, 1000); | ||
100 | }, | 101 | }, |
101 | error: function(data){ | 102 | error: function(data){ |
102 | $('#requisicoes_ajax').empty(); | 103 | $('#requisicoes_ajax').empty(); |
exercise/templates/exercise/exercise_edit.html
@@ -2,6 +2,6 @@ | @@ -2,6 +2,6 @@ | ||
2 | <div id="exercise-topic{{ topic.id }}-exercises-edit"> | 2 | <div id="exercise-topic{{ topic.id }}-exercises-edit"> |
3 | {% for exercise in exercises %} | 3 | {% for exercise in exercises %} |
4 | <li class="icon_edit_remove" id = "exercise_edit_icon_{{ exercise.slug }}"> <a href="javascript:modal.get('', '#exercisesModalEdit', '#requisicoes_ajax')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('', '#exerciseDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | 4 | <li class="icon_edit_remove" id = "exercise_edit_icon_{{ exercise.slug }}"> <a href="javascript:modal.get('', '#exercisesModalEdit', '#requisicoes_ajax')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('', '#exerciseDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> |
5 | - <li id = "exercise_edit_{{ exercise.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('', '#viewExerciseModal','#requisicoes_ajax')">{{exercise.name}}</a></li> | 5 | + <li id = "exercise_edit_{{ exercise.slug }}"><i class="fa fa-file" aria-hidden="true"></i> <a href="javascript:modal.get('', '#viewExerciseModal','#requisicoes_ajax')">{{exercise.name_exercise}}</a></li> |
6 | {% endfor %} | 6 | {% endfor %} |
7 | </div> | 7 | </div> |
exercise/templates/exercise/exercise_list.html
1 | {% load static i18n list_topic_foruns permission_tags %} | 1 | {% load static i18n list_topic_foruns permission_tags %} |
2 | <div id="list-topic{{ topic.id }}-exercises"> | 2 | <div id="list-topic{{ topic.id }}-exercises"> |
3 | {% for exercise in exercises %} | 3 | {% for exercise in exercises %} |
4 | - <li id="exercise_{{ exercise.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="{{exercise.file.url}}">{{exercise.name}}</a></li> | 4 | + <li id="exercise_{{ exercise.slug }}"><i class="fa fa-file" aria-hidden="true"></i> <a href="{{exercise.file.url}}">{{exercise.name_exercise}}</a></li> |
5 | {% endfor %} | 5 | {% endfor %} |
6 | </div> | 6 | </div> |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-21 12:22 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('users', '0001_initial'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.AlterField( | ||
16 | + model_name='user', | ||
17 | + name='is_staff', | ||
18 | + field=models.BooleanField(default=False, verbose_name='Administrator'), | ||
19 | + ), | ||
20 | + ] |