Commit 373f2834b2466d653648a792addf506e51e38b5f
1 parent
8ddbf9d3
Exists in
master
and in
13 other branches
Adding feedback to user while setting email as primary - closes #59
The delay was causing an effect that nothing was happening behind the scenes, but everything is working alright
Showing
1 changed file
with
22 additions
and
3 deletions
Show diff stats
src/accounts/templates/accounts/user_update_form.html
| ... | ... | @@ -4,6 +4,11 @@ |
| 4 | 4 | {% block head_js %} |
| 5 | 5 | <script> |
| 6 | 6 | $(function() { |
| 7 | + | |
| 8 | + // Reset buttons to default state | |
| 9 | + $('.set-primary').button('reset'); | |
| 10 | + $('.delete-email').button('reset'); | |
| 11 | + | |
| 7 | 12 | $('#add-email').on('click', function(event) { |
| 8 | 13 | $.ajax({ |
| 9 | 14 | url: "{% url 'archive_email_view' %}", |
| ... | ... | @@ -61,6 +66,7 @@ $(function() { |
| 61 | 66 | $('#alert-js').removeClass('alert-warning').addClass('alert-success'); |
| 62 | 67 | $('#alert-js').show(); |
| 63 | 68 | window.scroll(0, 0); |
| 69 | + $('.verify-email').button('reset'); | |
| 64 | 70 | }); |
| 65 | 71 | |
| 66 | 72 | event.preventDefault(); |
| ... | ... | @@ -82,6 +88,19 @@ $(function() { |
| 82 | 88 | event.preventDefault(); |
| 83 | 89 | }); |
| 84 | 90 | |
| 91 | + // User feedbacks | |
| 92 | + $('.panel-default').on('click', '.set-primary', function() { | |
| 93 | + $('.set-primary').button('loading'); | |
| 94 | + }); | |
| 95 | + | |
| 96 | + $('.panel-default').on('click', '.verify-email', function() { | |
| 97 | + $('.verify-email').button('loading'); | |
| 98 | + }); | |
| 99 | + | |
| 100 | + $('.panel-default').on('click', '.delete-email', function() { | |
| 101 | + $('.delete-email').button('loading'); | |
| 102 | + }); | |
| 103 | + | |
| 85 | 104 | }); |
| 86 | 105 | </script> |
| 87 | 106 | {% endblock %} |
| ... | ... | @@ -135,8 +154,8 @@ $(function() { |
| 135 | 154 | <span class="label label-success">{% trans "Primary" %}</span> |
| 136 | 155 | {% else %} |
| 137 | 156 | <div class="text-right"> |
| 138 | - <button class="btn btn-default set-primary">{% trans "Set as Primary" %}</button> | |
| 139 | - <button class="btn btn-danger delete-email">{% trans "Delete" %}</button> | |
| 157 | + <button class="btn btn-default set-primary" data-loading-text="{% trans 'Setting...' %}">{% trans "Set as Primary" %}</button> | |
| 158 | + <button class="btn btn-danger delete-email" data-loading-text="{% trans 'Deleting...' %}">{% trans "Delete" %}</button> | |
| 140 | 159 | </div> |
| 141 | 160 | {% endif %} |
| 142 | 161 | <hr /> |
| ... | ... | @@ -147,7 +166,7 @@ $(function() { |
| 147 | 166 | {% gravatar user_.email 30 %} |
| 148 | 167 | <span class="email-address">{{ email.address }}</span> |
| 149 | 168 | <div class="text-right"> |
| 150 | - <button class="btn btn-default verify-email"><span class="icon-warning-sign"></span> {% trans "Verify" %}</button> | |
| 169 | + <button class="btn btn-default verify-email" data-loading-text="{% trans 'Sending verification...' %}"><span class="icon-warning-sign"></span> {% trans "Verify" %}</button> | |
| 151 | 170 | <button class="btn btn-danger delete-email">{% trans "Delete" %}</button> |
| 152 | 171 | </div> |
| 153 | 172 | <hr /> | ... | ... |