summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauréline Guérin <zebuline@entrouvert.com>2019-10-21 12:38:29 (GMT)
committerLauréline Guérin <zebuline@entrouvert.com>2019-11-20 15:36:44 (GMT)
commitbe7053850ff3c2b144904e25aed54e0f92521355 (patch)
tree73bfd40184819c7df5d4a7b0bc2c67776b2d06c3
parentde7f5dbb1517bead2a127a9adcc847de55d4ade1 (diff)
downloadcombo-wip/29124-loading.zip
combo-wip/29124-loading.tar.gz
combo-wip/29124-loading.tar.bz2
cell: display error message on ajax call failure (#29124)wip/29124-loading
-rw-r--r--combo/apps/dashboard/templates/combo/dashboardcell.html1
-rw-r--r--combo/public/static/js/combo.public.js6
-rw-r--r--combo/public/templates/combo/placeholder.html1
3 files changed, 7 insertions, 1 deletions
diff --git a/combo/apps/dashboard/templates/combo/dashboardcell.html b/combo/apps/dashboard/templates/combo/dashboardcell.html
index 729f6c7..daf7666 100644
--- a/combo/apps/dashboard/templates/combo/dashboardcell.html
+++ b/combo/apps/dashboard/templates/combo/dashboardcell.html
@@ -5,6 +5,7 @@
<div class="cell {{ cell.css_class_names }} {% if cell.slug %}{{cell.slug}}{% endif %}"
data-ajax-cell-url="{{ site_base }}{% url 'combo-public-ajax-page-cell' page_pk=cell.page.id cell_reference=cell.get_reference %}"
data-ajax-cell-loading-message="{{ cell.loading_message }}"
+ data-ajax-cell-error-message="{% trans "Loading error" %}"
{% if cell.ajax_refresh %}
data-ajax-cell-refresh="{{ cell.ajax_refresh }}"
{% endif %}><div>{% render_cell cell %}</div></div>
diff --git a/combo/public/static/js/combo.public.js b/combo/public/static/js/combo.public.js
index d26c6fc..0ba0b76 100644
--- a/combo/public/static/js/combo.public.js
+++ b/combo/public/static/js/combo.public.js
@@ -28,7 +28,11 @@ function combo_load_cell(elem) {
$(document).trigger('combo:cell-loaded', $elem);
},
error: function(error) {
- $elem.find('.loading').addClass('error-loading');
+ var msg = $(elem).data('ajax-cell-error-message');
+ $elem
+ .find('.loading')
+ .addClass('error-loading')
+ .html('<span class="loading-message">' + msg + '</span>');
window.console && console.log(':(', error);
}
});
diff --git a/combo/public/templates/combo/placeholder.html b/combo/public/templates/combo/placeholder.html
index 695dbdc..dfa97e3 100644
--- a/combo/public/templates/combo/placeholder.html
+++ b/combo/public/templates/combo/placeholder.html
@@ -8,6 +8,7 @@
{% if cell.slug and cell.use_slug_as_id %}id="{{ cell.slug }}"{% endif %}
data-ajax-cell-url="{{ site_base }}{% url 'combo-public-ajax-page-cell' page_pk=cell.page.id cell_reference=cell.get_reference %}"
data-ajax-cell-loading-message="{{ cell.loading_message }}"
+ data-ajax-cell-error-message="{% trans "Loading error" %}"
{% if cell.ajax_refresh %}data-ajax-cell-refresh="{{ cell.ajax_refresh }}"{% endif %}
{% if request.extra_context_data %}data-extra-context="{{ request.extra_context_data|signed|urlencode }}"{% endif %}
><div>{% render_cell cell %}</div></div>