Commit b80fe06ef6822f7e9a67c767ecc80e66beeba5b7

Authored by Gustavo Bernardo
2 parents ca9cd1f3 d60d4b07

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

amadeus/staticfiles/js/modal_exam.js
@@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
1 -//controles do modal  
2 -$(window).ready(function() { // utilizado para abrir o modal quando tiver tido algum erro no preenchimento do formulario  
3 - if($('.not_submited').length){  
4 - $('#exam').modal('show');  
5 - }  
6 -});  
7 -var Answer = {  
8 - init: function(url) { // utilizado para adicionar um novo campo de resposta  
9 - $.get(url, function(data){  
10 - $("#form").append(data);  
11 - var cont = 1;  
12 - $("#form div div div input").each(function(){  
13 - $(this).attr('name',cont++);  
14 - });  
15 - });  
16 - }  
17 -};  
18 -  
19 -var Submite = {  
20 - post: function(url,dados){  
21 - $('#exam').modal('hide');  
22 - $.post(url,dados, function(data){  
23 - }).fail(function(data){  
24 - $("div.modal-backdrop.fade.in").remove();  
25 - $("#modal_exam").empty();  
26 - $("#modal_exam").append(data.responseText);  
27 - });  
28 - },  
29 - remove: function(url,dados, id_li_link){  
30 - $('#exam').modal('hide');  
31 - $.post(url,dados, function(data){  
32 - $(id_li_link).remove();  
33 - $("#modal_exam").empty();  
34 - $("div.modal-backdrop.fade.in").remove();  
35 - }).fail(function(){  
36 - $("#modal_exam").empty();  
37 - $("#modal_exam").append(data);  
38 - $('#exam').modal('show');  
39 - });  
40 - }  
41 -}  
42 -  
43 -alert("essfd");  
core/static/css/base/amadeus.css
@@ -456,4 +456,4 @@ ul, li { @@ -456,4 +456,4 @@ ul, li {
456 456
457 #panel2 .col-md-2, #panel2 .col-md-10{ 457 #panel2 .col-md-2, #panel2 .col-md-10{
458 padding-left: 0; 458 padding-left: 0;
459 -} 459 -}
  460 +}
460 \ No newline at end of file 461 \ No newline at end of file
exam/static/css/exam.css 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +.primary-label-TF{
  2 + padding-left: 0px;
  3 +}
