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.

Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/solidus-style-guide-logo.png +0 -0
  3. data/app/assets/javascripts/spree/backend/admin.js.erb +1 -7
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +2 -2
  5. data/app/assets/javascripts/spree/backend/navigation.coffee +10 -0
  6. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
  7. data/app/assets/javascripts/spree/backend/option_value_picker.js +6 -6
  8. data/app/assets/javascripts/spree/backend/product_picker.js +6 -6
  9. data/app/assets/javascripts/spree/backend/shipments.js.erb +17 -3
  10. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
  11. data/app/assets/javascripts/spree/backend/style_guide.coffee +2 -0
  12. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
  13. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +82 -109
  14. data/app/assets/javascripts/spree/backend/taxons.js.coffee +4 -5
  15. data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
  16. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +3 -3
  17. data/app/assets/javascripts/spree/backend.js +3 -6
  18. data/app/assets/stylesheets/spree/backend/components/_messages.scss +1 -4
  19. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +99 -115
  20. data/app/assets/stylesheets/spree/backend/components/_progress.scss +1 -1
  21. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +6 -0
  22. data/app/assets/stylesheets/spree/backend/globals/_variables.scss +18 -0
  23. data/app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss +35 -0
  24. data/app/assets/stylesheets/spree/backend/plugins/_powertip.scss +1 -0
  25. data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +132 -0
  26. data/app/assets/stylesheets/spree/backend/sections/_taxonomies.scss +60 -0
  27. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +2 -0
  28. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +36 -4
  29. data/app/assets/stylesheets/spree/backend/shared/_typography.scss +3 -6
  30. data/app/assets/stylesheets/spree/backend/spree_admin.scss +4 -1
  31. data/app/assets/stylesheets/spree/backend.css +1 -1
  32. data/app/controllers/spree/admin/orders_controller.rb +6 -6
  33. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  34. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  35. data/app/controllers/spree/admin/products_controller.rb +0 -1
  36. data/app/controllers/spree/admin/reports_controller.rb +2 -2
  37. data/app/controllers/spree/admin/search_controller.rb +9 -7
  38. data/app/controllers/spree/admin/stock_transfers_controller.rb +6 -14
  39. data/app/controllers/spree/admin/style_guide_controller.rb +33 -0
  40. data/app/helpers/spree/admin/adjustments_helper.rb +2 -6
  41. data/app/helpers/spree/admin/base_helper.rb +7 -6
  42. data/app/helpers/spree/admin/navigation_helper.rb +12 -5
  43. data/app/helpers/spree/admin/orders_helper.rb +1 -1
  44. data/app/helpers/spree/admin/products_helper.rb +2 -4
  45. data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
  46. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  47. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +1 -1
  48. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +1 -1
  49. data/app/views/spree/admin/customer_returns/edit.html.erb +1 -1
  50. data/app/views/spree/admin/images/edit.html.erb +1 -3
  51. data/app/views/spree/admin/images/index.html.erb +0 -2
  52. data/app/views/spree/admin/option_types/edit.html.erb +2 -4
  53. data/app/views/spree/admin/option_types/index.html.erb +0 -2
  54. data/app/views/spree/admin/option_types/new.html.erb +0 -2
  55. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
  56. data/app/views/spree/admin/orders/index.html.erb +1 -1
  57. data/app/views/spree/admin/product_properties/index.html.erb +0 -1
  58. data/app/views/spree/admin/products/edit.html.erb +0 -2
  59. data/app/views/spree/admin/products/index.html.erb +2 -4
  60. data/app/views/spree/admin/products/new.html.erb +0 -2
  61. data/app/views/spree/admin/promotion_categories/edit.html.erb +0 -2
  62. data/app/views/spree/admin/promotion_categories/index.html.erb +0 -2
  63. data/app/views/spree/admin/promotion_categories/new.html.erb +0 -2
  64. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +2 -28
  65. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -26
  66. data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +28 -0
  67. data/app/views/spree/admin/promotions/edit.html.erb +0 -2
  68. data/app/views/spree/admin/promotions/index.html.erb +0 -2
  69. data/app/views/spree/admin/promotions/new.html.erb +0 -2
  70. data/app/views/spree/admin/properties/edit.html.erb +0 -2
  71. data/app/views/spree/admin/properties/index.html.erb +2 -4
  72. data/app/views/spree/admin/properties/new.html.erb +0 -2
  73. data/app/views/spree/admin/properties/new.js.erb +1 -1
  74. data/app/views/spree/admin/prototypes/edit.html.erb +0 -2
  75. data/app/views/spree/admin/prototypes/index.html.erb +0 -2
  76. data/app/views/spree/admin/prototypes/new.html.erb +0 -2
  77. data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
  78. data/app/views/spree/admin/reimbursements/show.html.erb +9 -9
  79. data/app/views/spree/admin/return_authorizations/_form.html.erb +16 -16
  80. data/app/views/spree/admin/search/users.rabl +1 -1
  81. data/app/views/spree/admin/shared/_head.html.erb +11 -0
  82. data/app/views/spree/admin/shared/_header.html.erb +4 -8
  83. data/app/views/spree/admin/shared/_menu.html.erb +4 -8
  84. data/app/views/spree/admin/shared/_navigation.html.erb +9 -0
  85. data/app/views/spree/admin/shared/_navigation_footer.html.erb +3 -0
  86. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +20 -22
  87. data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +8 -10
  88. data/app/views/spree/admin/shared/_stock_sub_menu.html.erb +8 -10
  89. data/app/views/spree/admin/shared/_tabs.html.erb +9 -3
  90. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  91. data/app/views/spree/admin/stock_items/index.html.erb +1 -2
  92. data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -1
  93. data/app/views/spree/admin/stock_transfers/index.html.erb +0 -3
  94. data/app/views/spree/admin/stock_transfers/new.html.erb +0 -2
  95. data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
  96. data/app/views/spree/admin/stock_transfers/show.html.erb +0 -2
  97. data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +0 -2
  98. data/app/views/spree/admin/style_guide/index.html.erb +5 -0
  99. data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +79 -0
  100. data/app/views/spree/admin/style_guide/topics/forms/_validation.html.erb +14 -0
  101. data/app/views/spree/admin/style_guide/topics/messaging/_flashes.html.erb +13 -0
  102. data/app/views/spree/admin/style_guide/topics/messaging/_loading.html.erb +20 -0
  103. data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +16 -0
  104. data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +44 -0
  105. data/app/views/spree/admin/style_guide/topics/tables/_pagination.html.erb +11 -0
  106. data/app/views/spree/admin/style_guide/topics/typography/_colors.html.erb +64 -0
  107. data/app/views/spree/admin/style_guide/topics/typography/_fonts.html.erb +19 -0
  108. data/app/views/spree/admin/style_guide/topics/typography/_icons.html.erb +13 -0
  109. data/app/views/spree/admin/style_guide/topics/typography/_lists.html.erb +25 -0
  110. data/app/views/spree/admin/style_guide/topics/typography/_tags.html.erb +25 -0
  111. data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -0
  112. data/app/views/spree/admin/taxonomies/edit.erb +5 -6
  113. data/app/views/spree/admin/taxonomies/index.html.erb +0 -2
  114. data/app/views/spree/admin/taxonomies/new.html.erb +0 -2
  115. data/app/views/spree/admin/taxons/_form.html.erb +1 -1
  116. data/app/views/spree/admin/taxons/_list_template.html.erb +17 -0
  117. data/app/views/spree/admin/taxons/index.html.erb +0 -3
  118. data/app/views/spree/admin/users/orders.html.erb +1 -1
  119. data/app/views/spree/admin/variants/edit.html.erb +0 -2
  120. data/app/views/spree/admin/variants/index.html.erb +0 -2
  121. data/app/views/spree/layouts/admin.html.erb +3 -4
  122. data/app/views/spree/layouts/admin_style_guide.html.erb +58 -0
  123. data/config/routes.rb +4 -2
  124. data/lib/spree/backend/engine.rb +0 -1
  125. data/lib/spree/backend.rb +0 -3
  126. data/solidus_backend.gemspec +5 -7
  127. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
  128. data/spec/controllers/spree/admin/orders_controller_spec.rb +14 -14
  129. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +2 -4
  130. data/spec/controllers/spree/admin/payments_controller_spec.rb +2 -2
  131. data/spec/controllers/spree/admin/products_controller_spec.rb +3 -3
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +4 -4
  133. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +1 -1
  134. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
  135. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +1 -1
  136. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +13 -11
  137. data/spec/features/admin/configuration/general_settings_spec.rb +10 -7
  138. data/spec/features/admin/configuration/payment_methods_spec.rb +1 -1
  139. data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
  140. data/spec/features/admin/configuration/states_spec.rb +1 -1
  141. data/spec/features/admin/configuration/tax_rates_spec.rb +6 -7
  142. data/spec/features/admin/configuration/taxonomies_spec.rb +3 -3
  143. data/spec/features/admin/homepage_spec.rb +6 -6
  144. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +4 -8
  145. data/spec/features/admin/orders/customer_details_spec.rb +9 -8
  146. data/spec/features/admin/orders/line_items_spec.rb +1 -1
  147. data/spec/features/admin/orders/listing_spec.rb +2 -2
  148. data/spec/features/admin/orders/log_entries_spec.rb +3 -3
  149. data/spec/features/admin/orders/new_order_spec.rb +3 -15
  150. data/spec/features/admin/orders/order_details_spec.rb +17 -20
  151. data/spec/features/admin/orders/payments_spec.rb +10 -10
  152. data/spec/features/admin/orders/shipments_spec.rb +2 -2
  153. data/spec/features/admin/products/edit/images_spec.rb +5 -3
  154. data/spec/features/admin/products/edit/products_spec.rb +11 -11
  155. data/spec/features/admin/products/edit/taxons_spec.rb +14 -38
  156. data/spec/features/admin/products/edit/variants_spec.rb +3 -3
  157. data/spec/features/admin/products/option_types_spec.rb +22 -21
  158. data/spec/features/admin/products/products_spec.rb +15 -12
  159. data/spec/features/admin/products/properties_spec.rb +3 -3
  160. data/spec/features/admin/products/prototypes_spec.rb +4 -4
  161. data/spec/features/admin/products/stock_management_spec.rb +5 -5
  162. data/spec/features/admin/products/variant_spec.rb +8 -8
  163. data/spec/features/admin/promotion_adjustments_spec.rb +6 -13
  164. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -20
  165. data/spec/features/admin/reports_spec.rb +2 -2
  166. data/spec/features/admin/stock_transfer_spec.rb +3 -3
  167. data/spec/features/admin/store_credits_spec.rb +2 -2
  168. data/spec/features/admin/users_spec.rb +6 -6
  169. data/spec/helpers/admin/navigation_helper_spec.rb +5 -0
  170. data/spec/helpers/admin/reimbursements_helper_spec.rb +1 -1
  171. data/spec/helpers/admin/store_credit_events_helper_spec.rb +1 -1
  172. data/spec/spec_helper.rb +3 -1
  173. data/spec/support/feature/base_feature_helper.rb +10 -0
  174. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  175. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  176. data/vendor/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
  177. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  178. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  179. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  180. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  181. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  182. data/vendor/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
  183. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  184. data/vendor/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
  185. data/vendor/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
  186. data/vendor/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  187. data/vendor/assets/javascripts/jquery.powertip.js +792 -423
  188. data/vendor/assets/javascripts/jquery.sticky-kit.min.js +10 -0
  189. data/vendor/assets/javascripts/prism.js +7 -0
  190. data/vendor/assets/stylesheets/prism.css +139 -0
  191. metadata +44 -51
  192. data/app/assets/stylesheets/spree/backend/plugins/_jstree.scss +0 -135
  193. data/app/views/spree/admin/shared/_sub_menu.html.erb +0 -9
  194. data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
  195. data/vendor/assets/javascripts/equalize.js +0 -41
  196. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +0 -4540
  197. data/vendor/assets/javascripts/jquery.jstree/themes/apple/bg.jpg +0 -0
  198. data/vendor/assets/javascripts/jquery.jstree/themes/apple/d.png +0 -0
  199. data/vendor/assets/javascripts/jquery.jstree/themes/apple/dot_for_ie.gif +0 -0
  200. data/vendor/assets/javascripts/jquery.jstree/themes/apple/style.scss +0 -61
  201. data/vendor/assets/javascripts/jquery.jstree/themes/apple/throbber.gif +0 -0
  202. data/vendor/assets/javascripts/jquery.vAlign.js +0 -11
  203. data/vendor/assets/javascripts/modernizr.js +0 -4
  204. data/vendor/assets/javascripts/responsive-tables.js +0 -42
  205. data/vendor/assets/stylesheets/responsive-tables.css +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a424af68c70b4b40ab5322bfe67f822d1e8098e2
