spree_backend 2.2.14 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +22 -0
- data/app/assets/javascripts/spree/backend/adjustments.js.coffee +2 -3
- data/app/assets/javascripts/spree/backend/admin.js.erb +2 -2
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +1 -4
- data/app/assets/javascripts/spree/backend/images/index.js.coffee +0 -1
- data/app/assets/javascripts/spree/backend/line_items.js.coffee +1 -4
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +3 -5
- data/app/assets/javascripts/spree/backend/orders/edit_form.js +2 -3
- data/app/assets/javascripts/spree/backend/payments/edit.js.coffee +2 -1
- data/app/assets/javascripts/spree/backend/payments/new.js +0 -4
- data/app/assets/javascripts/spree/backend/product_picker.js +3 -5
- data/app/assets/javascripts/spree/backend/select_payments.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/shipments.js.erb +27 -37
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +4 -4
- data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +1 -2
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +1 -3
- data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +5 -24
- data/app/assets/javascripts/spree/backend/taxons.js.coffee +2 -4
- data/app/assets/javascripts/spree/backend/user_picker.js +2 -3
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +35 -0
- data/app/assets/stylesheets/spree/backend/components/_date-picker.scss +2 -0
- data/app/assets/stylesheets/spree/backend/globals/_variables.scss +9 -19
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +1 -1
- data/app/controllers/spree/admin/adjustments_controller.rb +14 -1
- data/app/controllers/spree/admin/general_settings_controller.rb +17 -3
- data/app/controllers/spree/admin/orders_controller.rb +11 -8
- data/app/controllers/spree/admin/payments_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +1 -1
- data/app/controllers/spree/admin/promotions_controller.rb +1 -1
- data/app/helpers/spree/admin/adjustments_helper.rb +1 -1
- data/app/views/spree/admin/general_settings/edit.html.erb +32 -8
- data/app/views/spree/admin/log_entries/_credit_card.html.erb +4 -0
- data/app/views/spree/admin/log_entries/index.html.erb +2 -5
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +5 -7
- data/app/views/spree/admin/option_types/edit.html.erb +9 -2
- data/app/views/spree/admin/orders/_form.html.erb +4 -5
- data/app/views/spree/admin/orders/_line_items.html.erb +1 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +3 -3
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +2 -2
- data/app/views/spree/admin/orders/index.html.erb +2 -8
- data/app/views/spree/admin/payments/_list.html.erb +1 -1
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +1 -1
- data/app/views/spree/admin/product_properties/index.html.erb +3 -3
- data/app/views/spree/admin/products/_form.html.erb +3 -4
- data/app/views/spree/admin/products/new.html.erb +3 -3
- data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +0 -1
- data/app/views/spree/admin/promotions/index.html.erb +4 -4
- data/app/views/spree/admin/properties/index.html.erb +1 -1
- data/app/views/spree/admin/prototypes/_form.html.erb +2 -2
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +1 -1
- data/app/views/spree/admin/shared/_configuration_menu.html.erb +0 -3
- data/app/views/spree/admin/shared/_destroy.js.erb +1 -1
- data/app/views/spree/admin/shared/_head.html.erb +1 -3
- data/app/views/spree/admin/shared/_product_tabs.html.erb +1 -0
- data/app/views/spree/admin/shared/_tabs.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/_form.html.erb +1 -1
- data/app/views/spree/admin/stock_movements/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/index.html.erb +1 -1
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -1
- data/app/views/spree/admin/variants/_split.js.erb +1 -1
- data/app/views/spree/layouts/admin.html.erb +0 -4
- data/config/routes.rb +0 -5
- data/lib/spree/backend.rb +2 -6
- data/lib/spree/backend/engine.rb +1 -0
- data/vendor/assets/javascripts/handlebars.js +1808 -982
- metadata +13 -16
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js.erb +0 -49
- data/app/controllers/spree/admin/mail_methods_controller.rb +0 -31
- data/app/views/spree/admin/mail_methods/_form.html.erb +0 -80
- data/app/views/spree/admin/mail_methods/edit.html.erb +0 -21
- data/app/views/spree/admin/shared/_routes.html.erb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a6c692cd83aec89a4023acd65033394747f4650
|
4
|
+
data.tar.gz: 755427877461d3f88c63f66474b3bdf085e3fc7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fd47ea8edf040ac138306306aca56696c7445e5e628733acfb3a8366765ba632f392df762ce6bbac4fa6f81c527920b11e7386d5c7dbb313d5f492671bf8849
|
7
|
+
data.tar.gz: ccc6f145bba25155cd8b2750be3fb28035133ab640947fa03cb32e4ed152e1dfb2f4f21412acbd7bb51e4dc0da8f94c9cf8bb0e9e1421565fb946fd4dcd54096
|
@@ -20,3 +20,25 @@
|
|
20
20
|
//= require spree
|
21
21
|
//= require spree/backend/spree-select2
|
22
22
|
//= require_tree .
|
23
|
+
|
24
|
+
|
25
|
+
Spree.routes.checkouts_api = Spree.pathFor('api/checkouts')
|
26
|
+
Spree.routes.classifications_api = Spree.pathFor('api/classifications')
|
27
|
+
Spree.routes.option_type_search = Spree.pathFor('api/option_types')
|
28
|
+
Spree.routes.orders_api = Spree.pathFor('api/orders')
|
29
|
+
Spree.routes.product_search = Spree.pathFor('api/products')
|
30
|
+
Spree.routes.shipments_api = Spree.pathFor('api/shipments')
|
31
|
+
Spree.routes.checkouts_api = Spree.pathFor('api/checkouts')
|
32
|
+
Spree.routes.stock_locations_api = Spree.pathFor('api/stock_locations')
|
33
|
+
Spree.routes.taxon_products_api = Spree.pathFor('api/taxons/products')
|
34
|
+
Spree.routes.taxons_search = Spree.pathFor('api/taxons')
|
35
|
+
Spree.routes.user_search = Spree.pathFor('admin/search/users')
|
36
|
+
Spree.routes.variants_api = Spree.pathFor('api/variants')
|
37
|
+
|
38
|
+
Spree.routes.payments_api = function(order_id) {
|
39
|
+
return Spree.pathFor('api/orders/' + order_id + '/payments')
|
40
|
+
}
|
41
|
+
|
42
|
+
Spree.routes.stock_items_api = function(stock_location_id) {
|
43
|
+
return Spree.pathFor('api/stock_locations/' + stock_location_id + '/stock_items')
|
44
|
+
}
|
@@ -3,10 +3,9 @@ $(@).ready( ->
|
|
3
3
|
return if $("#coupon_code").val().length == 0
|
4
4
|
$.ajax
|
5
5
|
type: 'PUT'
|
6
|
-
url: Spree.url(Spree.routes.
|
6
|
+
url: Spree.url(Spree.routes.apply_coupon_code(order_number))
|
7
7
|
data:
|
8
8
|
coupon_code: $("#coupon_code").val()
|
9
|
-
token: Spree.api_key
|
10
9
|
success: ->
|
11
10
|
window.location.reload();
|
12
11
|
error: (msg) ->
|
@@ -14,4 +13,4 @@ $(@).ready( ->
|
|
14
13
|
show_flash 'error', msg.responseJSON["error"]
|
15
14
|
else
|
16
15
|
show_flash 'error', "There was a problem adding this coupon code."
|
17
|
-
)
|
16
|
+
)
|
@@ -140,11 +140,11 @@ $(document).ready(function(){
|
|
140
140
|
}
|
141
141
|
});
|
142
142
|
});
|
143
|
-
|
143
|
+
var uniqueId = 1;
|
144
144
|
$('.spree_add_fields').click(function() {
|
145
145
|
var target = $(this).data("target");
|
146
146
|
var new_table_row = $(target + ' tr:visible:last').clone();
|
147
|
-
var new_id = new Date().getTime();
|
147
|
+
var new_id = new Date().getTime() + (uniqueId++);
|
148
148
|
new_table_row.find("input, select").each(function () {
|
149
149
|
var el = $(this);
|
150
150
|
el.val("");
|
@@ -19,10 +19,7 @@ $(document).ready(function() {
|
|
19
19
|
url: Spree.routes.user_search,
|
20
20
|
datatype: 'json',
|
21
21
|
data: function(term, page) {
|
22
|
-
return {
|
23
|
-
q: term,
|
24
|
-
token: Spree.api_key
|
25
|
-
}
|
22
|
+
return { q: term }
|
26
23
|
},
|
27
24
|
results: function(data, page) {
|
28
25
|
return { results: data }
|
@@ -46,7 +46,6 @@ adjustLineItem = (line_item_id, quantity) ->
|
|
46
46
|
data:
|
47
47
|
line_item:
|
48
48
|
quantity: quantity
|
49
|
-
token: Spree.api_key
|
50
49
|
).done (msg) ->
|
51
50
|
advanceOrder()
|
52
51
|
|
@@ -55,10 +54,8 @@ deleteLineItem = (line_item_id) ->
|
|
55
54
|
$.ajax(
|
56
55
|
type: "DELETE"
|
57
56
|
url: Spree.url(url)
|
58
|
-
data:
|
59
|
-
token: Spree.api_key
|
60
57
|
).done (msg) ->
|
61
58
|
$('#line-item-' + line_item_id).remove()
|
62
59
|
if $('.line-items tr.line-item').length == 0
|
63
60
|
$('.line-items').remove()
|
64
|
-
advanceOrder()
|
61
|
+
advanceOrder()
|
@@ -7,8 +7,7 @@ $(document).ready(function () {
|
|
7
7
|
multiple: true,
|
8
8
|
initSelection: function (element, callback) {
|
9
9
|
var url = Spree.url(Spree.routes.option_type_search, {
|
10
|
-
ids: element.val()
|
11
|
-
token: Spree.api_key
|
10
|
+
ids: element.val()
|
12
11
|
});
|
13
12
|
return $.getJSON(url, null, function (data) {
|
14
13
|
return callback(data);
|
@@ -22,8 +21,7 @@ $(document).ready(function () {
|
|
22
21
|
return {
|
23
22
|
q: {
|
24
23
|
name_cont: term
|
25
|
-
}
|
26
|
-
token: Spree.api_key
|
24
|
+
}
|
27
25
|
};
|
28
26
|
},
|
29
27
|
results: function (data) {
|
@@ -40,4 +38,4 @@ $(document).ready(function () {
|
|
40
38
|
}
|
41
39
|
});
|
42
40
|
}
|
43
|
-
});
|
41
|
+
});
|
@@ -9,8 +9,7 @@ $(document).ready(function () {
|
|
9
9
|
|
10
10
|
$.post('/admin/orders/' + $('input#order_number').val() + '/line_items/' + $(id).val(), {
|
11
11
|
_method: 'put',
|
12
|
-
'line_item[quantity]': $(this).val()
|
13
|
-
token: Spree.api_key
|
12
|
+
'line_item[quantity]': $(this).val()
|
14
13
|
},
|
15
14
|
|
16
15
|
function (resp) {
|
@@ -18,4 +17,4 @@ $(document).ready(function () {
|
|
18
17
|
});
|
19
18
|
});
|
20
19
|
});
|
21
|
-
});
|
20
|
+
});
|
@@ -1,8 +1,9 @@
|
|
1
1
|
jQuery ($) ->
|
2
2
|
# Payment model
|
3
|
+
order_id = $('#payments').data('order-id')
|
3
4
|
class Payment
|
4
5
|
constructor: (id) ->
|
5
|
-
@url = Spree.url("#{Spree.routes.payments_api}/#{id}.json"
|
6
|
+
@url = Spree.url("#{Spree.routes.payments_api(order_id)}/#{id}.json")
|
6
7
|
@json = $.getJSON @url.toString(), (data) =>
|
7
8
|
@data = data
|
8
9
|
|
@@ -12,9 +12,7 @@ $(document).ready(function() {
|
|
12
12
|
$('.payment_methods_radios').click(
|
13
13
|
function() {
|
14
14
|
$('.payment-methods').hide();
|
15
|
-
$('.payment-methods input').prop('disabled', true);
|
16
15
|
if (this.checked) {
|
17
|
-
$('#payment_method_' + this.value + ' input').prop('disabled', false);
|
18
16
|
$('#payment_method_' + this.value).show();
|
19
17
|
}
|
20
18
|
}
|
@@ -23,11 +21,9 @@ $(document).ready(function() {
|
|
23
21
|
$('.payment_methods_radios').each(
|
24
22
|
function() {
|
25
23
|
if (this.checked) {
|
26
|
-
$('#payment_method_' + this.value + ' input').prop('disabled', false);
|
27
24
|
$('#payment_method_' + this.value).show();
|
28
25
|
} else {
|
29
26
|
$('#payment_method_' + this.value).hide();
|
30
|
-
$('#payment_method_' + this.value + ' input').prop('disabled', true);
|
31
27
|
}
|
32
28
|
|
33
29
|
if ($("#card_new" + this.value).is("*")) {
|
@@ -6,8 +6,7 @@ $.fn.productAutocomplete = function () {
|
|
6
6
|
multiple: true,
|
7
7
|
initSelection: function (element, callback) {
|
8
8
|
$.get(Spree.routes.product_search, {
|
9
|
-
ids: element.val().split(',')
|
10
|
-
token: Spree.api_key
|
9
|
+
ids: element.val().split(',')
|
11
10
|
}, function (data) {
|
12
11
|
callback(data.products);
|
13
12
|
});
|
@@ -21,8 +20,7 @@ $.fn.productAutocomplete = function () {
|
|
21
20
|
name_cont: term,
|
22
21
|
sku_cont: term
|
23
22
|
},
|
24
|
-
m: 'OR'
|
25
|
-
token: Spree.api_key
|
23
|
+
m: 'OR'
|
26
24
|
};
|
27
25
|
},
|
28
26
|
results: function (data, page) {
|
@@ -43,4 +41,4 @@ $.fn.productAutocomplete = function () {
|
|
43
41
|
|
44
42
|
$(document).ready(function () {
|
45
43
|
$('.product_picker').productAutocomplete();
|
46
|
-
});
|
44
|
+
});
|
@@ -65,10 +65,7 @@ $(document).ready(function () {
|
|
65
65
|
var url = Spree.url(Spree.routes.shipments_api + '/' + shipment_number + '/ship.json');
|
66
66
|
$.ajax({
|
67
67
|
type: 'PUT',
|
68
|
-
url: url
|
69
|
-
data: {
|
70
|
-
token: Spree.api_key
|
71
|
-
}
|
68
|
+
url: url
|
72
69
|
}).done(function () {
|
73
70
|
window.location.reload();
|
74
71
|
}).error(function (msg) {
|
@@ -95,8 +92,7 @@ $(document).ready(function () {
|
|
95
92
|
shipment: {
|
96
93
|
selected_shipping_rate_id: selected_shipping_rate_id,
|
97
94
|
unlock: unlock
|
98
|
-
}
|
99
|
-
token: Spree.api_key
|
95
|
+
}
|
100
96
|
}
|
101
97
|
}).done(function () {
|
102
98
|
window.location.reload();
|
@@ -105,12 +101,22 @@ $(document).ready(function () {
|
|
105
101
|
});
|
106
102
|
});
|
107
103
|
|
104
|
+
var toggleTrackingEdit = function(event) {
|
105
|
+
event.preventDefault();
|
106
|
+
|
107
|
+
var link = $(this);
|
108
|
+
link.parents('tbody').find('tr.edit-tracking').toggle();
|
109
|
+
link.parents('tbody').find('tr.show-tracking').toggle();
|
110
|
+
}
|
111
|
+
|
108
112
|
// handle tracking edit click
|
109
|
-
$('a.edit-tracking').
|
110
|
-
$('a.cancel-tracking').
|
113
|
+
$('a.edit-tracking').click(toggleTrackingEdit);
|
114
|
+
$('a.cancel-tracking').click(toggleTrackingEdit);
|
111
115
|
|
112
116
|
// handle tracking save
|
113
|
-
$('[data-hook=admin_shipment_form] a.save-tracking').on('click', function () {
|
117
|
+
$('[data-hook=admin_shipment_form] a.save-tracking').on('click', function (event) {
|
118
|
+
event.preventDefault();
|
119
|
+
|
114
120
|
var link = $(this);
|
115
121
|
var shipment_number = link.data('shipment-number');
|
116
122
|
var tracking = link.parents('tbody').find('input#tracking').val();
|
@@ -122,16 +128,16 @@ $(document).ready(function () {
|
|
122
128
|
data: {
|
123
129
|
shipment: {
|
124
130
|
tracking: tracking
|
125
|
-
}
|
126
|
-
token: Spree.api_key
|
131
|
+
}
|
127
132
|
}
|
128
|
-
}).done(function () {
|
129
|
-
|
130
|
-
|
131
|
-
|
133
|
+
}).done(function (data) {
|
134
|
+
link.parents('tbody').find('tr.edit-tracking').toggle();
|
135
|
+
|
136
|
+
var show = link.parents('tbody').find('tr.show-tracking');
|
137
|
+
show.toggle();
|
138
|
+
show.find('.tracking-value').html($("<strong>").html("<%= Spree.t(:tracking) %>: ")).append(data.tracking);
|
132
139
|
});
|
133
140
|
});
|
134
|
-
|
135
141
|
});
|
136
142
|
|
137
143
|
adjustShipmentItems = function(shipment_number, variant_id, quantity){
|
@@ -154,23 +160,13 @@ adjustShipmentItems = function(shipment_number, variant_id, quantity){
|
|
154
160
|
$.ajax({
|
155
161
|
type: "PUT",
|
156
162
|
url: Spree.url(url),
|
157
|
-
data: {
|
158
|
-
variant_id: variant_id,
|
159
|
-
quantity: new_quantity,
|
160
|
-
token: Spree.api_key
|
161
|
-
}
|
163
|
+
data: { variant_id: variant_id, quantity: new_quantity }
|
162
164
|
}).done(function( msg ) {
|
163
165
|
window.location.reload();
|
164
166
|
});
|
165
167
|
}
|
166
168
|
}
|
167
169
|
|
168
|
-
toggleTrackingEdit = function(){
|
169
|
-
var link = $(this);
|
170
|
-
link.parents('tbody').find('tr.edit-tracking').toggle();
|
171
|
-
link.parents('tbody').find('tr.show-tracking').toggle();
|
172
|
-
}
|
173
|
-
|
174
170
|
toggleMethodEdit = function(){
|
175
171
|
var link = $(this);
|
176
172
|
link.parents('tbody').find('tr.edit-method').toggle();
|
@@ -206,8 +202,7 @@ startItemSplit = function(event){
|
|
206
202
|
data: {
|
207
203
|
q: {
|
208
204
|
"id_eq": variant_id
|
209
|
-
}
|
210
|
-
token: Spree.api_key
|
205
|
+
}
|
211
206
|
}
|
212
207
|
}).success(function( data ) {
|
213
208
|
variant = data['variants'][0];
|
@@ -260,7 +255,7 @@ completeItemSplit = function(event) {
|
|
260
255
|
type: "POST",
|
261
256
|
async: false,
|
262
257
|
url: Spree.url(Spree.routes.shipments_api + "?shipment[order_id]=" + order_number),
|
263
|
-
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id
|
258
|
+
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
|
264
259
|
}).done(function(msg) {
|
265
260
|
advanceOrder();
|
266
261
|
});
|
@@ -269,7 +264,7 @@ completeItemSplit = function(event) {
|
|
269
264
|
type: "PUT",
|
270
265
|
async: false,
|
271
266
|
url: Spree.url(Spree.routes.shipments_api + "/" + target_shipment_number + "/add.json"),
|
272
|
-
data: { variant_id: variant_id, quantity: quantity
|
267
|
+
data: { variant_id: variant_id, quantity: quantity }
|
273
268
|
}).done(function(msg) {
|
274
269
|
advanceOrder();
|
275
270
|
});
|
@@ -312,12 +307,7 @@ addVariantFromStockLocation = function() {
|
|
312
307
|
$.ajax({
|
313
308
|
type: "POST",
|
314
309
|
url: Spree.url(Spree.routes.shipments_api + "?shipment[order_id]=" + order_number),
|
315
|
-
data: {
|
316
|
-
variant_id: variant_id,
|
317
|
-
quantity: quantity,
|
318
|
-
stock_location_id: stock_location_id,
|
319
|
-
token: Spree.api_key
|
320
|
-
}
|
310
|
+
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
|
321
311
|
}).done(function( msg ) {
|
322
312
|
window.location.reload();
|
323
313
|
}).error(function( msg ) {
|
@@ -1,18 +1,18 @@
|
|
1
1
|
jQuery ->
|
2
|
-
$('#stock_movement_stock_item_id')
|
2
|
+
el = $('#stock_movement_stock_item_id')
|
3
|
+
el.select2
|
3
4
|
placeholder: "Find a stock item" # translate
|
4
5
|
ajax:
|
5
|
-
url: Spree.url(Spree.routes.stock_items_api)
|
6
|
+
url: Spree.url(Spree.routes.stock_items_api(el.data('stock-location-id')))
|
6
7
|
data: (term, page) ->
|
7
8
|
q:
|
8
9
|
variant_product_name_cont: term
|
9
10
|
per_page: 50
|
10
11
|
page: page
|
11
|
-
token: Spree.api_key
|
12
12
|
results: (data, page) ->
|
13
13
|
more = (page * 50) < data.count
|
14
14
|
return { results: data.stock_items, more: more }
|
15
15
|
formatResult: (stock_item) ->
|
16
16
|
variantTemplate({ variant: stock_item.variant })
|
17
17
|
formatSelection: (stock_item) ->
|
18
|
-
"#{stock_item.variant.name} (#{stock_item.variant.options_text})"
|
18
|
+
"#{stock_item.variant.name} (#{stock_item.variant.options_text})"
|
@@ -30,7 +30,7 @@ $ ->
|
|
30
30
|
|
31
31
|
$('#transfer_receive_stock').change (event) => @receive_stock_change(event)
|
32
32
|
|
33
|
-
$.getJSON Spree.url(Spree.routes.stock_locations_api)
|
33
|
+
$.getJSON Spree.url(Spree.routes.stock_locations_api), (data) =>
|
34
34
|
@locations = (location for location in data.stock_locations)
|
35
35
|
@force_receive_stock() if @locations.length < 2
|
36
36
|
|
@@ -107,7 +107,6 @@ $ ->
|
|
107
107
|
query_object = {}
|
108
108
|
query_object[query] = term
|
109
109
|
q: query_object
|
110
|
-
token: Spree.api_key
|
111
110
|
|
112
111
|
results: (data, page) ->
|
113
112
|
result = data["variants"] || data["stock_items"]
|
@@ -7,8 +7,7 @@ $(document).ready(function () {
|
|
7
7
|
multiple: true,
|
8
8
|
initSelection: function (element, callback) {
|
9
9
|
var url = Spree.url(Spree.routes.taxons_search, {
|
10
|
-
ids: element.val()
|
11
|
-
token: Spree.api_key
|
10
|
+
ids: element.val()
|
12
11
|
});
|
13
12
|
return $.getJSON(url, null, function (data) {
|
14
13
|
return callback(data['taxons']);
|
@@ -21,7 +20,6 @@ $(document).ready(function () {
|
|
21
20
|
return {
|
22
21
|
per_page: 50,
|
23
22
|
page: page,
|
24
|
-
without_children: true,
|
25
23
|
q: {
|
26
24
|
name_cont: term
|
27
25
|
},
|
@@ -14,12 +14,7 @@ handle_move = (e, data) ->
|
|
14
14
|
type: "POST",
|
15
15
|
dataType: "json",
|
16
16
|
url: url.toString(),
|
17
|
-
data: {
|
18
|
-
_method: "put",
|
19
|
-
"taxon[parent_id]": new_parent.prop("id"),
|
20
|
-
"taxon[child_index]": position,
|
21
|
-
token: Spree.api_key
|
22
|
-
},
|
17
|
+
data: ({_method: "put", "taxon[parent_id]": new_parent.prop("id"), "taxon[child_index]": position }),
|
23
18
|
error: handle_ajax_error
|
24
19
|
|
25
20
|
true
|
@@ -35,12 +30,7 @@ handle_create = (e, data) ->
|
|
35
30
|
type: "POST",
|
36
31
|
dataType: "json",
|
37
32
|
url: base_url.toString(),
|
38
|
-
data: {
|
39
|
-
"taxon[name]": name,
|
40
|
-
"taxon[parent_id]": new_parent.prop("id"),
|
41
|
-
"taxon[child_index]": position,
|
42
|
-
token: Spree.api_key
|
43
|
-
},
|
33
|
+
data: ({"taxon[name]": name, "taxon[parent_id]": new_parent.prop("id"), "taxon[child_index]": position }),
|
44
34
|
error: handle_ajax_error,
|
45
35
|
success: (data,result) ->
|
46
36
|
node.prop('id', data.id)
|
@@ -57,11 +47,7 @@ handle_rename = (e, data) ->
|
|
57
47
|
type: "POST",
|
58
48
|
dataType: "json",
|
59
49
|
url: url.toString(),
|
60
|
-
data: {
|
61
|
-
_method: "put",
|
62
|
-
"taxon[name]": name,
|
63
|
-
token: Spree.api_key
|
64
|
-
},
|
50
|
+
data: {_method: "put", "taxon[name]": name },
|
65
51
|
error: handle_ajax_error
|
66
52
|
|
67
53
|
handle_delete = (e, data) ->
|
@@ -75,10 +61,7 @@ handle_delete = (e, data) ->
|
|
75
61
|
type: "POST",
|
76
62
|
dataType: "json",
|
77
63
|
url: delete_url.toString(),
|
78
|
-
data: {
|
79
|
-
_method: "delete",
|
80
|
-
token: Spree.api_key
|
81
|
-
},
|
64
|
+
data: {_method: "delete"},
|
82
65
|
error: handle_ajax_error
|
83
66
|
else
|
84
67
|
$.jstree.rollback(last_rollback)
|
@@ -92,8 +75,6 @@ root.setup_taxonomy_tree = (taxonomy_id) ->
|
|
92
75
|
|
93
76
|
$.ajax
|
94
77
|
url: Spree.url(base_url.path().replace("/taxons", "/jstree")).toString(),
|
95
|
-
data:
|
96
|
-
token: Spree.api_key
|
97
78
|
success: (taxonomy) ->
|
98
79
|
last_rollback = null
|
99
80
|
|
@@ -102,7 +83,7 @@ root.setup_taxonomy_tree = (taxonomy_id) ->
|
|
102
83
|
data: taxonomy,
|
103
84
|
ajax:
|
104
85
|
url: (e) ->
|
105
|
-
Spree.url(base_url.path() + '/' + e.prop('id') + '/jstree'
|
86
|
+
Spree.url(base_url.path() + '/' + e.prop('id') + '/jstree').toString()
|
106
87
|
themes:
|
107
88
|
theme: "apple",
|
108
89
|
url: Spree.url(Spree.routes.jstree_theme_path)
|