solidus_backend 1.0.7 → 1.1.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 (201) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend.js +3 -0
  3. data/app/assets/javascripts/spree/backend/admin.js.erb +17 -24
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +3 -5
  5. data/app/assets/javascripts/spree/backend/flash.coffee +17 -0
  6. data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +9 -0
  7. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
  8. data/app/assets/javascripts/spree/backend/option_value_picker.js +43 -0
  9. data/app/assets/javascripts/spree/backend/product_picker.js +10 -8
  10. data/app/assets/javascripts/spree/backend/promotions.js.coffee +101 -0
  11. data/app/assets/javascripts/spree/backend/routes.js +2 -1
  12. data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
  13. data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +1 -1
  14. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
  15. data/app/assets/javascripts/spree/backend/stock_transfers/variant_form.coffee +1 -1
  16. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
  17. data/app/assets/javascripts/spree/backend/taxons.js.coffee +6 -7
  18. data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +17 -0
  19. data/app/assets/javascripts/spree/backend/templates/products/sortable.hbs +5 -0
  20. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +17 -0
  21. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +17 -0
  22. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +10 -0
  23. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs +1 -0
  24. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +19 -0
  25. data/app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb +52 -0
  26. data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +23 -0
  27. data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +51 -0
  28. data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +67 -0
  29. data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +27 -0
  30. data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
  31. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +6 -8
  32. data/app/assets/stylesheets/spree/backend/components/_messages.scss +6 -3
  33. data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +16 -0
  34. data/app/controllers/spree/admin/base_controller.rb +1 -1
  35. data/app/controllers/spree/admin/option_types_controller.rb +1 -3
  36. data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
  37. data/app/controllers/spree/admin/orders_controller.rb +6 -11
  38. data/app/controllers/spree/admin/product_properties_controller.rb +9 -0
  39. data/app/controllers/spree/admin/products_controller.rb +20 -5
  40. data/app/controllers/spree/admin/promotions_controller.rb +2 -1
  41. data/app/controllers/spree/admin/reimbursements_controller.rb +20 -0
  42. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  43. data/app/controllers/spree/admin/return_authorizations_controller.rb +5 -0
  44. data/app/controllers/spree/admin/root_controller.rb +1 -1
  45. data/app/controllers/spree/admin/search_controller.rb +2 -4
  46. data/app/controllers/spree/admin/states_controller.rb +1 -1
  47. data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
  48. data/app/controllers/spree/admin/stock_transfers_controller.rb +3 -14
  49. data/app/controllers/spree/admin/users_controller.rb +2 -3
  50. data/app/controllers/spree/admin/variant_property_rule_values_controller.rb +7 -0
  51. data/app/controllers/spree/admin/variants_controller.rb +1 -1
  52. data/app/controllers/spree/admin/zones_controller.rb +1 -1
  53. data/app/helpers/spree/admin/adjustments_helper.rb +4 -9
  54. data/app/helpers/spree/admin/base_helper.rb +7 -6
  55. data/app/helpers/spree/admin/navigation_helper.rb +8 -2
  56. data/app/helpers/spree/admin/orders_helper.rb +1 -1
  57. data/app/helpers/spree/admin/products_helper.rb +2 -4
  58. data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
  59. data/app/views/spree/admin/adjustments/_adjustment.html.erb +1 -1
  60. data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -5
  61. data/app/views/spree/admin/orders/_add_product.html.erb +0 -3
  62. data/app/views/spree/admin/orders/_carton.html.erb +0 -1
  63. data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
  64. data/app/views/spree/admin/orders/confirm/_shipment.html.erb +0 -1
  65. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  66. data/app/views/spree/admin/orders/customer_details/edit.html.erb +0 -1
  67. data/app/views/spree/admin/orders/index.html.erb +1 -2
  68. data/app/views/spree/admin/payment_methods/_form.html.erb +0 -4
  69. data/app/views/spree/admin/payment_methods/index.html.erb +0 -2
  70. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +3 -0
  71. data/app/views/spree/admin/product_properties/index.html.erb +52 -2
  72. data/app/views/spree/admin/promotions/_actions.html.erb +14 -10
  73. data/app/views/spree/admin/promotions/_promotion_action.html.erb +5 -3
  74. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +5 -3
  75. data/app/views/spree/admin/promotions/_rules.html.erb +18 -14
  76. data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +5 -28
  77. data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +5 -27
  78. data/app/views/spree/admin/promotions/edit.html.erb +6 -4
  79. data/app/views/spree/admin/promotions/index.html.erb +1 -1
  80. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -0
  81. data/app/views/spree/admin/refund_reasons/index.html.erb +2 -2
  82. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  83. data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
  84. data/app/views/spree/admin/search/users.rabl +1 -1
  85. data/app/views/spree/admin/shared/_order_summary.html.erb +6 -0
  86. data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
  87. data/app/views/spree/admin/shared/_translations.html.erb +16 -46
  88. data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
  89. data/app/views/spree/admin/stock_items/_stock_management.html.erb +0 -2
  90. data/app/views/spree/admin/stock_movements/_form.html.erb +0 -2
  91. data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -3
  92. data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
  93. data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
  94. data/app/views/spree/admin/taxons/index.html.erb +0 -1
  95. data/app/views/spree/admin/users/_addresses_form.html.erb +4 -4
  96. data/app/views/spree/layouts/admin.html.erb +11 -9
  97. data/config/routes.rb +5 -0
  98. data/lib/spree/backend.rb +1 -2
  99. metadata +41 -139
  100. data/CHANGELOG.md +0 -1
  101. data/Gemfile +0 -6
  102. data/Rakefile +0 -15
  103. data/app/assets/javascripts/spree/backend/handlebar_extensions.js +0 -9
  104. data/app/assets/javascripts/spree/backend/promotions.js +0 -73
  105. data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +0 -196
  106. data/app/views/spree/admin/products/_autocomplete.js.erb +0 -14
  107. data/app/views/spree/admin/products/_sortable.html +0 -7
  108. data/app/views/spree/admin/stock_items/_stock_location_stock_item_template.html.erb +0 -21
  109. data/app/views/spree/admin/stock_transfers/_transfer_item_template.html.erb +0 -54
  110. data/app/views/spree/admin/variants/_autocomplete.js.erb +0 -25
  111. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +0 -69
  112. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -53
  113. data/app/views/spree/admin/variants/_split.js.erb +0 -29
  114. data/script/rails +0 -9
  115. data/solidus_backend.gemspec +0 -30
  116. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -24
  117. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -77
  118. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -234
  119. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
  120. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  121. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -80
  122. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -472
  123. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
  124. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -175
  125. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -45
  126. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
  127. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -18
  128. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
  129. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
  130. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
  131. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -75
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -134
  133. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -166
  134. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -226
  135. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
  136. data/spec/controllers/spree/admin/root_controller_spec.rb +0 -41
  137. data/spec/controllers/spree/admin/search_controller_spec.rb +0 -104
  138. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
  139. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -50
  140. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
  141. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -331
  142. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -309
  143. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -236
  144. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
  145. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -54
  146. data/spec/features/admin/configuration/countries_spec.rb +0 -22
  147. data/spec/features/admin/configuration/general_settings_spec.rb +0 -45
  148. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -125
  149. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -64
  150. data/spec/features/admin/configuration/states_spec.rb +0 -64
  151. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -50
  152. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
  153. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -30
  154. data/spec/features/admin/configuration/taxonomies_spec.rb +0 -52
  155. data/spec/features/admin/configuration/zones_spec.rb +0 -39
  156. data/spec/features/admin/homepage_spec.rb +0 -78
  157. data/spec/features/admin/locale_spec.rb +0 -30
  158. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
  159. data/spec/features/admin/orders/adjustments_spec.rb +0 -126
  160. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -48
  161. data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -48
  162. data/spec/features/admin/orders/customer_details_spec.rb +0 -163
  163. data/spec/features/admin/orders/line_items_spec.rb +0 -50
  164. data/spec/features/admin/orders/listing_spec.rb +0 -130
  165. data/spec/features/admin/orders/log_entries_spec.rb +0 -55
  166. data/spec/features/admin/orders/new_order_spec.rb +0 -197
  167. data/spec/features/admin/orders/order_details_spec.rb +0 -533
  168. data/spec/features/admin/orders/payments_spec.rb +0 -228
  169. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -47
  170. data/spec/features/admin/orders/shipments_spec.rb +0 -65
  171. data/spec/features/admin/payments/store_credits_spec.rb +0 -21
  172. data/spec/features/admin/products/edit/images_spec.rb +0 -87
  173. data/spec/features/admin/products/edit/products_spec.rb +0 -66
  174. data/spec/features/admin/products/edit/taxons_spec.rb +0 -56
  175. data/spec/features/admin/products/edit/variants_spec.rb +0 -61
  176. data/spec/features/admin/products/option_types_spec.rb +0 -114
  177. data/spec/features/admin/products/products_spec.rb +0 -392
  178. data/spec/features/admin/products/properties_spec.rb +0 -139
  179. data/spec/features/admin/products/prototypes_spec.rb +0 -110
  180. data/spec/features/admin/products/stock_management_spec.rb +0 -82
  181. data/spec/features/admin/products/variant_spec.rb +0 -51
  182. data/spec/features/admin/promotion_adjustments_spec.rb +0 -220
  183. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -69
  184. data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
  185. data/spec/features/admin/reports_spec.rb +0 -61
  186. data/spec/features/admin/stock_transfer_spec.rb +0 -86
  187. data/spec/features/admin/store_credits_spec.rb +0 -82
  188. data/spec/features/admin/taxons_spec.rb +0 -31
  189. data/spec/features/admin/users_spec.rb +0 -270
  190. data/spec/helpers/admin/base_helper_spec.rb +0 -24
  191. data/spec/helpers/admin/navigation_helper_spec.rb +0 -73
  192. data/spec/helpers/admin/reimbursements_helper_spec.rb +0 -34
  193. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
  194. data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -95
  195. data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
  196. data/spec/spec_helper.rb +0 -108
  197. data/spec/support/appear_before_matcher.rb +0 -8
  198. data/spec/support/ror_ringer.jpeg +0 -0
  199. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  200. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
  201. data/vendor/assets/javascripts/handlebars.js +0 -2746
