Skip to content

Commit

Permalink
Add UI feedback to notifier test button
Browse files Browse the repository at this point in the history
After clicking the notifier test button, it can take some time until the request
is processed, the response is received and the whole form submission ends up on
a page refresh.

Because of that potential delay, the users may think that they did not click the
button properly and try to click it again.

To avoid that situation we have added some UI feedback so when the users click
the test button, it gets disabled so they cannot click it again, and also its
text changes to "Testing..." to clearly state that the test is ongoing.

The corresponding localization for "Testing" has also been added.
  • Loading branch information
vincent-olivert-riera committed Jan 26, 2024
1 parent 07b60f7 commit ed58967
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Binary file modified promgen/locale/ja/LC_MESSAGES/django.mo
Binary file not shown.
4 changes: 4 additions & 0 deletions promgen/locale/ja/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ msgstr "Expire"
msgid "Test"
msgstr "テスト"

#: templates/promgen/sender_row.html:45
msgid "Testing"
msgstr "テスト中"

#: templates/promgen/notifier_block.html:19
msgid "Delete notification?"
msgstr "Notificiationを削除しますか?"
Expand Down
7 changes: 6 additions & 1 deletion promgen/templates/promgen/sender_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@
<form method="post" action="{% url 'notifier-test' notifier.id %}" style="display: inline">
{% csrf_token %}
<input name="next" type="hidden" value="{{ request.get_full_path }}" />
<button class="btn btn-info btn-xs">{% trans "Test" %}</button>
<button
class="btn btn-info btn-xs"
onclick="this.disabled=true; this.innerHTML='{% trans "Testing" %}...';"
>
{% trans "Test" %}
</button>
</form>
<form method="post" action="{% url 'notifier-delete' notifier.id %}" onsubmit="return confirm('{% trans "Delete notification?" %}')" style="display: inline">
{% csrf_token %}
Expand Down

0 comments on commit ed58967

Please sign in to comment.