app/assets/javascripts/spree/backend/taxonomy.js.coffee in spree_backend-3.4.6 vs app/assets/javascripts/spree/backend/taxonomy.js.coffee in spree_backend-3.5.0.rc1
- old
+ new
@@ -1,8 +1,8 @@
-handle_ajax_error = (XMLHttpRequest, textStatus, errorThrown) ->
+handle_ajax_error = (last_rollback) ->
$.jstree.rollback(last_rollback)
- $("#ajax_error").show().html("<strong>" + Spree.translations.server_error + "</strong><br />" + Spree.translations.taxonomy_tree_error)
+ show_flash("error", "<strong>" + Spree.translations.server_error + "</strong><br />" + Spree.translations.taxonomy_tree_error)
handle_move = (e, data) ->
last_rollback = data.rlbk
position = data.rslt.cp
node = data.rslt.o
@@ -18,11 +18,12 @@
_method: "put",
"taxon[parent_id]": new_parent.prop("id"),
"taxon[child_index]": position,
token: Spree.api_key
},
- error: handle_ajax_error
+ error: (XMLHttpRequest, textStatus, errorThrown) ->
+ handle_ajax_error(last_rollback)
true
handle_create = (e, data) ->
last_rollback = data.rlbk
@@ -39,11 +40,12 @@
"taxon[name]": name,
"taxon[parent_id]": new_parent.prop("id"),
"taxon[child_index]": position,
token: Spree.api_key
},
- error: handle_ajax_error,
+ error: (XMLHttpRequest, textStatus, errorThrown) ->
+ handle_ajax_error(last_rollback)
success: (data,result) ->
node.prop('id', data.id)
handle_rename = (e, data) ->
last_rollback = data.rlbk
@@ -60,11 +62,12 @@
data: {
_method: "put",
"taxon[name]": name,
token: Spree.api_key
},
- error: handle_ajax_error
+ error: (XMLHttpRequest, textStatus, errorThrown) ->
+ handle_ajax_error(last_rollback)
handle_delete = (e, data) ->
last_rollback = data.rlbk
node = data.rslt.obj
delete_url = base_url.clone()
@@ -77,10 +80,11 @@
url: delete_url.toString(),
data: {
_method: "delete",
token: Spree.api_key
},
- error: handle_ajax_error
+ error: (XMLHttpRequest, textStatus, errorThrown) ->
+ handle_ajax_error(last_rollback)
else
$.jstree.rollback(last_rollback)
last_rollback = null
root = exports ? this