Commit bdbe09be1fef02f4c6843892603f6495f6022b3e
Committed by
GitHub
Exists in
master
and in
5 other branches
Merge pull request #435 from amadeusproject/exam_form
form in exam template #362
Showing
2 changed files
with
40 additions
and
16 deletions
Show diff stats
exam/static/js/Exam.js
@@ -122,4 +122,9 @@ function functionNewAlternativeTF(Question_Id){ | @@ -122,4 +122,9 @@ function functionNewAlternativeTF(Question_Id){ | ||
122 | $(Question_Id).append(element); | 122 | $(Question_Id).append(element); |
123 | $('.primary-label-TF').css('padding-left', '0px'); | 123 | $('.primary-label-TF').css('padding-left', '0px'); |
124 | $.material.init() //O material deve ser iniciado aqui para funcionar os botoes de radio. | 124 | $.material.init() //O material deve ser iniciado aqui para funcionar os botoes de radio. |
125 | -} | ||
126 | \ No newline at end of file | 125 | \ No newline at end of file |
126 | +} | ||
127 | +var locale = navigator.language || navigator.userLanguage; | ||
128 | + | ||
129 | + $('.date-picker').datepicker({ | ||
130 | + language: locale, | ||
131 | + }); | ||
127 | \ No newline at end of file | 132 | \ No newline at end of file |
exam/templates/exam/create.html
@@ -13,22 +13,40 @@ | @@ -13,22 +13,40 @@ | ||
13 | <h4 class="panel-title" id="exam-title">{% trans "Create a Exam" %}</h4> | 13 | <h4 class="panel-title" id="exam-title">{% trans "Create a Exam" %}</h4> |
14 | </div> | 14 | </div> |
15 | <div class="panel-body"> | 15 | <div class="panel-body"> |
16 | - <div class="row form-group"> | ||
17 | - <label for="exam_name" class="col-md-2 control-label">{% trans "Exam Name" %}</label> | ||
18 | - <div class="col-md-10"> | ||
19 | - <input type="text" name="exam_name" class="form-control" id="exam_name" placeholder="{% trans 'Exam Name' %}"> | ||
20 | - </div> | ||
21 | - </div> | ||
22 | - <div class="row form-group"> | ||
23 | - <label for="begin_date" class="col-md-2 control-label">{% trans "Exam's begin date" %}</label> | ||
24 | - <div class="col-md-4"> | ||
25 | - <input type="date" name="begin_date" class="form-control" id="begin_date" placeholder='{% trans "Begin Date" %}'> | ||
26 | - </div> | ||
27 | - <label for="end_date" class="col-md-2 control-label">{% trans "Exam's end date" %}</label> | ||
28 | - <div class="col-md-4"> | ||
29 | - <input type="date" name="end_date" class="form-control" id="end_date" placeholder='{% trans "End Date" %}'> | 16 | + {% csrf_token %} |
17 | + {% for field in form %} | ||
18 | + {% if field.auto_id != 'id_begin_exam' and field.auto_id != 'id_end_exam' and field.auto_id != 'id_begin_date' and field.auto_id != 'id_limit_date' %} | ||
19 | + <div class="row form-group"> | ||
20 | + {% if field.field.required %} | ||
21 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> | ||
22 | + {% else %} | ||
23 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> | ||
24 | + {% endif %} | ||
25 | + <div class="col-md-10"> | ||
26 | + {% if field.auto_id == 'id_all_students' %} | ||
27 | + {% render_field field class='form-control input-sm' %} | ||
28 | + {% else %} | ||
29 | + {% render_field field class='form-control input-sm' %} | ||
30 | + {% endif %} | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + {% endif %} | ||
34 | + {% endfor %} | ||
35 | + <div class="row form-group"> | ||
36 | + {% for field in form %} | ||
37 | + {% if field.auto_id == 'id_begin_date' or field.auto_id == 'id_limit_date' %} | ||
38 | + {% if field.field.required %} | ||
39 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> | ||
40 | + {% else %} | ||
41 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> | ||
42 | + {% endif %} | ||
43 | + <div class="col-md-4"> | ||
44 | + {% render_field field class='form-control date-picker' %} | ||
45 | + </div> | ||
46 | + {% endif %} | ||
47 | + {% endfor %} | ||
30 | </div> | 48 | </div> |
31 | - </div> | 49 | + |
32 | <div class="row form-group"> | 50 | <div class="row form-group"> |
33 | <div class="col-md-10"> | 51 | <div class="col-md-10"> |
34 | <div class="checkbox"> | 52 | <div class="checkbox"> |
@@ -38,6 +56,7 @@ | @@ -38,6 +56,7 @@ | ||
38 | </div> | 56 | </div> |
39 | </div> | 57 | </div> |
40 | </div> | 58 | </div> |
59 | + | ||
41 | <div class="row form-group" id="buttonAddQuestion"> | 60 | <div class="row form-group" id="buttonAddQuestion"> |
42 | <div class="col-md-10"> | 61 | <div class="col-md-10"> |
43 | <button id="addQuestion" type="button" class="btn btn-raised btn-default">Add new question buton</button> | 62 | <button id="addQuestion" type="button" class="btn btn-raised btn-default">Add new question buton</button> |