0 \ No newline at end of file 4 \ No newline at end of file
exam/static/js/Exam.js
1 -//Insert Create select with question type  
2 - var idQuestionType = 1;  
3 - $("#addQuestion").on("click", function(event){  
4 - var element =  
5 - '<div class="row form-group" id="questionType_' + idQuestionType +'">' +  
6 - '<label for="questionType" class="col-md-2 control-label">' +  
7 - '{% trans "Question Type" %}</label>' + '<div class="col-md-10">' +  
8 - '<select id="questionType'+ idQuestionType +'" class="form-control" name="option_question" onchange="showDiv (this, '+ idQuestionType +')">' +  
9 - '<option selected disabled>{% trans "Question Type" %}</option>' +  
10 - '<option value="0">{% trans "Multiple Choice" %}</option>' +  
11 - '<option value="1">{% trans "True or False" %}</option>' +  
12 - '<option value="2">{% trans "Gap Filling" %}</option>' +  
13 - '<option value="3">{% trans "Discursive Question" %}</option>' +  
14 - '</select>' +  
15 - '</div>' +  
16 - '</div>' + '<hr id="hr_'+idQuestionType+'">'  
17 - ;  
18 - if (idQuestionType == 1){  
19 - $(element).insertAfter('#buttonAddQuestion');  
20 - }else{  
21 - var idhr = '#hr_'+(idQuestionType-1);  
22 - $(element).insertAfter(idhr);  
23 - }  
24 - idQuestionType++;  
25 - })  
26 1
27 //Insert question choice 2 //Insert question choice
28 function showDiv (elem, questionType_id) { 3 function showDiv (elem, questionType_id) {
@@ -53,7 +28,9 @@ @@ -53,7 +28,9 @@
53 '</div>'+ 28 '</div>'+
54 '</div>'+ 29 '</div>'+
55 '<div class="row form-group">'+ 30 '<div class="row form-group">'+
56 - '<button type="button" class="btn btn-raised btn-primary" id="newAlternative_'+questionType_id+'" onclick="functionNewAlternative(radios_'+questionType_id+')">New Alternative</button>'+ 31 + '<div class="col-md-8 col-md-offset-2">'+
  32 + '<button type="button" class="btn btn-raised btn-primary" id="newAlternative_'+questionType_id+'" onclick="functionNewAlternative(radios_'+questionType_id+')">New Alternative</button>'+
  33 + '</div>'+
57 '</div>'+ 34 '</div>'+
58 '</div>'; 35 '</div>';
59 } else if (elem.value == 1) { 36 } else if (elem.value == 1) {
@@ -68,9 +45,8 @@ @@ -68,9 +45,8 @@
68 '<div class="row form-group">'+ 45 '<div class="row form-group">'+
69 '<label for="alternative" class="col-md-2 control-label">Alternatives: T/F</label>'+ 46 '<label for="alternative" class="col-md-2 control-label">Alternatives: T/F</label>'+
70 '<div class="col-md-10" id="radiosTF_'+questionType_id+'">'+ 47 '<div class="col-md-10" id="radiosTF_'+questionType_id+'">'+
71 - '<div class="radio form-group" value="1">'+  
72 - '<div class="radio">'+  
73 - '<label>'+ 48 + '<div class="radio radio-primary form-group" value="1">'+
  49 + '<label class="primary-label-TF">'+
74 '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>'+ 50 '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>'+
75 '</label>'+ 51 '</label>'+
76 '<label>'+ 52 '<label>'+
@@ -79,10 +55,9 @@ @@ -79,10 +55,9 @@
79 '<label>'+ 55 '<label>'+
80 '<input type="radio" name="true-or-false-1" value="F">'+ 56 '<input type="radio" name="true-or-false-1" value="F">'+
81 '</label>'+ 57 '</label>'+
82 - '</div>'+  
83 '</div>'+ 58 '</div>'+
84 - '<div class="radio form-group" value="2">'+  
85 - '<label>'+ 59 + '<div class="radio radio-primary form-group" value="2">'+
  60 + '<label class="primary-label-TF">'+
86 '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>'+ 61 '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>'+
87 '</label>'+ 62 '</label>'+
88 '<label>'+ 63 '<label>'+
@@ -91,11 +66,13 @@ @@ -91,11 +66,13 @@
91 '<label>'+ 66 '<label>'+
92 '<input type="radio" name="true-or-false-2" value="F">'+ 67 '<input type="radio" name="true-or-false-2" value="F">'+
93 '</label>'+ 68 '</label>'+
94 - '</div>'+  
95 '</div>'+ 69 '</div>'+
96 '</div>'+ 70 '</div>'+
  71 + '</div>'+
97 '<div class="row form-group">'+ 72 '<div class="row form-group">'+
98 - '<button type="button" class="btn btn-raised btn-primary" id="newAlternative_'+questionType_id+'" onclick="functionNewAlternativeTF(radiosTF_'+questionType_id+')">New Alternative</button>'+ 73 + '<div class="col-md-8 col-md-offset-2">'+
  74 + '<button type="button" class="btn btn-raised btn-primary" id="newAlternative_'+questionType_id+'" onclick="functionNewAlternativeTF(radiosTF_'+questionType_id+')">New Alternative</button>'+
  75 + '</div>'+
99 '</div>'+ 76 '</div>'+
100 '</div>'; 77 '</div>';
101 } else if (elem.value == 3) { 78 } else if (elem.value == 3) {
@@ -113,6 +90,7 @@ @@ -113,6 +90,7 @@
113 $('#questionChoice_'+ questionType_id).detach(); 90 $('#questionChoice_'+ questionType_id).detach();
114 } 91 }
115 $(questionChoice).insertBefore('#hr_'+questionType_id); 92 $(questionChoice).insertBefore('#hr_'+questionType_id);
  93 + $('.primary-label-TF').css('padding-left', '0px');
