Commit c34fa37bff08754cacc73cee8a3f89db1195d684
1 parent
e0716354
Exists in
master
and in
39 other branches
Adding alert msg when voting fails
Showing
2 changed files
with
15 additions
and
10 deletions
Show diff stats
src/colab/deprecated/templates/base.html
@@ -127,6 +127,10 @@ | @@ -127,6 +127,10 @@ | ||
127 | {{ message }} | 127 | {{ message }} |
128 | </div> | 128 | </div> |
129 | {% endfor %} | 129 | {% endfor %} |
130 | + <div id="alert-js" class="alert alert-dismissable alert-warning" hidden> | ||
131 | + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
132 | + <span id="alert-message"></span> | ||
133 | + </div> | ||
130 | {% endblock %} | 134 | {% endblock %} |
131 | 135 | ||
132 | {% block header %}{% endblock %} | 136 | {% block header %}{% endblock %} |
src/super_archives/templates/message-thread.html
@@ -33,16 +33,17 @@ | @@ -33,16 +33,17 @@ | ||
33 | } | 33 | } |
34 | 34 | ||
35 | function vote_fail_callback(jqXHR, textStatus, errorThrown) { | 35 | function vote_fail_callback(jqXHR, textStatus, errorThrown) { |
36 | - alert('error'); | ||
37 | - //error_msg = '<b>Seu voto não foi computado.</b>' | ||
38 | - //if (jqXHR.status === 401) { | ||
39 | - // error_msg += ' Você deve estar autenticado para votar.'; | ||
40 | - //} else { | ||
41 | - // error_msg += ' Erro desconhecido ao tentando votar.'; | ||
42 | - //} | ||
43 | - | ||
44 | - //jQuery('#vote-notification').html(error_msg).removeClass('hide'); | ||
45 | - //scroll(0, 0); | 36 | + var msg; |
37 | + | ||
38 | + if (jqXHR.status === 403) { | ||
39 | + msg = " {% trans 'You must login before voting.' %}" | ||
40 | + } else { | ||
41 | + return; | ||
42 | + } | ||
43 | + | ||
44 | + $('#alert-js #alert-message').html(msg); | ||
45 | + $('#alert-js').show(); | ||
46 | + scroll(0, 0); | ||
46 | } | 47 | } |
47 | 48 | ||
48 | function get_vote_ajax_dict(msg_id, method) { | 49 | function get_vote_ajax_dict(msg_id, method) { |