cell: display error message on ajax call failure (#29124)
This commit is contained in:
parent
de7f5dbb15
commit
be7053850f
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue