Commit 3571e6d321c39a161659c6a72d7a6fe9329c10a4

Authored by ailsoncgt
2 parents f60ad110 ba2e1913

Merge

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 3 <div class="panel panel-default cards-detail">
4 4 <div class="panel-heading topic">
... ... @@ -56,7 +56,7 @@
56 56  
57 57 {# materiais do topico#}
58 58 <div class="row">
59   - <div class="col-xs-4 col-md-4">
  59 + <div class="col-xs-6 col-md-6">
60 60 <div class="resource_inline">
61 61 <h4>{% trans 'Material' %}</h4>
62 62 </div>
... ... @@ -90,7 +90,7 @@
90 90 </div>
91 91  
92 92 {# avaliações do topico #}
93   - <div class="col-xs-4 col-md-4">
  93 + <div class="col-xs-6 col-md-6">
94 94 <div class="resource_inline">
95 95 <h4>{% trans 'Activities' %}</h4>
96 96 </div>
... ... @@ -101,8 +101,8 @@
101 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 102 <ul class="dropdown-menu" aria-labelledby="dLabel">
103 103 <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}</a></li>
104   -
105 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 106 </ul>
107 107 </div>
108 108 </div>
... ... @@ -112,6 +112,7 @@
112 112 <ul>
113 113 {% list_topic_poll request topic %}
114 114 {% list_topic_foruns request topic %}
  115 + {% list_topic_exercise request topic %}
115 116 </ul>
116 117 </div>
117 118 <div class="editation editation_{{topic.slug}}">
... ... @@ -122,19 +123,14 @@
122 123 {% list_topic_foruns request topic %}
123 124 </ul>
124 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 132 </div>
  133 + </div>
138 134 </div>
139 135  
140 136 {# opções de cancelar e editar no modo de edição #}
... ...
exercise/forms.py
... ... @@ -7,15 +7,26 @@ import requests
7 7  
8 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 21 class Meta:
11 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 27 class UpdateExerciseForm(forms.ModelForm):
17 28  
18 29 class Meta:
19 30 model = Exercise
20   - fields = ['name_exercise', 'description', 'init_date',
21   - 'end_date', 'grade', 'file']
  31 + fields = ['name_exercise', 'description',
  32 + 'end_date', 'file']
... ...
exercise/migrations/0004_auto_20161121_0922.py 0 → 100644
... ... @@ -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 + ]
... ...
exercise/migrations/0005_exercise_allowed.py 0 → 100644
... ... @@ -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 + ]
... ...
exercise/migrations/0006_auto_20161121_1008.py 0 → 100644
... ... @@ -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 + ]
... ...
exercise/migrations/0007_auto_20161121_1019.py 0 → 100644
... ... @@ -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 23  
24 24 name_exercise = models.CharField(_('Name'), max_length=100)
25 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 27 grade = models.DecimalField(max_digits=20, decimal_places=2, default=Decimal('0.00'), null=True)
29 28 topic = models.ForeignKey(Topic, verbose_name=_('Topic'), related_name='exercise_topic')
30 29 professors = models.ManyToManyField(User, verbose_name=_('Professors'), related_name='professors_exercise', blank=True)
31 30 students = models.ManyToManyField(User, verbose_name=_('Students'), related_name='subject_exercise', blank = True)
32 31 file = models.FileField(upload_to='uploads/%Y/%m/%d')
33 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 35 def __str__(self):
36   - return self.name_exercise
37 36 \ No newline at end of file
  37 + return self.name_exercise
... ...
exercise/templates/exercise/card_topic_exercises.html
... ... @@ -8,7 +8,7 @@
8 8 <center><legend>{{exercise.name_exercise}}</legend></center>
9 9 <div class="container-fluid">
10 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 12 {% if exercise.description%}
13 13 {{exercise.description}}
14 14 {% else %}
... ... @@ -16,15 +16,14 @@
16 16 {% endif %}
17 17 </div>
18 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 20 </div>
22 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 24 </div>
26 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 27 {% if exercise.grade %}
29 28 <div class="col-md-4">
30 29 <p id="nota" class="form-control">
... ...
exercise/templates/exercise/create_exercise.html
... ... @@ -5,7 +5,7 @@
5 5 <div class="modal-content">
6 6 <div class="modal-header">
7 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 9 </div>
10 10 <div class="modal-body">
11 11 <!-- Card -->
... ... @@ -41,10 +41,10 @@
41 41 </span>
42 42 </div>
43 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 46 {% endif %}
47   - </div>
  47 + </div>
48 48  
49 49 {% if field.errors %}
50 50 <div class="alert alert-danger alert-dismissible clearfix" role="alert">
... ... @@ -97,6 +97,7 @@
97 97 $('#list-topic{{ topic.id }}-exercises').append(data);
98 98 $('#list-topic{{ topic.id }}-exercises-edit').append(data);
99 99 alertify.success('Exercise successfully created!')
  100 + setTimeout(function () { location.reload(1); }, 1000);
100 101 },
101 102 error: function(data){
102 103 $('#requisicoes_ajax').empty();
... ...
exercise/templates/exercise/exercise_edit.html
... ... @@ -2,6 +2,6 @@
2 2 <div id="exercise-topic{{ topic.id }}-exercises-edit">
3 3 {% for exercise in exercises %}
4 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 6 {% endfor %}
7 7 </div>
... ...
exercise/templates/exercise/exercise_list.html
1 1 {% load static i18n list_topic_foruns permission_tags %}
2 2 <div id="list-topic{{ topic.id }}-exercises">
3 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 5 {% endfor %}
6 6 </div>
... ...
users/migrations/0002_auto_20161121_0922.py 0 → 100644
... ... @@ -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 + ]
... ...