4
- data.tar.gz: 83a0c987f9a21e98d72bba55c8bcb454cf02327f
3
+ metadata.gz: 05e360a1b3908a72fe9edc9a62364f678c10164c
4
+ data.tar.gz: e4344f4944cf1f4e1e50fbeb598796db5d53cd56
5
5
  SHA512:
6
- metadata.gz: 692a1942d3463871dfced0cad56f7059012661cb7dc2b7780f520df05f47bae9bc631a3e57d0fa59a508f78bf062cc36800dd488f6e80e62c5eecf7ff4fa7dd8
7
- data.tar.gz: 6281cc7731d9a867994d3e4c2daf2d84af1fcb8a24ca40bb473fa6ae35cdcc2d30f9e61c9d528813a201d35a84335022dc2cad1acc32114d2aedd528b5a7a4a2
6
+ metadata.gz: f9d2d66298b165a2f90bbcfdd789018b2a4050f963da76005eb3e7cc3fd3b9f32718e2f44da65e9ead2bc495f032b5af319833b4eda4201545495f641fbe16e5
7
+ data.tar.gz: 2c74297aae1f4c51e1db3a527878775c9af2587af57c1df6c78c904a89730b53c1a5d3789788a222d5007593c7a28abc6f79d60605ce89bcddbcf008933d68fb
@@ -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.users }
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 Select2.util.escapeMarkup(customer.email);
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: formatOptionType,
39
- formatSelection: formatOptionType
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: formatOptionValue,
41
- formatSelection: formatOptionValue
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: formatProduct,
47
- formatSelection: formatProduct
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 shipment_number = del.data('shipment-number');
54
- var variant_id = del.data('variant-id');
53
+ var line_item_id = del.data('line-item-id');
55
54
 