116 $.material.init() //O material deve ser iniciado aqui para funcionar os botoes de radio. 94 $.material.init() //O material deve ser iniciado aqui para funcionar os botoes de radio.
117 } 95 }
118 //Bug quando criamos sem ser na ordem 96 //Bug quando criamos sem ser na ordem
@@ -131,7 +109,7 @@ function functionNewAlternativeTF(Question_Id){ @@ -131,7 +109,7 @@ function functionNewAlternativeTF(Question_Id){
131 var alternative = parseInt($("div").last().val()) + 1; 109 var alternative = parseInt($("div").last().val()) + 1;
132 var element = 110 var element =
133 '<div class="radio form-group">'+ 111 '<div class="radio form-group">'+
134 - '<label>'+ 112 + '<label class="primary-label-TF" >'+
135 '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>'+ 113 '<textarea class="form-control" rows="1" placeholder="Write your alternative"></textarea>'+
136 '</label>'+ 114 '</label>'+
137 '<label>'+ 115 '<label>'+
@@ -142,5 +120,6 @@ function functionNewAlternativeTF(Question_Id){ @@ -142,5 +120,6 @@ function functionNewAlternativeTF(Question_Id){
142 '</label>'+ 120 '</label>'+
143 '</div>'; 121 '</div>';
144 $(Question_Id).append(element); 122 $(Question_Id).append(element);
  123 + $('.primary-label-TF').css('padding-left', '0px');
145 $.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.
146 } 125 }
147 \ No newline at end of file 126 \ No newline at end of file
exam/templates/exam/create.html
@@ -55,6 +55,33 @@ @@ -55,6 +55,33 @@
55 55
56 {% block javascript %} 56 {% block javascript %}
57 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 57 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  58 + <script type="text/javascript">
  59 + //Insert Create select with question type
  60 + var idQuestionType = 1;
  61 + $("#addQuestion").on("click", function(event){
  62 + var element =
  63 + '<div class="row form-group" id="questionType_' + idQuestionType +'">' +
  64 + '<label for="questionType" class="col-md-2 control-label">' +
  65 + '{% trans "Question Type" %}</label>' + '<div class="col-md-10">' +
  66 + '<select id="questionType'+ idQuestionType +'" class="form-control" name="option_question" onchange="showDiv (this, '+ idQuestionType +')">' +
  67 + '<option selected disabled>{% trans "Question Type" %}</option>' +
  68 + '<option value="0">{% trans "Multiple Choice" %}</option>' +
  69 + '<option value="1">{% trans "True or False" %}</option>' +
  70 + '<option value="2">{% trans "Gap Filling" %}</option>' +
  71 + '<option value="3">{% trans "Discursive Question" %}</option>' +
  72 + '</select>' +
  73 + '</div>' +
  74 + '</div>' + '<hr id="hr_'+idQuestionType+'">'
  75 + ;
  76 + if (idQuestionType == 1){
  77 + $(element).insertAfter('#buttonAddQuestion');
  78 + }else{
  79 + var idhr = '#hr_'+(idQuestionType-1);
  80 + $(element).insertAfter(idhr);
  81 + }
  82 + idQuestionType++;
  83 + })
  84 + </script>
58 <script src="{% static 'js/Exam.js' %}"></script> 85 <script src="{% static 'js/Exam.js' %}"></script>
59 <!-- Init material Bootstrap --> 86 <!-- Init material Bootstrap -->
60 <script type="text/javascript">$.material.init()</script><!-- O botao radio volta a funcionar quando coloco essa função--> 87 <script type="text/javascript">$.material.init()</script><!-- O botao radio volta a funcionar quando coloco essa função-->