Commit 8bbed0fb1cdf143ec796bcd93aeb78b16af04ed0
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
32 changed files
with
364 additions
and
279 deletions
Show diff stats
.gitignore
amadeus/uploads/ciencia-da-computacao/teorica/tipfef/Apresentacao_da_Cadidatura_a_Marketing_-_Matheus_Lins.pptx
No preview for this file type
amadeus/uploads/ciencia-da-computacao/teorica/tipfef/Cartao_Outubro.pdf
No preview for this file type
amadeus/uploads/django-summernote/2016-11-03/46bdc2b1-ba27-4385-b504-89916637edca.jpg
25.6 KB
amadeus/uploads/django-summernote/2016-11-03/bde587ad-9c4a-4e81-b07d-8f8aa5dced21.jpeg
12.2 KB
amadeus/uploads/django-summernote/2016-11-03/eaa22970-1d01-4deb-8232-60fd2be4f9fa.jpeg
12.2 KB
amadeus/uploads/links/default.jpg
19.5 KB
amadeus/uploads/sistemas-de-informacao/algoritmo/topico-1/Riachuelo_Outubro.pdf
No preview for this file type
amadeus/uploads/users/Captura_de_tela_de_2016-09-21_21-09-40.png
165 KB
courses/static/js/modal_category.js
... | ... | @@ -16,16 +16,16 @@ var Submite = { |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | -var modal = { | |
20 | - get: function (url, id_modal, id_div_modal){ | |
21 | - $.get(url, function(data){ | |
22 | - if($(id_modal).length){ | |
23 | - $(id_div_modal).empty(); | |
24 | - $(id_div_modal).append(data); | |
25 | - } else { | |
26 | - $(id_div_modal).append(data); | |
27 | - } | |
28 | - $(id_modal).modal('show'); | |
29 | - }); | |
30 | - } | |
31 | -}; | |
32 | 19 | \ No newline at end of file |
20 | +// var modal = { | |
21 | +// get: function (url, id_modal, id_div_modal){ | |
22 | +// $.get(url, function(data){ | |
23 | +// if($(id_modal).length){ | |
24 | +// $(id_div_modal).empty(); | |
25 | +// $(id_div_modal).append(data); | |
26 | +// } else { | |
27 | +// $(id_div_modal).append(data); | |
28 | +// } | |
29 | +// $(id_modal).modal('show'); | |
30 | +// }); | |
31 | +// } | |
32 | +// }; | ... | ... |
courses/templates/subject/form_view_teacher.html
1 | 1 | {% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%} |
2 | 2 | |
3 | -{% block javascript %} | |
4 | - <script type="text/javascript" src="{% static 'js/forum.js' %}"></script> | |
5 | - <script src="{% static 'js/file.js' %}"></script> | |
6 | - <script type="text/javascript" src="{% static 'js/material.js' %}"></script> | |
7 | - <script type = "text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script> | |
8 | - <script type = "text/javascript" src="{% static 'js/links.js' %}"></script> | |
9 | -{% endblock %} | |
10 | 3 | <div class="panel panel-default cards-detail"> |
11 | 4 | <div class="panel-heading topic"> |
12 | 5 | <div class="row"> |
... | ... | @@ -23,6 +16,8 @@ |
23 | 16 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
24 | 17 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
25 | 18 | </button> |
19 | + | |
20 | + {# dropdown de topic com as opções de replicar, editar e deletar #} | |
26 | 21 | {% professor_subject topic.subject user as dropdown_topic %} |
27 | 22 | {% if dropdown_topic %} |
28 | 23 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
... | ... | @@ -32,11 +27,13 @@ |
32 | 27 | </ul> |
33 | 28 | {% endif %} |
34 | 29 | </div> |
35 | - </div><!--column--> | |
36 | - </div><!--row--> | |
30 | + </div> | |
31 | + </div> | |
37 | 32 | </div> |
38 | 33 | <div class="panel-collapse collapseTopic-{{topic.slug}} topic_{{ topic.id }} collapse in" role="tabpanel" aria-labelledby="heading_{{topic.id}}" aria-expanded="true" aria-hidden="false"> |
39 | 34 | <div class="panel-body"> |
35 | + | |
36 | + {# dados do tópico no modo de visualização #} | |
40 | 37 | <div class="presentation_{{topic.slug}}"> |
41 | 38 | <p> |
42 | 39 | <i> |
... | ... | @@ -44,6 +41,8 @@ |
44 | 41 | </i> |
45 | 42 | </p> |
46 | 43 | </div> |
44 | + | |
45 | + {# dados dos topicos no modo de edição #} | |
47 | 46 | <div class="form-group editation editation_{{topic.slug}}"> |
48 | 47 | <label class="control-label" for="focusedInput2">{% trans 'Name Topic' %}</label> |
49 | 48 | <input type="text" class="form-control" value="{{topic}}"> |
... | ... | @@ -52,56 +51,82 @@ |
52 | 51 | <label class="control-label" for="focusedInput2">{% trans 'Description' %}</label> |
53 | 52 | <textarea class="form-control" rows="3" id="textArea">{{topic.description}}</textarea> |
54 | 53 | </div> |
54 | + | |
55 | + {# materiais do topico#} | |
55 | 56 | <div class="row"> |
56 | 57 | <div class="col-xs-6 col-md-6"> |
57 | 58 | <div class="resource_inline"> |
58 | 59 | <h4>{% trans 'Material' %}</h4> |
59 | 60 | </div> |
60 | 61 | <div class="resource_inline"> |
62 | + | |
63 | + {# dropdown de create material #} | |
61 | 64 | <div class="dropdown"> |
62 | 65 | <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> |
63 | 66 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
64 | - <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">{% trans 'Create a Link' %}</a></li> | |
65 | - <li><a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')">{% trans "Create a file" %}</a></li> | |
67 | + <li><a href="javascript:modal.get('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#requisicoes_ajax') ">{% trans 'Create a Link' %}</a></li> | |
68 | + <li><a href="javascript:modal.get('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#requisicoes_ajax')">{% trans "Create a file" %}</a></li> | |
66 | 69 | </ul> |
67 | 70 | </div> |
68 | 71 | </div> |
69 | 72 | <div class="presentation_{{topic.slug}}"> |
73 | + | |
74 | + {# materiais do tópico no modo de visualização #} | |
70 | 75 | <ul> |
71 | 76 | {% list_topic_file request topic %} |
72 | 77 | {% list_topic_link request topic%} |
73 | 78 | </ul> |
74 | 79 | </div> |
75 | 80 | <div class="editation editation_{{topic.slug}}"> |
81 | + | |
82 | + {# materiais do tópico no modo de edição #} | |
76 | 83 | <ul> |
77 | 84 | {% list_topic_file_edit request topic %} |
78 | 85 | {% list_topic_link_edit request topic%} |
79 | 86 | </ul> |
80 | 87 | </div> |
81 | 88 | </div> |
89 | + | |
90 | + {# avaliações do topico #} | |
82 | 91 | <div class="col-xs-4 col-md-4"> |
83 | 92 | <div class="resource_inline"> |
84 | 93 | <h4>{% trans 'Activities' %}</h4> |
85 | 94 | </div> |
86 | 95 | <div class="resource_inline"> |
96 | + | |
97 | + {# dropdown de avaliações #} | |
87 | 98 | <div class="dropdown"> |
88 | 99 | <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> |
89 | 100 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
90 | 101 | <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}</a></li> |
91 | - <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans 'Create Poll' %}</a></li> | |
102 | + <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#requisicoes_ajax');">{% trans 'Create Poll' %}</a></li> | |
92 | 103 | </ul> |
93 | 104 | </div> |
94 | 105 | </div> |
95 | - <ul> | |
96 | - {% list_topic_poll request topic %} | |
97 | - {% list_topic_foruns request topic %} | |
98 | - </ul> | |
106 | + <div class="presentation_{{topic.slug}}"> | |
107 | + | |
108 | + {# avaliações do tópico no modo de visualização #} | |
109 | + <ul> | |
110 | + {% list_topic_poll request topic %} | |
111 | + {% list_topic_foruns request topic %} | |
112 | + </ul> | |
113 | + </div> | |
114 | + <div class="editation editation_{{topic.slug}}"> | |
115 | + | |
116 | + {# avaliações do tópico no modo de edição #} | |
117 | + <ul> | |
118 | + {% list_topic_poll_teacher request topic %} | |
119 | + {% list_topic_foruns request topic %} | |
120 | + </ul> | |
121 | + </div> | |
99 | 122 | </div> |
100 | 123 | </div> |
124 | + | |
125 | + {# opções de cancelar e editar no modo de edição #} | |
101 | 126 | <div class="form-group editation editation_{{topic.slug}}"> |
102 | 127 | <div class="col-md-10"> |
103 | - <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-default">{% trans 'Cancel' %}</a> | |
104 | - <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a> | |
128 | + <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raise btn-default">{% trans 'Back' %}</a> | |
129 | + {# <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a>#} | |
105 | 130 | </div> |
106 | 131 | </div> |
107 | 132 | </div> |
... | ... | @@ -112,7 +137,7 @@ |
112 | 137 | |
113 | 138 | |
114 | 139 | <!-- MODAL REMOVE TOPIC --> |
115 | -<div class="modal" id="removeTopic"> | |
140 | +<div class="modal" id="{{topic.slug}}"> | |
116 | 141 | <div class="modal-dialog"> |
117 | 142 | <div class="modal-content"> |
118 | 143 | <div class="modal-header"> |
... | ... | @@ -152,18 +177,18 @@ |
152 | 177 | <label for="textArea" class="col-md-2 control-label">{% trans 'Code' %}:</label> |
153 | 178 | |
154 | 179 | <div class="col-md-10"> |
155 | - <textarea class="form-control" rows="2" id="textArea"></textarea> | |
156 | - <span class="help-block">{% trans 'Material description' %}</span> | |
180 | + <textarea class="form-control" rows="2" id="textArea"></textarea> | |
181 | + <span class="help-block">{% trans 'Material description' %}</span> | |
157 | 182 | </div> |
158 | 183 | </div> |
159 | 184 | <div class="form-group is-empty"> |
160 | - <label for="number" class="col-md-2 control-label">{% trans 'Height' %}</label> | |
185 | + <label for="number" class="col-md-2 control-label">{% trans 'Height' %}</label> | |
161 | 186 | <div class="col-md-4"> |
162 | 187 | <input type="number" class="form-control" id="inputNumber" placeholder="Heiht"> |
163 | 188 | </div> |
164 | 189 | </div> |
165 | 190 | <div class="form-group is-empty"> |
166 | - <label for="number" class="col-md-2 control-label">{% trans 'Weight' %}</label> | |
191 | + <label for="number" class="col-md-2 control-label">{% trans 'Weight' %}</label> | |
167 | 192 | <div class="col-md-4"> |
168 | 193 | <input type="number" class="form-control" id="inputNumber" placeholder="Weight"> |
169 | 194 | </div> |
... | ... | @@ -173,7 +198,7 @@ |
173 | 198 | </div> |
174 | 199 | <div class="modal-footer"> |
175 | 200 | <!-- Don't remove that!!! |
176 | - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">Close</button>--> | |
201 | + {# <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">Close</button>-->#} | |
177 | 202 | |
178 | 203 | <!-- Put curtom buttons here!!! --> |
179 | 204 | <button type="button" class="btn btn-primary btn-raised">{% trans 'Confirm' %}</button> |
... | ... | @@ -182,86 +207,3 @@ |
182 | 207 | </div> |
183 | 208 | </div> |
184 | 209 | <!-- EndModal --> |
185 | - | |
186 | -<!-- MODAL ACTIVITIES--> | |
187 | -<div class="modal fade" id="ActivityModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
188 | - <div class="modal-dialog" role="document"> | |
189 | - <div class="modal-content"> | |
190 | - <div class="modal-header"> | |
191 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
192 | - <h4 class="modal-title" id="myModalLabel"></h4> | |
193 | - </div> | |
194 | - <div class="modal-body"> | |
195 | - <form class="form-horizontal"> | |
196 | - | |
197 | - <fieldset> | |
198 | - <legend>{% trans 'Proposal Activity' %}</legend> | |
199 | - <div class="form-group is-empty"> | |
200 | - <label for="NameIn" class="col-md-2 control-label">{% trans 'Name' %}:</label> | |
201 | - <div class="col-md-10"> | |
202 | - <input type="text" id="NameIn" class="form-control"> | |
203 | - </div> | |
204 | - </div> | |
205 | - <div class="form-group is-empty"> | |
206 | - <label for="DescIn" class="col-md-2 control-label">{% trans 'Describe' %}:</label> | |
207 | - <div class="col-md-10"> | |
208 | - <textarea class="form-control" id="DescIn" rows="2"></textarea> | |
209 | - </div> | |
210 | - </div> | |
211 | - <div class="form-group is-empty"> | |
212 | - <label for="DateIn" class="col-md-2 control-label">{% trans 'Opening' %}: </label> | |
213 | - <div class="col-md-10"> | |
214 | - <input type="text" id="DateIn" class="form-control date-picker" requerid=""> | |
215 | - </div> | |
216 | - </div> | |
217 | - <div class="form-group is-empty"> | |
218 | - <label for="DateIn" class="col-md-2 control-label">{% trans 'Ending' %}: </label> | |
219 | - <div class="col-md-10"> | |
220 | - <input type="text" id="DateIn" class="form-control date-picker" requerid=""> | |
221 | - </div> | |
222 | - </div> | |
223 | - <div class="form-group" style="margin-top: 0;"> | |
224 | - <div class="col-md-offset-2 col-md-10"> | |
225 | - <div class="checkbox"> | |
226 | - <label> | |
227 | - <input type="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Send Later' %} | |
228 | - </label> | |
229 | - </div> | |
230 | - </div> | |
231 | - </div> | |
232 | - <div class="form-group"> | |
233 | - <div class="col-md-10 col-md-offset-2"> | |
234 | - <button type="button" class="btn btn-default">{% trans 'Cancel' %}</button> | |
235 | - <button type="submit" class="btn btn-primary">{% trans 'Submit' %}</button> | |
236 | - </div> | |
237 | - </div> | |
238 | - | |
239 | - | |
240 | - </fieldset> | |
241 | - </form> | |
242 | - </div> | |
243 | - </div> | |
244 | - </div> | |
245 | -</div> | |
246 | -<!--EndModal--> | |
247 | - | |
248 | - | |
249 | - | |
250 | -<div class="modal fade" id="createForum" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
251 | - <div class="modal-dialog" role="document"> | |
252 | - <div class="modal-content"> | |
253 | - <div class="modal-header"> | |
254 | - <h4 class="modal-title" id="myModalLabel">{% trans 'Forum' %}</h4> | |
255 | - </div> | |
256 | - <div class="modal-body"> | |
257 | - <section> | |
258 | - <div class="forum_form"></div> | |
259 | - </section> | |
260 | - </div> | |
261 | - <div class="modal-footer"> | |
262 | - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans 'Close' %}</button> | |
263 | - <button type="button" onclick="$('#forum_create').submit();" class="btn btn-primary btn-raised">{% trans 'Create' %}</button> | |
264 | - </div> | |
265 | - </div> | |
266 | - </div> | |
267 | -</div> | ... | ... |
courses/templates/subject/index.html
... | ... | @@ -2,103 +2,148 @@ |
2 | 2 | |
3 | 3 | {% load static i18n permission_tags professor_access %} |
4 | 4 | |
5 | +{% block javascript %} | |
6 | + <script type="text/javascript" src="{% static 'js/forum.js' %}"></script> | |
7 | + <script src="{% static 'js/file.js' %}"></script> | |
8 | + <script type="text/javascript" src="{% static 'js/material.js' %}"></script> | |
9 | + <script type="text/javascript" src="{% static 'js/modals_requisitions.js' %}"></script> | |
10 | + <script type = "text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script> | |
11 | + <script type = "text/javascript" src="{% static 'js/links.js' %}"></script> | |
12 | + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> | |
13 | + <script src="{% static 'js/modal_poll.js' %}"></script> | |
14 | +{% endblock %} | |
15 | + | |
5 | 16 | {% block breadcrumbs %} |
6 | -<ol class="breadcrumb"> | |
7 | - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
8 | - <li><a href="{% url 'course:manage' %}">{% trans 'Courses' %}</a></li> | |
9 | - <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li> | |
10 | - <li class="active">{{ subject }}</li> | |
11 | -</ol> | |
17 | + <ol class="breadcrumb"> | |
18 | + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
19 | + <li><a href="{% url 'course:manage' %}">{% trans 'Courses' %}</a></li> | |
20 | + <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li> | |
21 | + <li class="active">{{ subject }}</li> | |
22 | + </ol> | |
12 | 23 | {% endblock %} |
13 | 24 | {% block sidebar %} |
14 | -<div class="panel panel-primary"> | |
25 | + <div class="panel panel-primary"> | |
15 | 26 | <div class="panel-heading"> |
16 | - <h4>{% trans 'Menu' %}</h4> | |
27 | + <h4>{% trans 'Menu' %}</h4> | |
17 | 28 | </div> |
18 | 29 | <div class="panel-body"> |
19 | - <ul class="nav nav-pills nav-stacked"> | |
20 | - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
21 | - <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</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 | - <li><a href="{% url 'core:guest' %}">{% trans 'Courses' %}</a></li> | |
27 | - {% if user|has_role:'system_admin' %} | |
28 | - <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> | |
29 | - {% endif %} | |
30 | - {% if user|has_role:'system_admin' or user|has_role:'professor' %} | |
31 | - <li> | |
32 | - <a href="#courses_list" class="accordion" data-toggle="collapse">{% trans 'Manage Courses' %}</a> | |
33 | - <div id="courses_list" class="collapse"> | |
34 | - <ul class="nav nav-pill nav-stacked accordion_list"> | |
35 | - {% for course in courses_list %} | |
36 | - <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li> | |
37 | - {% endfor %} | |
38 | - </ul> | |
39 | - </div> | |
40 | - </li> | |
41 | - {% endif %} | |
42 | - </ul> | |
30 | + <ul class="nav nav-pills nav-stacked"> | |
31 | + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
32 | + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> | |
33 | + {% if user|has_role:'student' or not user.is_staff %} | |
34 | + <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li> | |
35 | + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li> | |
36 | + {% endif %} | |
37 | + <li><a href="{% url 'core:guest' %}">{% trans 'Courses' %}</a></li> | |
38 | + {% if user|has_role:'system_admin' %} | |
39 | + <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> | |
40 | + {% endif %} | |
41 | + {% if user|has_role:'system_admin' or user|has_role:'professor' %} | |
42 | + <li> | |
43 | + <a href="#courses_list" class="accordion" data-toggle="collapse">{% trans 'Manage Courses' %}</a> | |
44 | + <div id="courses_list" class="collapse"> | |
45 | + <ul class="nav nav-pill nav-stacked accordion_list"> | |
46 | + {% for course in courses_list %} | |
47 | + <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li> | |
48 | + {% endfor %} | |
49 | + </ul> | |
50 | + </div> | |
51 | + </li> | |
52 | + {% endif %} | |
53 | + </ul> | |
43 | 54 | </div> |
44 | -</div> | |
55 | + </div> | |
45 | 56 | |
46 | 57 | |
47 | 58 | {% endblock %} |
48 | 59 | |
49 | 60 | {% block content %} |
50 | - <div class="panel panel-info"> | |
51 | - <div class="panel-heading course-detail"> | |
61 | + <div class="panel panel-info"> | |
62 | + <div class="panel-heading course-detail"> | |
52 | 63 | <div class="row"> |
53 | - <div class="col-md-10 col-sm-10"> | |
54 | - <h4>{{subject}}</h4> | |
55 | - </div> | |
56 | - <div class="col-xs-4 col-md-2 divMoreActions"> | |
57 | - {% professor_subject subject user as subject_professor%} | |
58 | - {% if subject_professor %} | |
59 | - <div class="btn-group"> | |
60 | - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
61 | - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | |
62 | - </button> | |
63 | - <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | |
64 | - <li><a href="{% url 'course:replicate_subject' subject.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> | |
65 | - <li><a href="{% url 'course:update_subject' subject.slug %}" <i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> | |
66 | - <li><a href="{% url 'course:delete_subject' subject.slug %}" ><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans "Remove" %}</a></li> | |
67 | - </ul> | |
68 | - </div> | |
69 | - {% endif %} | |
70 | - </div> | |
71 | - </div> | |
72 | - </div> | |
73 | - <div class="panel-body"> | |
74 | - <p><b>{% trans "Professor" %}:</b> {% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} | |
75 | - {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> | |
76 | - <p> | |
77 | - <b>{% trans "Description" %}:</b> | |
78 | - {{subject.description|safe}} | |
79 | - </p> | |
80 | - <div class="row"> | |
81 | - <div class="col-xs-6 col-md-6"> | |
82 | - <p><b>{% trans "Beginning" %}:</b> {{subject.init_date}}</p> | |
83 | - </div> | |
84 | - <div class="col-xs-6 col-md-6"> | |
85 | - <p><b>{% trans "End" %}:</b> {{subject.end_date}}</p> | |
86 | - </div> | |
64 | + <div class="col-md-10 col-sm-10"> | |
65 | + <h4>{{subject}}</h4> | |
66 | + </div> | |
67 | + | |
68 | + {# dropdown de subject com as opções de replicar, editar e deletar #} | |
69 | + <div class="col-xs-4 col-md-2 divMoreActions"> | |
70 | + {% professor_subject subject user as subject_professor%} | |
71 | + {% if subject_professor %} | |
72 | + <div class="btn-group"> | |
73 | + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
74 | + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | |
75 | + </button> | |
76 | + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | |
77 | + <li><a href="{% url 'course:replicate_subject' subject.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> | |
78 | + <li><a href="{% url 'course:update_subject' subject.slug %}" <i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> | |
79 | + <li><a href="{% url 'course:delete_subject' subject.slug %}" ><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans "Remove" %}</a></li> | |
80 | + </ul> | |
87 | 81 | </div> |
88 | - </div> | |
82 | + {% endif %} | |
83 | + </div> | |
84 | + | |
85 | + </div> | |
89 | 86 | </div> |
90 | - {% for topic in topics %} | |
91 | - {% professor_subject topic.subject user as topic_professor%} | |
92 | - {% if topic_professor %} | |
93 | - {% include "subject/form_view_teacher.html" %} | |
94 | - {% else %} | |
95 | - {% include "subject/form_view_student.html" %} | |
96 | - {% endif %} | |
97 | - {% endfor %} | |
98 | - {% professor_subject subject user as professor_sub %} | |
99 | - {% if professor_sub %} | |
100 | - <div class="form-group"> | |
101 | - <a href="{% url 'course:create_topic' subject.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised" name="create_topic">{% trans "Create Topic" %}<div class="ripple-container"></div></a> | |
87 | + | |
88 | + {# informações do subject(professor, descrição etc) #} | |
89 | + <div class="panel-body"> | |
90 | + <p><b>{% trans "Professor" %}:</b> {% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} | |
91 | + {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> | |
92 | + <p> | |
93 | + <b>{% trans "Description" %}:</b> | |
94 | + {{subject.description|safe}} | |
95 | + </p> | |
96 | + <div class="row"> | |
97 | + <div class="col-xs-6 col-md-6"> | |
98 | + <p><b>{% trans "Beginning" %}:</b> {{subject.init_date}}</p> | |
99 | + </div> | |
100 | + <div class="col-xs-6 col-md-6"> | |
101 | + <p><b>{% trans "End" %}:</b> {{subject.end_date}}</p> | |
102 | + </div> | |
102 | 103 | </div> |
103 | - {% endif %} | |
104 | + </div> | |
105 | + | |
106 | + </div> | |
107 | + | |
108 | + {# lista de tópicos #} | |
109 | + {% for topic in topics %} | |
110 | + {% professor_subject topic.subject user as topic_professor%} | |
111 | + {% if topic_professor %} | |
112 | + {% include "subject/form_view_teacher.html" %} | |
113 | + {% else %} | |
114 | + {% include "subject/form_view_student.html" %} | |
115 | + {% endif %} | |
116 | + {% endfor %} | |
117 | + | |
118 | + {# botão create topic #} | |
119 | + {% professor_subject subject user as professor_sub %} | |
120 | + {% if professor_sub %} | |
121 | + <div class="form-group"> | |
122 | + <a href="{% url 'course:create_topic' subject.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised" name="create_topic">{% trans "Create Topic" %}<div class="ripple-container"></div></a> | |
123 | + </div> | |
124 | + {% endif %} | |
125 | + | |
126 | + {# local onde vai ser colocado todos os HTML's que retornan de uma requisição ajax feitas dentro de subject #} | |
127 | + <div class = 'row' id ="requisicoes_ajax"> | |
128 | + {# Não mudar o id #} | |
129 | + </div> | |
130 | + | |
131 | + <div class="modal fade" id="createForum" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
132 | + <div class="modal-dialog" role="document"> | |
133 | + <div class="modal-content"> | |
134 | + <div class="modal-header"> | |
135 | + <h4 class="modal-title" id="myModalLabel">{% trans 'Forum' %}</h4> | |
136 | + </div> | |
137 | + <div class="modal-body"> | |
138 | + <section> | |
139 | + <div class="forum_form"></div> | |
140 | + </section> | |
141 | + </div> | |
142 | + <div class="modal-footer"> | |
143 | + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans 'Close' %}</button> | |
144 | + <button type="button" onclick="$('#forum_create').submit();" class="btn btn-primary btn-raised">{% trans 'Create' %}</button> | |
145 | + </div> | |
146 | + </div> | |
147 | + </div> | |
148 | + </div> | |
104 | 149 | {% endblock %} | ... | ... |
courses/templates/subject/poll_item_actions.html
1 | 1 | {% load static i18n permission_tags professor_access %} |
2 | 2 | |
3 | -<script src="{% static 'js/modals_requisitions.js'%}"></script> | |
4 | -<script src="{% static 'js/modal_poll.js'%}"></script> | |
5 | - | |
6 | -{% for poll in polls %} | |
7 | - {% professor_subject poll.topic.subject request.user as permission%} | |
8 | - {% if permission %} | |
9 | - <li id="poll_{{poll.slug}}"><i class="material-icons">{% trans 'poll' %}</i> <a href="javascript:modal.get('{% url 'course:poll:update_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a><a href="javascript:modal.get('{% url 'course:poll:delete_poll' poll.slug %}','#poll','#modal_poll');"><span class="glyphicon glyphicon-remove"></span></a></li> | |
10 | - {% else %} | |
11 | - <li id="poll_{{poll.slug}}"><i class="material-icons">{% trans 'poll' %}</i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a></li> | |
12 | - {% endif %} | |
3 | +<div id="list-topic-{{ topic.slug }}-poll"> | |
4 | + {% for poll in polls %} | |
5 | + <li id="poll_{{poll.slug}}"><i class="fa fa-bar-chart"></i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#requisicoes_ajax');">{{ poll }}</a></li> | |
13 | 6 | {% endfor %} |
14 | -{# <button class="btn btn-primary btn-raised" onclick="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans '+ Create Poll' %}</button> #} | |
15 | -<div class="row" id="modal_poll"> | |
16 | - | |
17 | 7 | </div> | ... | ... |
courses/templates/subject/poll_item_actions_teacher.html
0 → 100644
... | ... | @@ -0,0 +1,10 @@ |
1 | +{% load static i18n permission_tags professor_access %} | |
2 | + | |
3 | +<div id="list-topic-{{ topic.slug }}-poll-edit"> | |
4 | + {% for poll in polls %} | |
5 | + <div id="poll_{{poll.slug}}_div"> | |
6 | + <li class="icon_edit_remove" ><a href="javascript:modal.get('{% url 'course:poll:update_poll' poll.slug %}','#poll','#requisicoes_ajax');"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:poll:delete_poll' poll.slug %}','#poll','#requisicoes_ajax');"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
7 | + <li><i class="fa fa-bar-chart"></i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#requisicoes_ajax');">{{poll}}</a></li> | |
8 | + </div> | |
9 | + {% endfor %} | |
10 | +</div> | ... | ... |
... | ... | @@ -0,0 +1,36 @@ |
1 | +{% load static i18n permission_tags %} | |
2 | + | |
3 | +<!-- Modal (remember to change the ids!!!) --> | |
4 | +<div class="modal fade" id="subject" tabindex="-1" role="dialog" aria-labelledby="{{topic.slug}}_delete"> | |
5 | + <div class="modal-dialog" role="document"> | |
6 | + <div class="modal-content"> | |
7 | + <!-- Modal Header --> | |
8 | + <div class="modal-header"> | |
9 | + | |
10 | + <h4 class="modal-title" id="{{topic.slug}}_delete">{% trans "Delete Course" %}</h4> | |
11 | + </div> | |
12 | + <!-- Modal Body --> | |
13 | + <div class="modal-body"> | |
14 | + <!-- Put ONLY your content here!!! --> | |
15 | + <form id="delete_topic_{{topic.slug}}" action="" method="post"> | |
16 | + {% csrf_token %} | |
17 | + <p>{% trans 'Are you sure you want to delete the subject' %} "{{subject.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_topic_{{topic.slug}}" class="btn btn-primary btn-raised">{% trans "Delete" %}</button> | |
25 | + <script> | |
26 | + $("#delete_topic_{{topic.slug}}").submit(function(event) { | |
27 | + RemoveCourse.remove("{% url 'course:delete_subject' subject.slug %}",$(this).serialize(),"#subject_{{subject.slug}}"); | |
28 | + event.preventDefault(); | |
29 | + }); | |
30 | + </script> | |
31 | + </div> | |
32 | + </div> | |
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_subject.js' %}"></script> | ... | ... |
courses/templates/topic/link_topic_list.html
1 | 1 | {% load static i18n list_topic_foruns permission_tags %} |
2 | 2 | <div id="list-topic{{ topic.id }}-links"> |
3 | 3 | {% for link in links%} |
4 | - <li id = "link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link.name}}</a></li> | |
4 | + <li id = "link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#requisicoes_ajax')">{{link.name}}</a></li> | |
5 | 5 | {% endfor %} |
6 | 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 | 2 | <div id="list-topic{{ topic.id }}-links-edit"> |
3 | -{% for link in links%} | |
4 | - | |
5 | - <li class="icon_edit_remove" id = "link_edit_icon_{{ link.slug }}"> <a href="javascript:modal.get('{% url 'course:links:update_link' link.slug %}', '#linksModalEdit', '#divModalLinkUpdate')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:links:delete_link' link.slug %}', '#linkDeleteModal', '#divModalLinkUpdate')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
6 | - <li id = "link_edit_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#divModalLink')">{{link.name}}</a></li> | |
7 | - | |
8 | -{% endfor %} | |
9 | -</div> | |
10 | - | |
11 | -<div class="row" id="divModalLinkUpdate"> | |
12 | - | |
3 | + {% for link in links%} | |
4 | + <li class="icon_edit_remove" id = "link_edit_icon_{{ link.slug }}"> <a href="javascript:modal.get('{% url 'course:links:update_link' link.slug %}', '#linksModalEdit', '#requisicoes_ajax')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:links:delete_link' link.slug %}', '#linkDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
5 | + <li id = "link_{{ link.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('{% url 'course:links:view_link' link.slug %}', '#viewLinkModal','#requisicoes_ajax')">{{link.name}}</a></li> | |
6 | + {% endfor %} | |
13 | 7 | </div> | ... | ... |
courses/templates/topic/list_file.html
... | ... | @@ -3,10 +3,10 @@ |
3 | 3 | <div id="list-topic{{ topic.id }}-files"> |
4 | 4 | {% for file in files %} |
5 | 5 | <li id="file_{{ file.slug }}"><i class="material-icons">{{ file.file_type.icon }}</i> <a href="{% url 'course:file_material_view' file.slug %}" target="_blank">{{ file.name }}</a></li> |
6 | - {% endfor %} | |
6 | + {% endfor %} | |
7 | 7 | </div> |
8 | - | |
9 | 8 | |
10 | -<div class="row" id="divModalFile"> | |
11 | 9 | |
12 | -</div> | |
10 | +{# <div class="row" id="divModalFile">#} | |
11 | + | |
12 | +{# </div>#} | ... | ... |
courses/templates/topic/list_file_edit.html
... | ... | @@ -2,11 +2,11 @@ |
2 | 2 | |
3 | 3 | <div id="list-topic{{ topic.id }}-files-edit"> |
4 | 4 | {% for file in files %} |
5 | - <li class="icon_edit_remove" id="file_edit_icon_{{ file.slug }}"> <a href="javascript:modal.get('{% url 'course:file:update_file' file.slug %}', '#fileUpdateModal', '#divModalFileUpdate')" ><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:file:delete_file' file.slug %}', '#fileDeleteModal', '#divModalFileUpdate')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
5 | + <li class="icon_edit_remove" id="file_edit_icon_{{ file.slug }}"> <a href="javascript:modal.get('{% url 'course:file:update_file' file.slug %}', '#fileUpdateModal', '#requisicoes_ajax')" ><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:file:delete_file' file.slug %}', '#fileDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
6 | 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 | |
10 | -<div class="row" id="divModalFileUpdate"> | |
10 | +{# <div class="row" id="divModalFileUpdate">#} | |
11 | 11 | |
12 | -</div> | |
13 | 12 | \ No newline at end of file |
13 | +{# </div>#} | ... | ... |
courses/templatetags/list_topic_foruns.py
... | ... | @@ -31,6 +31,17 @@ def list_topic_poll(request, topic): |
31 | 31 | |
32 | 32 | return context |
33 | 33 | |
34 | +@register.inclusion_tag('subject/poll_item_actions_teacher.html') | |
35 | +def list_topic_poll_teacher(request, topic): | |
36 | + context = { | |
37 | + 'request': request, | |
38 | + } | |
39 | + | |
40 | + context['polls'] = Poll.objects.filter(topic = topic) | |
41 | + context['topic'] = topic | |
42 | + | |
43 | + return context | |
44 | + | |
34 | 45 | @register.inclusion_tag('topic/list_file.html') |
35 | 46 | def list_topic_file(request, topic): |
36 | 47 | context = { | ... | ... |
courses/urls.py
... | ... | @@ -22,6 +22,7 @@ urlpatterns = [ |
22 | 22 | url(r'^subjects/subscribe/(?P<slug>[\w_-]+)/$', views.subscribe_subject, name='subscribe_subject'), |
23 | 23 | url(r'^topics/create/(?P<slug>[\w_-]+)/$', views.CreateTopicView.as_view(), name='create_topic'), |
24 | 24 | url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), |
25 | + url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.DeleteTopic.as_view(), name='update_topic'), | |
25 | 26 | url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'), |
26 | 27 | url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'), |
27 | 28 | url(r'^forum/', include('forum.urls', namespace = 'forum')), | ... | ... |
courses/views.py
... | ... | @@ -142,7 +142,7 @@ class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView): |
142 | 142 | context['aparece'] = self.aparece |
143 | 143 | |
144 | 144 | return context |
145 | - | |
145 | + | |
146 | 146 | class CreateCourseView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin, generic.edit.CreateView): |
147 | 147 | log_component = "course" |
148 | 148 | log_resource = "course" |
... | ... | @@ -314,7 +314,7 @@ class DeleteCourseView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.Delet |
314 | 314 | self.log_context['course_category_name'] = self.object.category.name |
315 | 315 | |
316 | 316 | super(DeleteCourseView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) |
317 | - | |
317 | + | |
318 | 318 | return reverse_lazy('course:manage') |
319 | 319 | |
320 | 320 | |
... | ... | @@ -359,7 +359,7 @@ class CourseView(LogMixin, NotificationMixin, generic.DetailView): |
359 | 359 | if not category_sub is None: |
360 | 360 | cat = get_object_or_404(CategorySubject, slug = category_sub) |
361 | 361 | subjects = subjects.filter(category = cat) |
362 | - | |
362 | + | |
363 | 363 | context['subjects'] = subjects |
364 | 364 | |
365 | 365 | if has_role(self.request.user,'system_admin'): |
... | ... | @@ -389,12 +389,12 @@ class CourseView(LogMixin, NotificationMixin, generic.DetailView): |
389 | 389 | |
390 | 390 | return context |
391 | 391 | |
392 | -class DeleteView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.DeleteView): | |
392 | +class DeleteTopic(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.DeleteView): | |
393 | 393 | |
394 | 394 | allowed_roles = ['professor', 'system_admin'] |
395 | 395 | login_url = reverse_lazy("core:home") |
396 | 396 | redirect_field_name = 'next' |
397 | - model = Course | |
397 | + model = Topic | |
398 | 398 | template_name = 'course/delete.html' |
399 | 399 | success_url = reverse_lazy('course:manage') |
400 | 400 | |
... | ... | @@ -412,7 +412,7 @@ def subscribe_course(request, slug): |
412 | 412 | |
413 | 413 | if request.user in course.students.all(): |
414 | 414 | |
415 | - log_context = {} | |
415 | + log_context = {} | |
416 | 416 | log_context['course_id'] = course.id |
417 | 417 | log_context['course_name'] = course.name |
418 | 418 | log_context['course_slug'] = course.slug |
... | ... | @@ -665,7 +665,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): |
665 | 665 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
666 | 666 | subject = topic.subject |
667 | 667 | topics_q = Topic.objects.filter(subject = subject, visible=True) |
668 | - | |
668 | + | |
669 | 669 | return topics_q |
670 | 670 | |
671 | 671 | def get_context_data(self, **kwargs): |
... | ... | @@ -681,7 +681,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): |
681 | 681 | context['students_activit'] = students_activit |
682 | 682 | context['materials'] = materials |
683 | 683 | context['form'] = ActivityForm |
684 | - | |
684 | + | |
685 | 685 | return context |
686 | 686 | |
687 | 687 | |
... | ... | @@ -716,7 +716,7 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMi |
716 | 716 | self.object.owner = self.request.user |
717 | 717 | self.object.save() |
718 | 718 | action = super(CreateTopicView, self).createorRetrieveAction("create Topic") |
719 | - super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created", | |
719 | + super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created", | |
720 | 720 | resource_name=self.object.name, resource_link= reverse('course:view_topic',args=[self.object.slug]), |
721 | 721 | actor=self.request.user, users = self.object.subject.course.students.all() ) |
722 | 722 | |
... | ... | @@ -733,7 +733,7 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMi |
733 | 733 | self.log_context['course_category_name'] = self.object.subject.course.category.name |
734 | 734 | |
735 | 735 | super(CreateTopicView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) |
736 | - | |
736 | + | |
737 | 737 | return super(CreateTopicView, self).form_valid(form) |
738 | 738 | |
739 | 739 | class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.UpdateView): |
... | ... | @@ -939,7 +939,7 @@ def subscribe_subject(request, slug): |
939 | 939 | subject.students.add(request.user) |
940 | 940 | |
941 | 941 | if request.user in subject.students.all(): |
942 | - log_context = {} | |
942 | + log_context = {} | |
943 | 943 | log_context['subject_id'] = subject.id |
944 | 944 | log_context['subject_name'] = subject.name |
945 | 945 | log_context['subject_slug'] = subject.slug | ... | ... |
links/static/js/links.js
poll/models.py
... | ... | @@ -12,7 +12,7 @@ class Poll(Activity): |
12 | 12 | verbose_name_plural = _('Polls') |
13 | 13 | |
14 | 14 | def __str__(self): |
15 | - return str(self.name) + str("/") + str(self.topic) | |
15 | + return str(self.name) | |
16 | 16 | |
17 | 17 | class Answer(models.Model): |
18 | 18 | answer = models.CharField(_("Answer"), max_length = 200) | ... | ... |
poll/static/js/modal_poll.js
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 | - $('#poll').modal('show'); | |
5 | - } | |
6 | -}); | |
1 | +// | |
2 | +// //controles do modal | |
3 | +// $(window).ready(function() { // utilizado para abrir o modal quando tiver tido algum erro no preenchimento do formulario | |
4 | +// if($('.not_submited').length){ | |
5 | +// $('#poll').modal('show'); | |
6 | +// } | |
7 | +// }); | |
8 | + | |
7 | 9 | var Answer = { |
8 | 10 | init: function(url) { // utilizado para adicionar um novo campo de resposta |
9 | 11 | $.get(url, function(data){ |
... | ... | @@ -17,24 +19,59 @@ var Answer = { |
17 | 19 | }; |
18 | 20 | |
19 | 21 | var Submite = { |
20 | - post: function(url,dados){ | |
22 | + create: function(url,dados, slug){ | |
23 | + $('#poll').modal('hide'); | |
24 | + var poll = null; | |
25 | + $.post(url,dados, function(data){ | |
26 | + $.ajax({ | |
27 | + method: "get", | |
28 | + url: data["view"], | |
29 | + success: function(view){ | |
30 | + $('#list-topic-'+ slug +'-poll').append(view); | |
31 | + } | |
32 | + }); | |
33 | + $.ajax({ | |
34 | + method: "get", | |
35 | + url: data["edit"], | |
36 | + success: function(edit){ | |
37 | + $('#list-topic-'+ slug +'-poll-edit').append(edit); | |
38 | + } | |
39 | + }); | |
40 | + $("#requisicoes_ajax").empty(); | |
41 | + alertify.alert('Link successfully created!'); | |
42 | + }).fail(function(data){ | |
43 | + $("div.modal-backdrop.fade.in").remove(); | |
44 | + $("#requisicoes_ajax").empty(); | |
45 | + $("#requisicoes_ajax").append(data.responseText); | |
46 | + $('#poll').modal('show'); | |
47 | + }); | |
48 | + }, | |
49 | + update: function(url,dados, slug_poll, slug_topic){ | |
21 | 50 | $('#poll').modal('hide'); |
22 | 51 | $.post(url,dados, function(data){ |
52 | + $('#list-topic-'+ slug_topic +'-poll #'+slug_poll).remove(); | |
53 | + $('#list-topic-'+ slug_topic +'-poll #'+slug_poll).remove(); | |
54 | + $('#list-topic-'+ slug_topic +'-poll').append(data); | |
55 | + $('#list-topic-'+ slug_topic +'-poll-edit').append(data); | |
56 | + $("#requisicoes_ajax").empty(); | |
57 | + alertify.alert('Link successfully updated!') | |
23 | 58 | }).fail(function(data){ |
24 | 59 | $("div.modal-backdrop.fade.in").remove(); |
25 | - $("#modal_poll").empty(); | |
26 | - $("#modal_poll").append(data.responseText); | |
60 | + $("#requisicoes_ajax").empty(); | |
61 | + $("#requisicoes_ajax").append(data.responseText); | |
62 | + $('#poll').modal('show'); | |
27 | 63 | }); |
28 | 64 | }, |
29 | 65 | remove: function(url,dados, id_li_link){ |
30 | 66 | $('#poll').modal('hide'); |
31 | 67 | $.post(url,dados, function(data){ |
32 | 68 | $(id_li_link).remove(); |
33 | - $("#modal_poll").empty(); | |
69 | + $(id_li_link+"_div").remove(); | |
70 | + $("#requisicoes_ajax").empty(); | |
34 | 71 | $("div.modal-backdrop.fade.in").remove(); |
35 | 72 | }).fail(function(){ |
36 | - $("#modal_poll").empty(); | |
37 | - $("#modal_poll").append(data); | |
73 | + $("#requisicoes_ajax").empty(); | |
74 | + $("#requisicoes_ajax").append(data); | |
38 | 75 | $('#poll').modal('show'); |
39 | 76 | }); |
40 | 77 | } | ... | ... |
poll/templates/poll/create.html
... | ... | @@ -2,13 +2,6 @@ |
2 | 2 | |
3 | 3 | {% load i18n widget_tweaks dict_access static%} |
4 | 4 | |
5 | -{# {% block style %} #} | |
6 | - <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> | |
7 | - <script src="{% static 'js/modal_poll.js' %}"></script> | |
8 | - | |
9 | -{# {% endblock %} #} | |
10 | - | |
11 | -{# {% block content %} #} | |
12 | 5 | <!-- Modal (remember to change the ids!!!) --> |
13 | 6 | <div class="modal fade" id="poll" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
14 | 7 | <div class="modal-dialog" role="document"> |
... | ... | @@ -178,7 +171,7 @@ |
178 | 171 | }); |
179 | 172 | |
180 | 173 | $("#form").submit(function(event) { |
181 | - Submite.post("{% url 'course:poll:create_poll' topic.slug %}",$(this).serialize()); | |
174 | + Submite.create("{% url 'course:poll:create_poll' topic.slug %}",$(this).serialize(), "{{topic.slug}}"); | |
182 | 175 | event.preventDefault(); |
183 | 176 | }); |
184 | 177 | </script> | ... | ... |
... | ... | @@ -0,0 +1,4 @@ |
1 | +<div id="poll_{{poll.slug}}_div"> | |
2 | + <li class="icon_edit_remove" ><a href="javascript:modal.get('{% url 'course:poll:update_poll' poll.slug %}','#poll','#requisicoes_ajax');"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('{% url 'course:poll:delete_poll' poll.slug %}','#poll','#requisicoes_ajax');"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | |
3 | + <li><i class="fa fa-bar-chart"></i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#requisicoes_ajax');">{{poll}}</a></li> | |
4 | +</div> | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +<li id="poll_{{poll.slug}}"><i class="fa fa-bar-chart"></i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#requisicoes_ajax');">{{ poll }}</a></li> | ... | ... |
poll/templates/poll/remove.html
... | ... | @@ -10,15 +10,15 @@ |
10 | 10 | {% block content_poll %} |
11 | 11 | <script src="{% static 'js/modal_poll.js' %}"></script> |
12 | 12 | <!-- Put ONLY your content here!!! --> |
13 | -<form id="delete_form" action="" method="post"> | |
13 | +<form id="delete_poll" action="" method="post"> | |
14 | 14 | {% csrf_token %} |
15 | 15 | <p>{% trans 'Are you sure you want to delete the subject' %} "{{poll.name}}"?</p> |
16 | 16 | </form> |
17 | 17 | {% endblock content_poll %} |
18 | 18 | {% block button_save %} |
19 | -<button type="submite" id="button" form="delete_form" class="btn btn-primary btn-raised">{% trans "Delete" %}</button> | |
19 | +<button type="submite" id="button" form="delete_poll" class="btn btn-primary btn-raised">{% trans "Delete" %}</button> | |
20 | 20 | <script> |
21 | - $("#delete_form").submit(function(event) { | |
21 | + $("#delete_poll").submit(function(event) { | |
22 | 22 | Submite.remove("{% url 'course:poll:delete_poll' poll.slug %}",$(this).serialize(),"#poll_{{poll.slug}}"); |
23 | 23 | event.preventDefault(); |
24 | 24 | }); | ... | ... |
poll/templates/poll/update.html
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | }); |
26 | 26 | |
27 | 27 | $("#form").submit(function(event) { |
28 | - Submite.post("{% url 'course:poll:update_poll' poll.slug %}",$(this).serialize()); | |
28 | + Submite.update("{% url 'course:poll:update_poll' poll.slug %}",$(this).serialize(), "{{poll.slug}}"); | |
29 | 29 | event.preventDefault(); |
30 | 30 | }); |
31 | 31 | </script> | ... | ... |
poll/urls.py
... | ... | @@ -9,4 +9,6 @@ urlpatterns = [ |
9 | 9 | url(r'^delete/(?P<slug>[\w\-_]+)/$', views.DeletePoll.as_view(), name='delete_poll'), # poll |
10 | 10 | url(r'^answer/$', views.AnswerPoll.as_view(), name='answer_poll'), # poll |
11 | 11 | url(r'^answer-poll/(?P<slug>[\w\-_]+)/$', views.AnswerStudentPoll.as_view(), name='answer_student_poll'), # poll slug |
12 | + url(r'^poll-view/(?P<slug>[\w\-_]+)/$', views.render_poll_view, name='render_poll_view'), # poll slug | |
13 | + url(r'^poll-edit/(?P<slug>[\w\-_]+)/$', views.render_poll_edit, name='render_poll_edit'), # poll slug | |
12 | 14 | ] | ... | ... |
poll/views.py
... | ... | @@ -20,6 +20,8 @@ from courses.models import Course, Topic |
20 | 20 | |
21 | 21 | import datetime |
22 | 22 | |
23 | +from django.http import JsonResponse | |
24 | + | |
23 | 25 | class ViewPoll(LoginRequiredMixin, LogMixin, generic.DetailView): |
24 | 26 | log_component = "poll" |
25 | 27 | log_resource = "poll" |
... | ... | @@ -96,7 +98,6 @@ class CreatePoll(LoginRequiredMixin,HasRoleMixin, LogMixin, NotificationMixin,ge |
96 | 98 | context.context_data['keys'] = keys |
97 | 99 | context.context_data['form'] = form |
98 | 100 | context.status_code = 400 |
99 | - s | |
100 | 101 | return context |
101 | 102 | |
102 | 103 | def form_valid(self, form): |
... | ... | @@ -107,7 +108,7 @@ class CreatePoll(LoginRequiredMixin,HasRoleMixin, LogMixin, NotificationMixin,ge |
107 | 108 | self.object.save() |
108 | 109 | |
109 | 110 | super(CreatePoll, self).createNotification(message="created a Poll at "+ self.object.topic.name, actor=self.request.user, |
110 | - resource_name=self.object.name, resource_link= reverse('course:view_topic', args=[self.object.topic.slug]), | |
111 | + resource_name=self.object.name, resource_link= reverse('course:view_topic', args=[self.object.topic.slug]), | |
111 | 112 | users=self.object.topic.subject.students.all()) |
112 | 113 | for key in self.request.POST: |
113 | 114 | if(key != 'csrfmiddlewaretoken' and key != 'name' and key != 'limit_date' and key != 'all_students' and key != 'students'): |
... | ... | @@ -130,7 +131,14 @@ class CreatePoll(LoginRequiredMixin,HasRoleMixin, LogMixin, NotificationMixin,ge |
130 | 131 | |
131 | 132 | super(CreatePoll, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) |
132 | 133 | |
133 | - return self.render_to_response(self.get_context_data(form = form), status = 200) | |
134 | + return JsonResponse({"view":reverse_lazy('course:poll:render_poll_view', kwargs={'slug' : self.object.slug}), | |
135 | + "edit":reverse_lazy('course:poll:render_poll_edit', kwargs={'slug' : self.object.slug}), | |
136 | + }) | |
137 | + | |
138 | + | |
139 | + # def get_success_url(self): | |
140 | + # self.success_url = redirect('course:poll:render_poll', slug = self.object.slug) | |
141 | + # return self.success_url | |
134 | 142 | |
135 | 143 | def get_context_data(self, **kwargs): |
136 | 144 | context = super(CreatePoll, self).get_context_data(**kwargs) |
... | ... | @@ -141,6 +149,20 @@ class CreatePoll(LoginRequiredMixin,HasRoleMixin, LogMixin, NotificationMixin,ge |
141 | 149 | context['subjects'] = topic.subject.course.subjects.all() |
142 | 150 | return context |
143 | 151 | |
152 | +def render_poll_view(request, slug): | |
153 | + template_name = 'poll/poll_view.html' | |
154 | + context = { | |
155 | + 'poll': get_object_or_404(Poll, slug = slug) | |
156 | + } | |
157 | + return render(request, template_name, context) | |
158 | + | |
159 | +def render_poll_edit(request, slug): | |
160 | + template_name = 'poll/poll_edit.html' | |
161 | + context = { | |
162 | + 'poll': get_object_or_404(Poll, slug = slug) | |
163 | + } | |
164 | + return render(request, template_name, context) | |
165 | + | |
144 | 166 | class UpdatePoll(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.UpdateView): |
145 | 167 | log_component = "poll" |
146 | 168 | log_resource = "poll" |
... | ... | @@ -325,9 +347,9 @@ class AnswerStudentPoll(LoginRequiredMixin, LogMixin, generic.CreateView): |
325 | 347 | |
326 | 348 | date_time_click = datetime.datetime.strptime(self.request.session.get('time_spent'), "%Y-%m-%d %H:%M:%S.%f") |
327 | 349 | _now = datetime.datetime.now() |
328 | - | |
350 | + | |
329 | 351 | time_spent = _now - date_time_click |
330 | - | |
352 | + | |
331 | 353 | secs = time_spent.total_seconds() |
332 | 354 | hours = int(secs / 3600) |
333 | 355 | minutes = int(secs / 60) % 60 | ... | ... |