app/assets/javascripts/spree/backend/taxonomy.js.coffee in spree_backend-3.0.0.rc3 vs app/assets/javascripts/spree/backend/taxonomy.js.coffee in spree_backend-3.0.0.rc4
- old
+ new
@@ -12,11 +12,16 @@
url.setPath url.path() + '/' + node.prop("id")
$.ajax
type: "POST",
dataType: "json",
url: url.toString(),
- data: ({_method: "put", "taxon[parent_id]": new_parent.prop("id"), "taxon[child_index]": position }),
+ data: {
+ _method: "put",
+ "taxon[parent_id]": new_parent.prop("id"),
+ "taxon[child_index]": position,
+ token: Spree.api_key
+ },
error: handle_ajax_error
true
handle_create = (e, data) ->
@@ -28,11 +33,16 @@
$.ajax
type: "POST",
dataType: "json",
url: base_url.toString(),
- data: ({"taxon[name]": name, "taxon[parent_id]": new_parent.prop("id"), "taxon[child_index]": position }),
+ data: {
+ "taxon[name]": name,
+ "taxon[parent_id]": new_parent.prop("id"),
+ "taxon[child_index]": position,
+ token: Spree.api_key
+ },
error: handle_ajax_error,
success: (data,result) ->
node.prop('id', data.id)
handle_rename = (e, data) ->
@@ -45,11 +55,15 @@
$.ajax
type: "POST",
dataType: "json",
url: url.toString(),
- data: {_method: "put", "taxon[name]": name },
+ data: {
+ _method: "put",
+ "taxon[name]": name,
+ token: Spree.api_key
+ },
error: handle_ajax_error
handle_delete = (e, data) ->
last_rollback = data.rlbk
node = data.rslt.obj
@@ -59,11 +73,14 @@
if response
$.ajax
type: "POST",
dataType: "json",
url: delete_url.toString(),
- data: {_method: "delete"},
+ data: {
+ _method: "delete",
+ token: Spree.api_key
+ },
error: handle_ajax_error
else
$.jstree.rollback(last_rollback)
last_rollback = null
@@ -73,18 +90,20 @@
# this is defined within admin/taxonomies/edit
root.base_url = Spree.url(Spree.routes.taxonomy_taxons_path)
$.ajax
url: Spree.url(base_url.path().replace("/taxons", "/jstree")).toString(),
+ data:
+ token: Spree.api_key
success: (taxonomy) ->
last_rollback = null
conf =
json_data:
data: taxonomy,
ajax:
url: (e) ->
- Spree.url(base_url.path() + '/' + e.prop('id') + '/jstree').toString()
+ Spree.url(base_url.path() + '/' + e.prop('id') + '/jstree' + '?token=' + Spree.api_key).toString()
themes:
theme: "apple",
url: Spree.url(Spree.routes.jstree_theme_path)
strings:
new_node: new_taxon,