Skip to content

Commit

Permalink
Move submit modal dialog error message from progress bar to alert box
Browse files Browse the repository at this point in the history
In the submit modal dialog in chapters, the error message
was displayed inside a progress bar. That was not a good idea
since it was hard to read and the latter half of the message
disappeared since it did not fit into the progress bar. The
error message is now moved to a separate alert box above
the progress bar.
  • Loading branch information
ihalaij1 committed Jun 7, 2023
1 parent d33e581 commit fe697fe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
10 changes: 7 additions & 3 deletions assets/js/aplus.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ $(function() {
var defaults = {
loader_selector: ".modal-progress",
loader_text_selector: ".progress-bar",
alert_text_selector: ".modal-submit-error",
title_selector: ".modal-title",
content_selector: ".modal-body",
error_message_attribute: "data-msg-error",
Expand All @@ -382,6 +383,7 @@ $(function() {
init: function() {
this.loader = this.element.find(this.settings.loader_selector);
this.loaderText = this.loader.find(this.settings.loader_text_selector);
this.alertText = this.loader.find(this.settings.alert_text_selector);
this.title = this.element.find(this.settings.title_selector);
this.content = this.element.find(this.settings.content_selector);
this.messages = {
Expand All @@ -407,6 +409,7 @@ $(function() {
open: function(data) {
this.title.hide();
this.content.hide();
this.alertText.hide();
this.loaderText
.removeClass('progress-bar-danger').addClass('active')
.text(data || this.messages.loading);
Expand All @@ -418,9 +421,10 @@ $(function() {
},

showError: function(data) {
this.loaderText
.removeClass('active').addClass('progress-bar-danger')
.text(data || this.messages.error);
if (data) {
this.alertText.text(data).show();
}
this.loaderText.removeClass('active').addClass('progress-bar-danger').text(this.messages.error);
},

showContent: function(data) {
Expand Down
4 changes: 2 additions & 2 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-30 12:30+0300\n"
"POT-Creation-Date: 2023-06-07 08:55+0300\n"
"PO-Revision-Date: 2021-05-27 14:47+0300\n"
"Last-Translator: Jimmy Ihalainen <jimmy.ihalainen@aalto.fi>\n"
"Language-Team: English<>\n"
Expand Down Expand Up @@ -3825,7 +3825,7 @@ msgid "TOTAL_NUMBER_OF_SUBMITTERS"
msgstr "Total number of submitters"

#: exercise/templates/exercise/_exercise_wait.html
#: exercise/templates/exercise/exercise.html
#: exercise/templates/exercise/exercise.html templates/base.html
msgid "EXERCISE_ERROR_COMMUNICATION"
msgstr ""
"There was a problem loading the assignment. Try loading the page again "
Expand Down
4 changes: 2 additions & 2 deletions locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-30 12:30+0300\n"
"POT-Creation-Date: 2023-06-07 08:55+0300\n"
"PO-Revision-Date: 2019-08-14 12:16+0200\n"
"Last-Translator: Jimmy Ihalainen <jimmy.ihalainen@aalto.fi>\n"
"Language-Team: Finnish <>\n"
Expand Down Expand Up @@ -3833,7 +3833,7 @@ msgid "TOTAL_NUMBER_OF_SUBMITTERS"
msgstr "Palauttaneita opiskelijoita yhteensä"

#: exercise/templates/exercise/_exercise_wait.html
#: exercise/templates/exercise/exercise.html
#: exercise/templates/exercise/exercise.html templates/base.html
msgid "EXERCISE_ERROR_COMMUNICATION"
msgstr ""
"Tehtävän lataaminen epäonnistui. Yritä uudelleen myöhemmin. "
Expand Down
3 changes: 3 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ <h4>{% translate "SITE" %}</h4>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-progress">
<div class="modal-submit-error alert alert-danger" style="display:none">
{% translate "EXERCISE_ERROR_COMMUNICATION" %}
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%"
data-msg-error="{% translate 'LOADING_FAILED' %}">
Expand Down

0 comments on commit fe697fe

Please sign in to comment.