@@ -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,5 +1,5 @@
1
- $(document).ready ->
2
- window.productTemplate = Handlebars.compile($('#product_template_sortable').text());
1
+ $ ->
2
+ productTemplate = HandlebarsTemplates['products/sortable']
3
3
 
4
4
  productListTemplate = (products) ->
5
5
  products.map(productTemplate).join('') ||
@@ -45,9 +45,6 @@ $(document).ready ->
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 @@ $(document).ready ->
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
@@ -0,0 +1,17 @@
1
+ <div class='customer-autocomplete-item'>
2
+ <div class='customer-details'>
3
+ <h5>{{customer.email}}</h5>
4
+ {{#if bill_address.firstname }}
5
+ <strong>{{t 'bill_address' }}</strong>
6
+ {{bill_address.firstname}} {{bill_address.lastname}}<br>
7
+ {{bill_address.address1}}, {{bill_address.address2}}<br>
8
+ {{bill_address.city}}<br>
9
+ {{#if bill_address.state_id }}
10
+ {{bill_address.state.name}}
11
+ {{else}}
12
+ {{bill_address.state_name}}
13
+ {{/if}}
14
+ {{bill_address.country.name}}
15
+ {{/if}}
16
+ </div>
17
+ </div>
@@ -0,0 +1,5 @@
1
+ <a href="#" id="product_{{ id }}" data-product-id="{{ id }}" class="sort_item list-group-item">
2
+ <i class="fa fa-sort"></i>
3
+ <span class="product_name">{{ name }}</span>
4
+ <span class="right">{{ display_price }}</span>
5
+ </a>
@@ -0,0 +1,17 @@
1
+ <div class="fullwidth tier">
2
+ <a class="fa fa-trash remove js-remove-tier"></a>
3
+ <div class="two columns alpha omega">
4
+ <div class="input-group">
5
+ <span class="input-group-addon">$</span>
6
+ <input class="js-base-input form-control" type="text" value={{baseField.value}}>
7
+ </div>
8
+ </div>
9
+ <div class="two columns alpha omega right">
10
+ <div class="input-group">
11
+ <span class="input-group-addon">$</span>
12
+ <input class="js-value-input form-control"
13
+ name="{{valueField.name}}" type="text" value={{valueField.value}}>
14
+ </div>
15
+ </div>
16
+ <div class="clear"></div>
17
+ </div>
@@ -0,0 +1,17 @@
1
+ <div class="fullwidth tier">
2
+ <a class="fa fa-trash remove js-remove-tier"></a>
3
+ <div class="two columns alpha omega">
4
+ <div class="input-group">
5
+ <span class="input-group-addon">$</span>
6
+ <input class="js-base-input form-control" type="text" value={{baseField.value}}>
7
+ </div>
8
+ </div>
9
+ <div class="two columns alpha omega right">
10
+ <div class="input-group">
11
+ <input class="js-value-input form-control right-align"
12
+ name="{{valueField.name}}" type="text" value={{valueField.value}}>
13
+ <span class="input-group-addon">%</span>
14
+ </div>
15
+ </div>
16
+ <div class="clear"></div>
17
+ </div>
@@ -0,0 +1,10 @@
1
+ <div class="fullwidth promo-rule-option-value">
2
+ <div class="four columns alpha">
3
+ <input class="js-promo-rule-option-value-product-select fullwidth" type="hidden" value="{{ productSelect.value }}">
4
+ </div>
5
+ <div class="three columns omega">
6
+ <input class="js-promo-rule-option-value-option-values-select fullwidth" name="{{ paramPrefix }}[preferred_eligible_values][{{ productSelect.value }}]" type="hidden" value={{optionValuesSelect.value}}>
7
+ </div>
8
+ <a class="fa fa-trash remove js-remove-promo-rule-option-value"></a>
9
+ <div class="clear"></div>
10
+ </div>
@@ -0,0 +1 @@
1
+ {{ param_prefix }}[preferred_eligible_values][{{product_id}}]
@@ -0,0 +1,19 @@
1
+ <tr data-variant-id="{{variantId}}">
2
+ <td class="align-center location-name-cell">{{stockLocationName}}</td>
3
+ <td class="align-center">
4
+ {{#if backorderable}}
5
+ <input id="backorderable-{{id}}" name="backorderable" type="checkbox" value="backorderable" disabled="disabled" checked="checked">
6
+ {{else}}
7
+ <input id="backorderable-{{id}}" name="backorderable" type="checkbox" value="backorderable" disabled="disabled">
8
+ {{/if}}
9
+ </td>
10
+ <td class="align-center" id="number-update-{{id}}">
11
+ <span class="js-number-update-text">{{countOnHand}}</span>
12
+ <input class="fullwidth js-number-update-input" name="count_on_hand" type="number" value="">
13
+ </td>
14
+ <td class="actions">
15
+ <a class="fa fa-edit icon_link with-tip no-text" data-action="edit" data-id="{{id}}" href="#"></a>
16
+ <a class="fa fa-check icon_link with-tip no-text" data-action="green" data-id="{{id}}" data-location-id="{{stockLocationId}}" href="#"></a>
17
+ <a class="fa fa-void icon_link with-tip no-text" data-action="red" data-id="{{id}}" href="#"></a>
18
+ </td>
19
+ </tr>
@@ -0,0 +1,52 @@
1
+ <tr class='new-row' data-transfer-item-id="{{id}}">
2
+ <td class="align-center no-padding">
3
+ <div class='variant-container' data-variant-id="{{variantId}}">
4
+ <div class='variant-image'>
5
+ {{#if variantImageURL }}
6
+ <img alt="{{variantName}}" src="{{variantImageURL}}">
7
+ {{ else }}
8
+ <img alt='{{variant.name}}' src='<%= image_path("noimage/small.png") %>' />
9
+ {{/if}}
10
+ </div>
11
+ <div class='variant-details'>
12
+ <table class='stock-variant-field-table'>
13
+ <tbody>
14
+ {{#each variantDisplayAttributes}}
15
+ <tr>
16
+ <td>{{this.label}}</td>
17
+ <td class="fullwidth">{{this.value}}</td>
18
+ </tr>
19
+ {{/each}}
20
+ </tbody>
21
+ </table>
22
+ </div>
23
+ </div>
24
+ </td>
25
+ <td class="align-center">
26
+ <table class='stock-variant-field-table'>
27
+ {{#each variantOptions}}
28
+ <tr>
29
+ <td>{{this.option_type}}</td>
30
+ <td>{{this.option_value}}</td>
31
+ </tr>
32
+ {{/each}}
33
+ </table>
34
+ </td>
35
+ <td class='align-center' id="number-update-{{id}}">
36
+ {{#if isReceiving }}
37
+ <span class='js-number-update-text'>{{receivedQuantity}}</span>
38
+ <input class="fullwidth js-number-update-input" name="received_quantity" type="number" value="">
39
+ {{ else }}
40
+ <span class='js-number-update-text'>{{expectedQuantity}}</span>
41
+ <input class="fullwidth js-number-update-input" name="expected_quantity" type="number" value="">
42
+ {{/if}}
43
+ </td>
44
+ <td class="actions">
45
+ <a class="fa fa-edit icon_link with-tip no-text" data-action="edit" data-id="{{id}}" href="#"></a>
46
+ <a class="fa fa-check icon_link with-tip no-text" data-action="green" data-id="{{id}}" href="#"></a>
47
+ <a class="fa fa-void icon_link with-tip no-text" data-action="red" data-id="{{id}}" href="#"></a>
48
+ {{#unless isReceiving }}
49
+ <a class="fa fa-trash icon_link with-tip no-text" data-action="remove" data-id="{{id}}" href="#"></a>
50
+ {{/unless}}
51
+ </td>
52
+ </tr>
@@ -0,0 +1,23 @@
1
+ <div class="variant-autocomplete-item media">
2
+ <div class="media-left">
3
+ {{#if variant.image }}
4
+ <img class="media-object" src='{{variant.image}}' />
5
+ {{ else }}
6
+ <img class="media-object" src='<%= image_path("noimage/mini.png") %>' />
7
+ {{/if}}
8
+ </div>
9
+
10
+ <div class="media-body">
11
+ <h6 class="media-heading">{{variant.name}}</h6>
12
+ <dl class="dl-collapse">
13
+ {{#if variant.option_values}}
14
+ {{#each variant.option_values}}
15
+ <dt>{{this.option_type_presentation}}:</dt>
16
+ <dd>{{this.presentation}}</dd>
17
+ {{/each}}
18
+ {{/if}}
19
+ <dt>{{ t "sku" }}</dt>
20
+ <dd>{{variant.sku}}</dd>
21
+ </dl>
22
+ </div>
23
+ </div>
@@ -0,0 +1,51 @@
1
+ <fieldset>
2
+ <legend align="center">{{ t "select_stock" }}</legend>
3
+ <table class="stock-levels" data-hook="stock-levels">
4
+ <colgroup>
5
+ <col style="width: 30%;" />
6
+ <col style="width: 40%;" />
7
+ <col style="width: 20%;" />
8
+ <col style="width: 10%;" />
9
+ </colgroup>
10
+ <thead>
11
+ <th>{{ t "location" }}</th>
12
+ <th>{{ t "count_on_hand" }}</th>
13
+ <th>{{ t "quantity" }}</th>
14
+ <th class="actions"></th>
15
+ </thead>
16
+ <tbody>
17
+ {{#each variant.stock_items}}
18
+ <tr>
19
+ <td>{{this.stock_location_name}}</td>
20
+ {{#unless ../variant.track_inventory}}
21
+ <td>
22
+ It doesn't track inventory
23
+ </td>
24
+ <td>
25
+ <input class="quantity" id="stock_item_quantity" data-stock-location-id="{{this.stock_location_id}}" type="number" min="1" value="1">
26
+ </td>
27
+ <td class="actions">
28
+ <button class="add_variant no-text fa fa-plus icon_link with-tip" data-stock-location-id="{{this.stock_location_id}}" title="{{ t "add" }}" data-action="add"></button>
29
+ </td>
30
+ {{else}}
31
+ {{#if this.available}}
32
+ <td>
33
+ {{this.count_on_hand}}
34
+ {{#if this.backorderable}} ({{ t "backorders_allowed" }}) {{/if}}
35
+ </td>
36
+ <td>
37
+ <input class="quantity" id="stock_item_quantity" data-stock-location-id="{{this.stock_location_id}}" type="number" min="1" value="1">
38
+ </td>
39
+ <td class="actions">
40
+ <button class="add_variant no-text fa fa-plus icon_link with-tip" data-stock-location-id="{{this.stock_location_id}}" title="{{ t "add" }}" data-action="add"></button>
41
+ </td>
42
+ {{else}}
43
+ <td>{{ t "out_of_stock" }}</td>
44
+ <td>0</td>
45
+ {{/if}}
46
+ {{/unless}}
47
+ </tr>
48
+ {{/each}}
49
+ </tbody>
50
+ </table>
51
+ </fieldset>
@@ -0,0 +1,67 @@
1
+ <fieldset>
2
+ <legend align="center">{{ t "select_stock" }}</legend>
3
+ {{#if variant.track_inventory}}
4
+ <table class="stock-levels" data-hook="stock-levels">
5
+ <colgroup>
6
+ <col style="width: 30%;" />
7
+ <col style="width: 40%;" />
8
+ <col style="width: 30%;" />
9
+ </colgroup>
10
+ <thead>
11
+ <th>{{ t "name" }}</th>
12
+ <th>{{ t "location" }}</th>
13
+ <th>{{ t "count_on_hand" }}</th>
14
+ <th>{{ t "quantity" }}</th>
15
+ </thead>
16
+ <tbody>
17
+ {{#each variant.stock_items}}
18
+ <tr>
19
+ <td>{{#unless @index}}{{../../variant.name}}{{/unless}}</td>
20
+ <td>
21
+ {{stock_location_name}}
22
+ </td>
23
+ <td>
24
+ {{count_on_hand}}
25
+ </td>
26
+ <td>
27
+ <input class="quantity variant_quantity" id="quantity_{{@index}}" data-variant-id="{{../variant.id}}" data-stock-location-id="{{stock_location_id}}" type="number" min="0" value="0">
28
+ </td>
29
+ </tr>
30
+ {{/each}}
31
+ </tbody>
32
+ </table>
33
+ {{else}}
34
+ <table class="stock-levels untracked-inventory" data-hook="stock-levels">
35
+ <colgroup>
36
+ <col style="width: 30%;" />
37
+ <col style="width: 40%;" />
38
+ <col style="width: 30%;" />
39
+ </colgroup>
40
+ <thead>
41
+ <th>{{ t "name" }}</th>
42
+ <th>{{ t "count_on_hand" }}</th>
43
+ <th>{{ t "quantity" }}</th>
44
+ </thead>
45
+ <tbody>
46
+ <tr>
47
+ <td>
48
+ {{variant.name}}
49
+ </td>
50
+ <td>
51
+ No inventory necessary
52
+ </td>
53
+ <td>
54
+ <input class="quantity" id="variant_quantity" data-variant-id="{{variant.id}}" type="number" min="0" value="0">
55
+ </td>
56
+ </tr>
57
+ </tbody>
58
+ </table>
59
+ {{/if}}
60
+
61
+
62
+ <fieldset class="no-border-bottom">
63
+ <legend align="center" class="stock-location">
64
+ <button class="add_variant no-text fa fa-plus icon_link" title="{{ t "add" }}" data-action="add">{{ t "add" }}</button>
65
+ </legend>
66
+ </fieldset>
67
+ </fieldset>
@@ -0,0 +1,27 @@
1
+ <tr class='stock-item-split' data-variant-id='{{variant.id}}'>
2
+ <td colspan='2'>
3
+ Move {{variant.name}} to
4
+ </td>
5
+ <td colspan='2'>
6
+ <select name="item_stock_location" id='item_stock_location' style='width:100%;'>
7
+ <option></option>
8
+ <optgroup label="{{ t "existing_shipments" }}">
9
+ {{#each shipments}}
10
+ <option data-shipment-number='{{this.number}}' value='{{this.stock_location_id}}'>{{this.stock_location.name}}({{this.number}})</option>
11
+ {{/each}}
12
+ </optgroup>
13
+ <optgroup label="{{ t "new_shipment_at_location" }}">
14
+ {{#each variant.stock_items}}
15
+ <option data-new-shipment='true' value='{{this.stock_location_id}}'>{{this.stock_location_name}}&nbsp;({{this.count_on_hand}} on hand)</option>
16
+ {{/each}}
17
+ </optgroup>
18
+ </select>
19
+ </td>
20
+ <td>
21
+ <input class="quantity" id="item_quantity" type="number" min="1" value="1" max="{{max_quantity}}">
22
+ </td>
23
+ <td class='actions'>
24
+ <a href='#' class='save-split icon_link fa fa-ok no-text with-tip' title='Save'></a>
25
+ <a href='#' class='cancel-split icon_link fa fa-cancel no-text with-tip' title='Cancel'></a>
26
+ </td>
27
+ </tr>
@@ -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
 
@@ -1,10 +1,8 @@
1
1
  # variant autocompletion
2
2
  $(document).ready ->
3
- if $("#variant_autocomplete_template").length > 0
4
- window.variantTemplate = Handlebars.compile($("#variant_autocomplete_template").text())
5
- window.variantStockTemplate = Handlebars.compile($("#variant_autocomplete_stock_template").text())
6
- window.variantLineItemTemplate = Handlebars.compile($("#variant_line_items_autocomplete_stock_template").text())
7
- return
3
+ window.variantTemplate = HandlebarsTemplates["variants/autocomplete"]
4
+ window.variantStockTemplate = HandlebarsTemplates["variants/autocomplete_stock"]
5
+ window.variantLineItemTemplate = HandlebarsTemplates["variants/line_items_autocomplete_stock"]
8
6
 
9
7
  formatVariantResult = (variant) ->
10
8
  variant.image = variant.images[0].mini_url if variant["images"][0] isnt `undefined` and variant["images"][0].mini_url isnt `undefined`
@@ -35,8 +33,8 @@ $.fn.variantAutocomplete = (searchOptions = {}) ->
35
33
  results: data["variants"]
36
34
 
37
35
  formatResult: formatVariantResult
38
- formatSelection: (variant, container, escapeMarkup) ->
36
+ formatSelection: (variant) ->
39
37
  if !!variant.options_text
40
- Select2.util.escapeMarkup("#{variant.name} (#{variant.options_text}")
38
+ variant.name + " (#{variant.options_text})"
41
39
  else
42
- Select2.util.escapeMarkup(variant.name)
40
+ variant.name