Commit 67fa72da441b4c2a0fde2a2a9345c47948ca3584
1 parent
37c7a084
Exists in
master
and in
2 other branches
Adjusting bulletin templates for non student users
Showing
2 changed files
with
42 additions
and
1 deletions
Show diff stats
bulletin/templates/bulletin/view.html
... | ... | @@ -31,6 +31,7 @@ |
31 | 31 | {% endif %} |
32 | 32 | |
33 | 33 | {% resource_permissions request.user bulletin as has_resource_permissions %} |
34 | + {% subject_permissions request.user bulletin.topic.subject as has_subject_permissions %} | |
34 | 35 | |
35 | 36 | {% if bulletin.visible %} |
36 | 37 | <div class="panel panel-info topic-panel"> |
... | ... | @@ -55,6 +56,18 @@ |
55 | 56 | </div> |
56 | 57 | </div> |
57 | 58 | <div id="{{subject.slug}}" class="panel-collapse in collapse category-panel-content"> |
59 | + {% if has_subject_permissions %} | |
60 | + <form id="student_bulletin" action="" method="POST"> | |
61 | + {% csrf_token %} | |
62 | + <select name="selected_student" onchange="$('#student_bulletin').submit();"> | |
63 | + {% for stu in students %} | |
64 | + <option value="{{ stu.email }}" {% if stu.email == student %}selected{% endif %}>{{ stu }}</option> | |
65 | + {% endfor %} | |
66 | + </select> | |
67 | + </form> | |
68 | + <br clear="all" /> | |
69 | + {% endif %} | |
70 | + | |
58 | 71 | {% autoescape off %} |
59 | 72 | {{ bulletin.content }} |
60 | 73 | {% endautoescape %} |
... | ... | @@ -179,6 +192,7 @@ |
179 | 192 | </div> |
180 | 193 | </div> |
181 | 194 | |
195 | + {% if not has_subject_permissions %} | |
182 | 196 | <div class="form-group" style="background-color:#fff; box-shadow: 1px 1px 25px #c0beaf; margin-top: 15px;"> |
183 | 197 | <div class="row"> |
184 | 198 | <div class="col-md-1" align="left" style="padding-left: 25px; padding-top: 10px;"> |
... | ... | @@ -212,6 +226,13 @@ |
212 | 226 | </div> |
213 | 227 | </div> |
214 | 228 | </div> |
229 | + {% endif %} | |
230 | + | |
231 | + {% block addtional_scripts %} | |
232 | + <script type="text/javascript"> | |
233 | + sessionSecurity.confirmFormDiscard = undefined; | |
234 | + </script> | |
235 | + {% endblock %} | |
215 | 236 | |
216 | 237 | |
217 | 238 | <script type="text/javascript"> | ... | ... |
bulletin/templates/bulletin/window_view.html
1 | 1 | <!DOCTYPE html> |
2 | 2 | |
3 | -{% load static i18n util_tags %} | |
3 | +{% load static i18n permissions_tags util_tags %} | |
4 | 4 | {% load widget_tweaks %} |
5 | 5 | |
6 | 6 | <html> |
... | ... | @@ -64,7 +64,21 @@ |
64 | 64 | <link rel="stylesheet" href="{% static 'css/estilo.css' %}"> |
65 | 65 | </head> |
66 | 66 | <body style="background: #FFF"> |
67 | + | |
68 | + {% subject_permissions request.user bulletin.topic.subject as has_subject_permissions %} | |
67 | 69 | <div class="container-fluid" style="padding-top: 20px;"> |
70 | + {% if has_subject_permissions %} | |
71 | + <form id="student_bulletin" action="" method="POST"> | |
72 | + {% csrf_token %} | |
73 | + <select name="selected_student" onchange="$('#student_bulletin').submit();"> | |
74 | + {% for stu in students %} | |
75 | + <option value="{{ stu.email }}" {% if stu.email == student %}selected{% endif %}>{{ stu }}</option> | |
76 | + {% endfor %} | |
77 | + </select> | |
78 | + </form> | |
79 | + <br clear="all" /> | |
80 | + {% endif %} | |
81 | + | |
68 | 82 | {% autoescape off %} |
69 | 83 | {{ bulletin.content }} |
70 | 84 | {% endautoescape %} |
... | ... | @@ -189,6 +203,7 @@ |
189 | 203 | </div> |
190 | 204 | </div> |
191 | 205 | |
206 | + {% if not has_subject_permissions %} | |
192 | 207 | <div class="form-group" style="background-color:#fff; box-shadow: 1px 1px 25px #c0beaf; margin-top: 15px;"> |
193 | 208 | <div class="row"> |
194 | 209 | <div class="col-md-1" align="left" style="padding-left: 25px; padding-top: 10px;"> |
... | ... | @@ -222,7 +237,12 @@ |
222 | 237 | </div> |
223 | 238 | </div> |
224 | 239 | </div> |
240 | + {% endif %} | |
225 | 241 | |
242 | +{% include 'session_security/all.html' %} | |
243 | + <script type="text/javascript"> | |
244 | + sessionSecurity.confirmFormDiscard = undefined; | |
245 | + </script> | |
226 | 246 | |
227 | 247 | <script type="text/javascript"> |
228 | 248 | // Variável obtidas a partir do número de metas atendidas | ... | ... |