solidus_backend 1.1.4 → 1.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/images/solidus-style-guide-logo.png +0 -0
- data/app/assets/javascripts/spree/backend/admin.js.erb +1 -7
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +2 -2
- data/app/assets/javascripts/spree/backend/navigation.coffee +10 -0
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/option_value_picker.js +6 -6
- data/app/assets/javascripts/spree/backend/product_picker.js +6 -6
- data/app/assets/javascripts/spree/backend/shipments.js.erb +17 -3
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
- data/app/assets/javascripts/spree/backend/style_guide.coffee +2 -0
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +82 -109
- data/app/assets/javascripts/spree/backend/taxons.js.coffee +4 -5
- data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +3 -3
- data/app/assets/javascripts/spree/backend.js +3 -6
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +1 -4
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +99 -115
- data/app/assets/stylesheets/spree/backend/components/_progress.scss +1 -1
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +6 -0
- data/app/assets/stylesheets/spree/backend/globals/_variables.scss +18 -0
- data/app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss +35 -0
- data/app/assets/stylesheets/spree/backend/plugins/_powertip.scss +1 -0
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +132 -0
- data/app/assets/stylesheets/spree/backend/sections/_taxonomies.scss +60 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +2 -0
- data/app/assets/stylesheets/spree/backend/shared/_layout.scss +36 -4
- data/app/assets/stylesheets/spree/backend/shared/_typography.scss +3 -6
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +4 -1
- data/app/assets/stylesheets/spree/backend.css +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +6 -6
- data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
- data/app/controllers/spree/admin/payments_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +0 -1
- data/app/controllers/spree/admin/reports_controller.rb +2 -2
- data/app/controllers/spree/admin/search_controller.rb +9 -7
- data/app/controllers/spree/admin/stock_transfers_controller.rb +6 -14
- data/app/controllers/spree/admin/style_guide_controller.rb +33 -0
- data/app/helpers/spree/admin/adjustments_helper.rb +2 -6
- data/app/helpers/spree/admin/base_helper.rb +7 -6
- data/app/helpers/spree/admin/navigation_helper.rb +12 -5
- data/app/helpers/spree/admin/orders_helper.rb +1 -1
- data/app/helpers/spree/admin/products_helper.rb +2 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
- data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/edit.html.erb +1 -1
- data/app/views/spree/admin/images/edit.html.erb +1 -3
- data/app/views/spree/admin/images/index.html.erb +0 -2
- data/app/views/spree/admin/option_types/edit.html.erb +2 -4
- data/app/views/spree/admin/option_types/index.html.erb +0 -2
- data/app/views/spree/admin/option_types/new.html.erb +0 -2
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +1 -1
- data/app/views/spree/admin/product_properties/index.html.erb +0 -1
- data/app/views/spree/admin/products/edit.html.erb +0 -2
- data/app/views/spree/admin/products/index.html.erb +2 -4
- data/app/views/spree/admin/products/new.html.erb +0 -2
- data/app/views/spree/admin/promotion_categories/edit.html.erb +0 -2
- data/app/views/spree/admin/promotion_categories/index.html.erb +0 -2
- data/app/views/spree/admin/promotion_categories/new.html.erb +0 -2
- data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +2 -28
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -26
- data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +28 -0
- data/app/views/spree/admin/promotions/edit.html.erb +0 -2
- data/app/views/spree/admin/promotions/index.html.erb +0 -2
- data/app/views/spree/admin/promotions/new.html.erb +0 -2
- data/app/views/spree/admin/properties/edit.html.erb +0 -2
- data/app/views/spree/admin/properties/index.html.erb +2 -4
- data/app/views/spree/admin/properties/new.html.erb +0 -2
- data/app/views/spree/admin/properties/new.js.erb +1 -1
- data/app/views/spree/admin/prototypes/edit.html.erb +0 -2
- data/app/views/spree/admin/prototypes/index.html.erb +0 -2
- data/app/views/spree/admin/prototypes/new.html.erb +0 -2
- data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
- data/app/views/spree/admin/reimbursements/show.html.erb +9 -9
- data/app/views/spree/admin/return_authorizations/_form.html.erb +16 -16
- data/app/views/spree/admin/search/users.rabl +1 -1
- data/app/views/spree/admin/shared/_head.html.erb +11 -0
- data/app/views/spree/admin/shared/_header.html.erb +4 -8
- data/app/views/spree/admin/shared/_menu.html.erb +4 -8
- data/app/views/spree/admin/shared/_navigation.html.erb +9 -0
- data/app/views/spree/admin/shared/_navigation_footer.html.erb +3 -0
- data/app/views/spree/admin/shared/_product_sub_menu.html.erb +20 -22
- data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +8 -10
- data/app/views/spree/admin/shared/_stock_sub_menu.html.erb +8 -10
- data/app/views/spree/admin/shared/_tabs.html.erb +9 -3
- data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
- data/app/views/spree/admin/stock_items/index.html.erb +1 -2
- data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -1
- data/app/views/spree/admin/stock_transfers/index.html.erb +0 -3
- data/app/views/spree/admin/stock_transfers/new.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/show.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +0 -2
- data/app/views/spree/admin/style_guide/index.html.erb +5 -0
- data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +79 -0
- data/app/views/spree/admin/style_guide/topics/forms/_validation.html.erb +14 -0
- data/app/views/spree/admin/style_guide/topics/messaging/_flashes.html.erb +13 -0
- data/app/views/spree/admin/style_guide/topics/messaging/_loading.html.erb +20 -0
- data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +16 -0
- data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +44 -0
- data/app/views/spree/admin/style_guide/topics/tables/_pagination.html.erb +11 -0
- data/app/views/spree/admin/style_guide/topics/typography/_colors.html.erb +64 -0
- data/app/views/spree/admin/style_guide/topics/typography/_fonts.html.erb +19 -0
- data/app/views/spree/admin/style_guide/topics/typography/_icons.html.erb +13 -0
- data/app/views/spree/admin/style_guide/topics/typography/_lists.html.erb +25 -0
- data/app/views/spree/admin/style_guide/topics/typography/_tags.html.erb +25 -0
- data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -0
- data/app/views/spree/admin/taxonomies/edit.erb +5 -6
- data/app/views/spree/admin/taxonomies/index.html.erb +0 -2
- data/app/views/spree/admin/taxonomies/new.html.erb +0 -2
- data/app/views/spree/admin/taxons/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/_list_template.html.erb +17 -0
- data/app/views/spree/admin/taxons/index.html.erb +0 -3
- data/app/views/spree/admin/users/orders.html.erb +1 -1
- data/app/views/spree/admin/variants/edit.html.erb +0 -2
- data/app/views/spree/admin/variants/index.html.erb +0 -2
- data/app/views/spree/layouts/admin.html.erb +3 -4
- data/app/views/spree/layouts/admin_style_guide.html.erb +58 -0
- data/config/routes.rb +4 -2
- data/lib/spree/backend/engine.rb +0 -1
- data/lib/spree/backend.rb +0 -3
- data/solidus_backend.gemspec +5 -7
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/orders_controller_spec.rb +14 -14
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +2 -4
- data/spec/controllers/spree/admin/payments_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/products_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/reports_controller_spec.rb +4 -4
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +13 -11
- data/spec/features/admin/configuration/general_settings_spec.rb +10 -7
- data/spec/features/admin/configuration/payment_methods_spec.rb +1 -1
- data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
- data/spec/features/admin/configuration/states_spec.rb +1 -1
- data/spec/features/admin/configuration/tax_rates_spec.rb +6 -7
- data/spec/features/admin/configuration/taxonomies_spec.rb +3 -3
- data/spec/features/admin/homepage_spec.rb +6 -6
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +4 -8
- data/spec/features/admin/orders/customer_details_spec.rb +9 -8
- data/spec/features/admin/orders/line_items_spec.rb +1 -1
- data/spec/features/admin/orders/listing_spec.rb +2 -2
- data/spec/features/admin/orders/log_entries_spec.rb +3 -3
- data/spec/features/admin/orders/new_order_spec.rb +3 -15
- data/spec/features/admin/orders/order_details_spec.rb +17 -20
- data/spec/features/admin/orders/payments_spec.rb +10 -10
- data/spec/features/admin/orders/shipments_spec.rb +2 -2
- data/spec/features/admin/products/edit/images_spec.rb +5 -3
- data/spec/features/admin/products/edit/products_spec.rb +11 -11
- data/spec/features/admin/products/edit/taxons_spec.rb +14 -38
- data/spec/features/admin/products/edit/variants_spec.rb +3 -3
- data/spec/features/admin/products/option_types_spec.rb +22 -21
- data/spec/features/admin/products/products_spec.rb +15 -12
- data/spec/features/admin/products/properties_spec.rb +3 -3
- data/spec/features/admin/products/prototypes_spec.rb +4 -4
- data/spec/features/admin/products/stock_management_spec.rb +5 -5
- data/spec/features/admin/products/variant_spec.rb +8 -8
- data/spec/features/admin/promotion_adjustments_spec.rb +6 -13
- data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -20
- data/spec/features/admin/reports_spec.rb +2 -2
- data/spec/features/admin/stock_transfer_spec.rb +3 -3
- data/spec/features/admin/store_credits_spec.rb +2 -2
- data/spec/features/admin/users_spec.rb +6 -6
- data/spec/helpers/admin/navigation_helper_spec.rb +5 -0
- data/spec/helpers/admin/reimbursements_helper_spec.rb +1 -1
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- data/spec/support/feature/base_feature_helper.rb +10 -0
- data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery.powertip.js +792 -423
- data/vendor/assets/javascripts/jquery.sticky-kit.min.js +10 -0
- data/vendor/assets/javascripts/prism.js +7 -0
- data/vendor/assets/stylesheets/prism.css +139 -0
- metadata +44 -51
- data/app/assets/stylesheets/spree/backend/plugins/_jstree.scss +0 -135
- data/app/views/spree/admin/shared/_sub_menu.html.erb +0 -9
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
- data/vendor/assets/javascripts/equalize.js +0 -41
- data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +0 -4540
- data/vendor/assets/javascripts/jquery.jstree/themes/apple/bg.jpg +0 -0
- data/vendor/assets/javascripts/jquery.jstree/themes/apple/d.png +0 -0
- data/vendor/assets/javascripts/jquery.jstree/themes/apple/dot_for_ie.gif +0 -0
- data/vendor/assets/javascripts/jquery.jstree/themes/apple/style.scss +0 -61
- data/vendor/assets/javascripts/jquery.jstree/themes/apple/throbber.gif +0 -0
- data/vendor/assets/javascripts/jquery.vAlign.js +0 -11
- data/vendor/assets/javascripts/modernizr.js +0 -4
- data/vendor/assets/javascripts/responsive-tables.js +0 -42
- data/vendor/assets/stylesheets/responsive-tables.css +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05e360a1b3908a72fe9edc9a62364f678c10164c
|
4
|
+
data.tar.gz: e4344f4944cf1f4e1e50fbeb598796db5d53cd56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d2d66298b165a2f90bbcfdd789018b2a4050f963da76005eb3e7cc3fd3b9f32718e2f44da65e9ead2bc495f032b5af319833b4eda4201545495f641fbe16e5
|
7
|
+
data.tar.gz: 2c74297aae1f4c51e1db3a527878775c9af2587af57c1df6c78c904a89730b53c1a5d3789788a222d5007593c7a28abc6f79d60605ce89bcddbcf008933d68fb
|
Binary file
|
@@ -16,9 +16,6 @@ Hopefully, this will evolve into a propper class.
|
|
16
16
|
|
17
17
|
jQuery(function($) {
|
18
18
|
|
19
|
-
// Vertical align of checkbox fields
|
20
|
-
$('.field.checkbox label').vAlign()
|
21
|
-
|
22
19
|
// Add some tips
|
23
20
|
$('.with-tip').powerTip({
|
24
21
|
smartPlacement: true,
|
@@ -48,9 +45,6 @@ jQuery(function($) {
|
|
48
45
|
tr.prev().removeClass('before-' + klass);
|
49
46
|
});
|
50
47
|
|
51
|
-
// Make height of dt/dd elements the same
|
52
|
-
$("dl").equalize('outerHeight');
|
53
|
-
|
54
48
|
});
|
55
49
|
|
56
50
|
|
@@ -212,7 +206,7 @@ $(document).ready(function(){
|
|
212
206
|
if (idAttr) {
|
213
207
|
objId = idAttr.split('_').slice(-1);
|
214
208
|
if (!isNaN(objId)) {
|
215
|
-
positions['positions['+objId+']'] = position;
|
209
|
+
positions['positions['+objId+']'] = position+1;
|
216
210
|
}
|
217
211
|
}
|
218
212
|
});
|
@@ -24,7 +24,7 @@ $(document).ready(function() {
|
|
24
24
|
}
|
25
25
|
},
|
26
26
|
results: function(data, page) {
|
27
|
-
return { results: data
|
27
|
+
return { results: data }
|
28
28
|
}
|
29
29
|
},
|
30
30
|
dropdownCssClass: 'customer_search',
|
@@ -52,7 +52,7 @@ $(document).ready(function() {
|
|
52
52
|
});
|
53
53
|
});
|
54
54
|
}
|
55
|
-
return
|
55
|
+
return customer.email;
|
56
56
|
}
|
57
57
|
})
|
58
58
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
navHeight = ->
|
2
|
+
$('.admin-nav-header').outerHeight() + $('.admin-nav-menu').outerHeight() + $('.admin-nav-footer').outerHeight()
|
3
|
+
|
4
|
+
checkSideBarFit = ->
|
5
|
+
$('.admin-nav').toggleClass('fits', navHeight() < $(window).height())
|
6
|
+
|
7
|
+
$ ->
|
8
|
+
$(".admin-nav-sticky, .admin-nav").stick_in_parent()
|
9
|
+
checkSideBarFit()
|
10
|
+
$(window).on('resize', checkSideBarFit)
|
@@ -1,10 +1,6 @@
|
|
1
1
|
$(document).ready(function () {
|
2
2
|
'use strict';
|
3
3
|
|
4
|
-
function formatOptionType(option_type) {
|
5
|
-
return Select2.util.escapeMarkup(option_type.presentation + ' (' + option_type.name + ')');
|
6
|
-
}
|
7
|
-
|
8
4
|
if ($('#product_option_type_ids').length > 0) {
|
9
5
|
$('#product_option_type_ids').select2({
|
10
6
|
placeholder: Spree.translations.option_type_placeholder,
|
@@ -35,8 +31,12 @@ $(document).ready(function () {
|
|
35
31
|
};
|
36
32
|
}
|
37
33
|
},
|
38
|
-
formatResult:
|
39
|
-
|
34
|
+
formatResult: function (option_type) {
|
35
|
+
return option_type.presentation + ' (' + option_type.name + ')';
|
36
|
+
},
|
37
|
+
formatSelection: function (option_type) {
|
38
|
+
return option_type.presentation + ' (' + option_type.name + ')';
|
39
|
+
}
|
40
40
|
});
|
41
41
|
}
|
42
42
|
});
|
@@ -6,10 +6,6 @@ $.fn.optionValueAutocomplete = function (options) {
|
|
6
6
|
var multiple = typeof(options['multiple']) !== 'undefined' ? options['multiple'] : true;
|
7
7
|
var productSelect = options['productSelect'];
|
8
8
|
|
9
|
-
function formatOptionValue(option_value) {
|
10
|
-
return Select2.util.escapeMarkup(option_value.name);
|
11
|
-
}
|
12
|
-
|
13
9
|
this.select2({
|
14
10
|
minimumInputLength: 3,
|
15
11
|
multiple: multiple,
|
@@ -37,7 +33,11 @@ $.fn.optionValueAutocomplete = function (options) {
|
|
37
33
|
return { results: data };
|
38
34
|
}
|
39
35
|
},
|
40
|
-
formatResult:
|
41
|
-
|
36
|
+
formatResult: function (option_value) {
|
37
|
+
return option_value.name;
|
38
|
+
},
|
39
|
+
formatSelection: function (option_value) {
|
40
|
+
return option_value.name;
|
41
|
+
}
|
42
42
|
});
|
43
43
|
};
|
@@ -5,10 +5,6 @@ $.fn.productAutocomplete = function (options) {
|
|
5
5
|
options = options || {}
|
6
6
|
var multiple = typeof(options['multiple']) !== 'undefined' ? options['multiple'] : true
|
7
7
|
|
8
|
-
function formatProduct(product) {
|
9
|
-
return Select2.util.escapeMarkup(product.name);
|
10
|
-
}
|
11
|
-
|
12
8
|
this.select2({
|
13
9
|
minimumInputLength: 3,
|
14
10
|
multiple: multiple,
|
@@ -43,8 +39,12 @@ $.fn.productAutocomplete = function (options) {
|
|
43
39
|
};
|
44
40
|
}
|
45
41
|
},
|
46
|
-
formatResult:
|
47
|
-
|
42
|
+
formatResult: function (product) {
|
43
|
+
return product.name;
|
44
|
+
},
|
45
|
+
formatSelection: function (product) {
|
46
|
+
return product.name;
|
47
|
+
}
|
48
48
|
});
|
49
49
|
};
|
50
50
|
|
@@ -50,11 +50,10 @@ $(document).ready(function () {
|
|
50
50
|
$('a.delete-item').click(function(event){
|
51
51
|
if (confirm(Spree.translations.are_you_sure_delete)) {
|
52
52
|
var del = $(this);
|
53
|
-
var
|
54
|
-
var variant_id = del.data('variant-id');
|
53
|
+
var line_item_id = del.data('line-item-id');
|
55
54
|
|
56
55
|
toggleItemEdit();
|
57
|
-
|
56
|
+
deleteLineItem(line_item_id);
|
58
57
|
}
|
59
58
|
return false;
|
60
59
|
});
|
@@ -171,6 +170,21 @@ adjustShipmentItems = function(shipment_number, variant_id, quantity){
|
|
171
170
|
}
|
172
171
|
}
|
173
172
|
|
173
|
+
deleteLineItem = function(line_item_id){
|
174
|
+
var url = Spree.routes.line_items_api(order_number) + "/" + line_item_id + ".json";
|
175
|
+
|
176
|
+
Spree.ajax({
|
177
|
+
type: "DELETE",
|
178
|
+
url: Spree.url(url),
|
179
|
+
success: function(response) {
|
180
|
+
window.location.reload();
|
181
|
+
},
|
182
|
+
error: function(response) {
|
183
|
+
show_flash('error', response.responseJSON.message);
|
184
|
+
}
|
185
|
+
});
|
186
|
+
}
|
187
|
+
|
174
188
|
toggleMethodEdit = function(){
|
175
189
|
var link = $(this);
|
176
190
|
link.parents('tbody').find('tr.edit-method').toggle();
|
@@ -17,5 +17,5 @@ jQuery ->
|
|
17
17
|
return { results: data.stock_items, more: more }
|
18
18
|
formatResult: (stock_item) ->
|
19
19
|
variantTemplate({ variant: stock_item.variant })
|
20
|
-
formatSelection: (stock_item
|
21
|
-
|
20
|
+
formatSelection: (stock_item) ->
|
21
|
+
"#{stock_item.variant.name} (#{stock_item.variant.options_text})"
|
@@ -1,10 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
var set_taxon_select = function(){
|
4
|
-
function formatTaxon(taxon) {
|
5
|
-
return Select2.util.escapeMarkup(taxon.pretty_name);
|
6
|
-
}
|
7
|
-
|
8
4
|
if ($('#product_taxon_ids').length > 0) {
|
9
5
|
$('#product_taxon_ids').select2({
|
10
6
|
placeholder: Spree.translations.taxon_placeholder,
|
@@ -41,8 +37,12 @@ var set_taxon_select = function(){
|
|
41
37
|
};
|
42
38
|
}
|
43
39
|
},
|
44
|
-
formatResult:
|
45
|
-
|
40
|
+
formatResult: function (taxon) {
|
41
|
+
return taxon.pretty_name;
|
42
|
+
},
|
43
|
+
formatSelection: function (taxon) {
|
44
|
+
return taxon.pretty_name;
|
45
|
+
}
|
46
46
|
});
|
47
47
|
}
|
48
48
|
}
|
@@ -1,120 +1,93 @@
|
|
1
|
-
|
1
|
+
taxons_template = null
|
2
|
+
Handlebars.registerHelper 'isRootTaxon', ->
|
3
|
+
!@parent_id?
|
2
4
|
|
3
|
-
|
4
|
-
rollback = data.rlbk
|
5
|
-
(XMLHttpRequest, textStatus, errorThrown) ->
|
6
|
-
$.jstree.rollback(rollback)
|
7
|
-
$("#ajax_error").show().html("<strong>#{server_error}</strong><br />" + taxonomy_tree_error)
|
8
|
-
|
9
|
-
handle_move = (e, data) ->
|
10
|
-
position = data.rslt.cp
|
11
|
-
node = data.rslt.o
|
12
|
-
new_parent = data.rslt.np
|
13
|
-
|
14
|
-
url = "#{base_url}/#{node.prop("id")}"
|
5
|
+
get_taxonomy = ->
|
15
6
|
Spree.ajax
|
16
|
-
|
17
|
-
dataType: "json",
|
18
|
-
url: url,
|
19
|
-
data: ({"taxon[parent_id]": new_parent.prop("id"), "taxon[child_index]": position }),
|
20
|
-
error: tree_error_handler(data)
|
21
|
-
|
22
|
-
true
|
23
|
-
|
24
|
-
handle_create = (e, data) ->
|
25
|
-
node = data.rslt.obj
|
26
|
-
name = data.rslt.name
|
27
|
-
position = data.rslt.position
|
28
|
-
new_parent = data.rslt.parent
|
7
|
+
url: "#{Spree.routes.taxonomy_path}?set=nested"
|
29
8
|
|
9
|
+
create_taxon = ({name, parent_id, child_index}) ->
|
30
10
|
Spree.ajax
|
31
11
|
type: "POST",
|
32
12
|
dataType: "json",
|
33
|
-
url:
|
34
|
-
data:
|
35
|
-
|
36
|
-
|
37
|
-
"taxon[child_index]": position,
|
38
|
-
},
|
39
|
-
error: tree_error_handler(data)
|
40
|
-
success: (data,result) ->
|
41
|
-
node.prop('id', data.id)
|
42
|
-
|
43
|
-
handle_rename = (e, data) ->
|
44
|
-
node = data.rslt.obj
|
45
|
-
name = data.rslt.new_name
|
46
|
-
|
47
|
-
url = "#{base_url}/#{node.prop("id")}"
|
13
|
+
url: Spree.routes.taxonomy_taxons_path,
|
14
|
+
data:
|
15
|
+
taxon: {name, parent_id, child_index}
|
16
|
+
complete: redraw_tree
|
48
17
|
|
18
|
+
update_taxon = ({id, parent_id, child_index}) ->
|
49
19
|
Spree.ajax
|
50
|
-
type: "PUT"
|
51
|
-
dataType: "json"
|
52
|
-
url:
|
53
|
-
data:
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
20
|
+
type: "PUT"
|
21
|
+
dataType: "json"
|
22
|
+
url: "#{Spree.routes.taxonomy_taxons_path}/#{id}"
|
23
|
+
data:
|
24
|
+
taxon: {parent_id, child_index}
|
25
|
+
error: redraw_tree
|
26
|
+
|
27
|
+
delete_taxon = ({id}) ->
|
28
|
+
Spree.ajax
|
29
|
+
type: "DELETE"
|
30
|
+
dataType: "json"
|
31
|
+
url: "#{Spree.routes.taxonomy_taxons_path}/#{id}"
|
32
|
+
error: redraw_tree
|
33
|
+
|
34
|
+
draw_tree = (taxonomy) ->
|
35
|
+
$('#taxonomy_tree')
|
36
|
+
.html( taxons_template({ taxons: [taxonomy.root] }) )
|
37
|
+
.find('ul')
|
38
|
+
.sortable
|
39
|
+
connectWith: '#taxonomy_tree ul'
|
40
|
+
placeholder: 'sortable-placeholder ui-state-highlight'
|
41
|
+
tolerance: 'pointer'
|
42
|
+
cursorAt: { left: 5 }
|
43
|
+
|
44
|
+
redraw_tree = ->
|
45
|
+
get_taxonomy().done(draw_tree)
|
46
|
+
|
47
|
+
resize_placeholder = (ui) ->
|
48
|
+
handleHeight = ui.helper.find('.sortable-handle').outerHeight()
|
49
|
+
ui.placeholder.height(handleHeight)
|
50
|
+
|
51
|
+
restore_sort_targets = ->
|
52
|
+
$('.ui-sortable-over').removeClass('ui-sortable-over')
|
53
|
+
|
54
|
+
highlight_sort_targets = (ui) ->
|
55
|
+
restore_sort_targets()
|
56
|
+
ui.placeholder.parents('ul').addClass('ui-sortable-over')
|
57
|
+
|
58
|
+
handle_move = (el) ->
|
59
|
+
update_taxon
|
60
|
+
id: el.data('taxon-id')
|
61
|
+
parent_id: el.parent().closest('li').data('taxon-id')
|
62
|
+
child_index: el.index()
|
63
|
+
|
64
|
+
handle_delete = (e) ->
|
65
|
+
el = $(e.target).closest('li')
|
61
66
|
if confirm(Spree.translations.are_you_sure_delete)
|
62
|
-
|
63
|
-
|
64
|
-
dataType: "json",
|
65
|
-
url: delete_url,
|
66
|
-
error: tree_error_handler(data)
|
67
|
-
else
|
68
|
-
$.jstree.rollback(data.rlbk)
|
69
|
-
|
70
|
-
@setup_taxonomy_tree = (taxonomy_id) ->
|
71
|
-
if taxonomy_id != undefined
|
72
|
-
# this is defined within admin/taxonomies/edit
|
73
|
-
base_url = Spree.routes.taxonomy_taxons_path
|
74
|
-
|
75
|
-
Spree.ajax
|
76
|
-
url: base_url.replace("/taxons", "/jstree"),
|
77
|
-
success: (taxonomy) ->
|
78
|
-
last_rollback = null
|
67
|
+
delete_taxon({id: el.data('taxon-id')})
|
68
|
+
el.remove()
|
79
69
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
themes:
|
88
|
-
theme: "apple",
|
89
|
-
url: Spree.routes.jstree_theme_path
|
90
|
-
strings:
|
91
|
-
new_node: new_taxon,
|
92
|
-
loading: Spree.translations.loading + "..."
|
93
|
-
crrm:
|
94
|
-
move:
|
95
|
-
check_move: (m) ->
|
96
|
-
position = m.cp
|
97
|
-
node = m.o
|
98
|
-
new_parent = m.np
|
70
|
+
get_create_handler = (taxonomy_id) ->
|
71
|
+
handle_create = (e) ->
|
72
|
+
e.preventDefault()
|
73
|
+
name = 'New node'
|
74
|
+
parent_id = taxonomy_id
|
75
|
+
child_index = 0
|
76
|
+
create_taxon({name, parent_id, child_index})
|
99
77
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
.bind("remove.jstree", handle_delete)
|
117
|
-
.bind("create.jstree", handle_create)
|
118
|
-
.bind("rename.jstree", handle_rename)
|
119
|
-
.bind "loaded.jstree", ->
|
120
|
-
$(this).jstree("core").toggle_node($('.jstree-icon').first())
|
78
|
+
@setup_taxonomy_tree = (taxonomy_id) ->
|
79
|
+
return unless taxonomy_id?
|
80
|
+
taxons_template_text = $('#taxons-list-template').text()
|
81
|
+
taxons_template = Handlebars.compile(taxons_template_text)
|
82
|
+
Handlebars.registerPartial( 'taxons', taxons_template_text )
|
83
|
+
redraw_tree()
|
84
|
+
$('#taxonomy_tree').on
|
85
|
+
sortstart: (e, ui) ->
|
86
|
+
resize_placeholder(ui)
|
87
|
+
sortover: (e, ui) ->
|
88
|
+
highlight_sort_targets(ui)
|
89
|
+
sortstop: restore_sort_targets
|
90
|
+
sortupdate: (e, ui) ->
|
91
|
+
handle_move(ui.item) unless ui.sender?
|
92
|
+
.on('click', '.delete-taxon-button', handle_delete)
|
93
|
+
$('.add-taxon-button').on('click', get_create_handler(taxonomy_id))
|
@@ -45,9 +45,6 @@ $ ->
|
|
45
45
|
sortable.trigger('sortupdate', item: draggable)
|
46
46
|
, 250
|
47
47
|
|
48
|
-
formatTaxon = (taxon) ->
|
49
|
-
Select2.util.escapeMarkup(taxon.pretty_name)
|
50
|
-
|
51
48
|
$('#taxon_id').select2
|
52
49
|
dropdownCssClass: "taxon_select_box",
|
53
50
|
placeholder: Spree.translations.find_a_taxon,
|
@@ -62,8 +59,10 @@ $ ->
|
|
62
59
|
results: (data) ->
|
63
60
|
results: data['taxons'],
|
64
61
|
more: data.current_page < data.pages
|
65
|
-
formatResult:
|
66
|
-
|
62
|
+
formatResult: (taxon) ->
|
63
|
+
taxon.pretty_name
|
64
|
+
formatSelection: (taxon) ->
|
65
|
+
taxon.pretty_name
|
67
66
|
|
68
67
|
$('#taxon_id').on "change", (e) ->
|
69
68
|
Spree.ajax
|
@@ -1,10 +1,6 @@
|
|
1
1
|
$.fn.userAutocomplete = function () {
|
2
2
|
'use strict';
|
3
3
|
|
4
|
-
function formatUser(user) {
|
5
|
-
return Select2.util.escapeMarkup(user.email);
|
6
|
-
}
|
7
|
-
|
8
4
|
this.select2({
|
9
5
|
minimumInputLength: 1,
|
10
6
|
multiple: true,
|
@@ -12,7 +8,7 @@ $.fn.userAutocomplete = function () {
|
|
12
8
|
$.get(Spree.routes.user_search, {
|
13
9
|
ids: element.val()
|
14
10
|
}, function (data) {
|
15
|
-
callback(data
|
11
|
+
callback(data);
|
16
12
|
});
|
17
13
|
},
|
18
14
|
ajax: {
|
@@ -27,12 +23,16 @@ $.fn.userAutocomplete = function () {
|
|
27
23
|
},
|
28
24
|
results: function (data) {
|
29
25
|
return {
|
30
|
-
results: data
|
26
|
+
results: data
|
31
27
|
};
|
32
28
|
}
|
33
29
|
},
|
34
|
-
formatResult:
|
35
|
-
|
30
|
+
formatResult: function (user) {
|
31
|
+
return user.email;
|
32
|
+
},
|
33
|
+
formatSelection: function (user) {
|
34
|
+
return user.email;
|
35
|
+
}
|
36
36
|
});
|
37
37
|
};
|
38
38
|
|
@@ -33,8 +33,8 @@ $.fn.variantAutocomplete = (searchOptions = {}) ->
|
|
33
33
|
results: data["variants"]
|
34
34
|
|
35
35
|
formatResult: formatVariantResult
|
36
|
-
formatSelection: (variant
|
36
|
+
formatSelection: (variant) ->
|
37
37
|
if !!variant.options_text
|
38
|
-
|
38
|
+
variant.name + " (#{variant.options_text})"
|
39
39
|
else
|
40
|
-
|
40
|
+
variant.name
|
@@ -1,21 +1,18 @@
|
|
1
1
|
//= require handlebars
|
2
2
|
//= require jquery
|
3
3
|
//= require jquery_ujs
|
4
|
+
//= require jquery-migrate-1.0.0
|
4
5
|
//= require jquery-ui/datepicker
|
5
6
|
//= require jquery-ui/sortable
|
6
7
|
//= require jquery-ui/autocomplete
|
7
|
-
//= require modernizr
|
8
8
|
//= require jquery.cookie
|
9
|
-
//= require jquery.jstree/jquery.jstree
|
10
9
|
//= require jquery.powertip
|
11
|
-
//= require jquery.
|
12
|
-
//= require equalize
|
13
|
-
//= require responsive-tables
|
10
|
+
//= require jquery.sticky-kit.min
|
14
11
|
//= require underscore-min
|
15
12
|
//= require backbone
|
13
|
+
//= require prism
|
16
14
|
//= require spree
|
17
15
|
//= require ./backend/backbone-overrides
|
18
16
|
//= require spree/backend/spree-select2
|
19
17
|
//= require_tree ./backend/templates
|
20
18
|
//= require_tree .
|
21
|
-
|