56
55
  toggleItemEdit();
57
- adjustShipmentItems(shipment_number, variant_id, 0);
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, container, excapeMarkup) ->
21
- Select2.util.escapeMarkup("#{stock_item.variant.name} (#{stock_item.variant.options_text})")
20
+ formatSelection: (stock_item) ->
21
+ "#{stock_item.variant.name} (#{stock_item.variant.options_text})"
@@ -0,0 +1,2 @@
1
+ $ ->
2
+ $(".style-guide-nav, .style-guide-sidebar").stick_in_parent()
@@ -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: formatTaxon,
45
- formatSelection: formatTaxon
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
- base_url = null
1
+ taxons_template = null
2
+ Handlebars.registerHelper 'isRootTaxon', ->
3
+ !@parent_id?
2
4
 
3
- tree_error_handler = (data) ->
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
- type: "PUT",
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: base_url,
34
- data: {
35
- "taxon[name]": name,
36
- "taxon[parent_id]": new_parent.prop("id"),
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: url,
53
- data: {
54
- "taxon[name]": name,
55
- },
56
- error: tree_error_handler(data)
57
-
58
- handle_delete = (e, data) ->
59
- node = data.rslt.obj
60
- delete_url = "#{base_url}/#{node.prop("id")}"
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
- Spree.ajax
63
- type: "DELETE",
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
- conf =
81
- json_data:
82
- data: taxonomy,
83
- ajax:
84
- headers: { "X-Spree-Token": Spree.api_key }
85
- url: (e) ->
86
- "#{base_url}/#{e.prop('id')}/jstree"
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
- # no parent or cant drag and drop
101
- if !new_parent || node.prop("rel") == "root"
102
- return false
103
-
104
- # can't drop before root
105
- if new_parent.prop("id") == "taxonomy_tree" && position == 0
106
- return false
107
-
108
- true
109
- contextmenu:
110
- items: (obj) ->
111
- taxon_tree_menu(obj, this)
112
- plugins: ["themes", "json_data", "dnd", "crrm", "contextmenu"]
113
-
114
- $("#taxonomy_tree").jstree(conf)
115
- .bind("move_node.jstree", handle_move)
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: formatTaxon,
66
- formatSelection: formatTaxon
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.users);
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.users
26
+ results: data
31
27
  };
32
28
  }
33
29
  },
34
- formatResult: formatUser,
35
- formatSelection: formatUser
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, container, escapeMarkup) ->
36
+ formatSelection: (variant) ->
37
37
  if !!variant.options_text
38
- Select2.util.escapeMarkup("#{variant.name} (#{variant.options_text}")
38
+ variant.name + " (#{variant.options_text})"
39
39
  else
40
- Select2.util.escapeMarkup(variant.name)
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.vAlign
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
-
@@ -26,10 +26,7 @@
26
26
  }
27
27
 
28
28
  .flash-wrapper {
29
- position: fixed;
30
- top: 0;
31
- left: 0;
32
- width: 100%;
29
+ @include position(fixed, null 0 0 $width-sidebar);
33
30
  z-index: 1000;
34
31
  }
35
32