solidus_backend 2.0.3 → 2.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 (192) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +14 -6
  3. data/app/assets/javascripts/spree/backend/images/upload.js +203 -0
  4. data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -1
  5. data/app/assets/javascripts/spree/backend/stock_management/index_update_forms.coffee +1 -1
  6. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +5 -1
  7. data/app/assets/javascripts/spree/backend/taxons.js.coffee +1 -1
  8. data/app/assets/javascripts/spree/backend/templates/index.js +15 -0
  9. data/app/assets/javascripts/spree/backend/templates/products/upload_progress.hbs +12 -0
  10. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +13 -11
  11. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +12 -10
  12. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +7 -5
  13. data/app/assets/javascripts/spree/backend.js +57 -3
  14. data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +1 -1
  15. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +2 -0
  16. data/app/assets/stylesheets/spree/backend/components/_table-filter.scss +3 -1
  17. data/app/assets/stylesheets/spree/backend/components/_tabs.scss +2 -0
  18. data/app/assets/stylesheets/spree/backend/sections/_adjustments.scss +3 -0
  19. data/app/assets/stylesheets/spree/backend/sections/_products.scss +29 -17
  20. data/app/assets/stylesheets/spree/backend/sections/_stock_management.scss +6 -0
  21. data/app/assets/stylesheets/spree/backend/shared/_header.scss +2 -0
  22. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +5 -0
  23. data/app/assets/stylesheets/spree/backend/shared/_utilities.scss +1 -2
  24. data/app/assets/stylesheets/spree/backend/spree_admin.scss +1 -3
  25. data/app/controllers/spree/admin/orders_controller.rb +2 -0
  26. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  27. data/app/controllers/spree/admin/prices_controller.rb +7 -1
  28. data/app/controllers/spree/admin/products_controller.rb +0 -6
  29. data/app/controllers/spree/admin/promotions_controller.rb +0 -2
  30. data/app/controllers/spree/admin/users_controller.rb +3 -0
  31. data/app/helpers/spree/admin/adjustments_helper.rb +1 -1
  32. data/app/helpers/spree/admin/base_helper.rb +0 -35
  33. data/app/helpers/spree/admin/stock_transfers_helper.rb +14 -0
  34. data/app/models/spree/backend_configuration.rb +2 -2
  35. data/app/views/spree/admin/adjustment_reasons/index.html.erb +1 -1
  36. data/app/views/spree/admin/adjustment_reasons/shared/_form.html.erb +14 -16
  37. data/app/views/spree/admin/adjustments/_adjustment.html.erb +4 -1
  38. data/app/views/spree/admin/adjustments/_form.html.erb +24 -20
  39. data/app/views/spree/admin/cancellations/index.html.erb +2 -3
  40. data/app/views/spree/admin/countries/_form.html.erb +4 -4
  41. data/app/views/spree/admin/customer_returns/index.html.erb +1 -1
  42. data/app/views/spree/admin/customer_returns/new.html.erb +5 -7
  43. data/app/views/spree/admin/general_settings/edit.html.erb +55 -46
  44. data/app/views/spree/admin/images/_form.html.erb +13 -11
  45. data/app/views/spree/admin/images/_image_row.html.erb +22 -0
  46. data/app/views/spree/admin/images/create.js.erb +9 -0
  47. data/app/views/spree/admin/images/edit.html.erb +12 -8
  48. data/app/views/spree/admin/images/index.html.erb +57 -49
  49. data/app/views/spree/admin/option_types/_form.html.erb +2 -2
  50. data/app/views/spree/admin/option_types/index.html.erb +1 -1
  51. data/app/views/spree/admin/orders/_add_line_item.html.erb +5 -3
  52. data/app/views/spree/admin/orders/_add_product.html.erb +5 -3
  53. data/app/views/spree/admin/orders/_shipment.html.erb +14 -6
  54. data/app/views/spree/admin/orders/cart.html.erb +1 -1
  55. data/app/views/spree/admin/orders/confirm/_customer_details.html.erb +17 -15
  56. data/app/views/spree/admin/orders/customer_details/_form.html.erb +28 -26
  57. data/app/views/spree/admin/orders/customer_details/show.html.erb +1 -1
  58. data/app/views/spree/admin/orders/edit.html.erb +1 -1
  59. data/app/views/spree/admin/orders/index.html.erb +70 -63
  60. data/app/views/spree/admin/payment_methods/_form.html.erb +54 -48
  61. data/app/views/spree/admin/payment_methods/index.html.erb +7 -5
  62. data/app/views/spree/admin/payments/_form.html.erb +2 -2
  63. data/app/views/spree/admin/payments/index.html.erb +1 -1
  64. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +32 -30
  65. data/app/views/spree/admin/payments/source_forms/_storecredit.html.erb +1 -0
  66. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +1 -1
  67. data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +8 -1
  68. data/app/views/spree/admin/prices/_form.html.erb +38 -43
  69. data/app/views/spree/admin/prices/_master_variant_table.html.erb +41 -0
  70. data/app/views/spree/admin/prices/_table.html.erb +35 -33
  71. data/app/views/spree/admin/prices/index.html.erb +37 -35
  72. data/app/views/spree/admin/product_properties/index.html.erb +0 -7
  73. data/app/views/spree/admin/products/_form.html.erb +153 -144
  74. data/app/views/spree/admin/products/edit.html.erb +1 -1
  75. data/app/views/spree/admin/products/index.html.erb +19 -13
  76. data/app/views/spree/admin/products/new.html.erb +5 -38
  77. data/app/views/spree/admin/promotion_categories/_form.html.erb +1 -1
  78. data/app/views/spree/admin/promotion_rules/create.js.erb +6 -0
  79. data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
  80. data/app/views/spree/admin/promotions/_form.html.erb +48 -44
  81. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
  82. data/app/views/spree/admin/promotions/_rules.html.erb +8 -4
  83. data/app/views/spree/admin/promotions/actions/_create_quantity_adjustments.html.erb +9 -5
  84. data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +30 -24
  85. data/app/views/spree/admin/promotions/edit.html.erb +2 -2
  86. data/app/views/spree/admin/promotions/index.html.erb +22 -20
  87. data/app/views/spree/admin/promotions/new.html.erb +1 -1
  88. data/app/views/spree/admin/promotions/rules/_first_repeat_purchase_since.html.erb +11 -5
  89. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +18 -8
  90. data/app/views/spree/admin/promotions/rules/_landing_page.html.erb +7 -5
  91. data/app/views/spree/admin/promotions/rules/_nth_order.html.erb +13 -6
  92. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +11 -7
  93. data/app/views/spree/admin/promotions/rules/_product.html.erb +11 -7
  94. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +15 -9
  95. data/app/views/spree/admin/promotions/rules/_user.html.erb +5 -3
  96. data/app/views/spree/admin/promotions/rules/_user_role.html.erb +12 -0
  97. data/app/views/spree/admin/properties/_form.html.erb +2 -2
  98. data/app/views/spree/admin/properties/index.html.erb +7 -5
  99. data/app/views/spree/admin/refund_reasons/index.html.erb +1 -1
  100. data/app/views/spree/admin/refund_reasons/shared/_form.html.erb +14 -16
  101. data/app/views/spree/admin/refunds/edit.html.erb +2 -2
  102. data/app/views/spree/admin/refunds/new.html.erb +4 -4
  103. data/app/views/spree/admin/shared/_configuration_menu.html.erb +0 -4
  104. data/app/views/spree/admin/shared/_head.html.erb +1 -1
  105. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +0 -3
  106. data/app/views/spree/admin/shared/_rebuild_vat_prices_checkbox.html.erb +1 -1
  107. data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +2 -2
  108. data/app/views/spree/admin/shared/_sidebar.html.erb +1 -1
  109. data/app/views/spree/admin/shared/_variant_search.html.erb +12 -8
  110. data/app/views/spree/admin/shared/named_types/_form.html.erb +1 -1
  111. data/app/views/spree/admin/shared/named_types/_index.html.erb +1 -1
  112. data/app/views/spree/admin/shipping_categories/index.html.erb +1 -1
  113. data/app/views/spree/admin/shipping_methods/_form.html.erb +74 -81
  114. data/app/views/spree/admin/shipping_methods/index.html.erb +3 -3
  115. data/app/views/spree/admin/states/_form.html.erb +2 -2
  116. data/app/views/spree/admin/states/index.html.erb +9 -5
  117. data/app/views/spree/admin/stock_locations/_form.html.erb +42 -28
  118. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +4 -4
  119. data/app/views/spree/admin/stock_locations/index.html.erb +1 -1
  120. data/app/views/spree/admin/stock_movements/_form.html.erb +1 -1
  121. data/app/views/spree/admin/stock_movements/index.html.erb +1 -1
  122. data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +1 -1
  123. data/app/views/spree/admin/stock_transfers/_transfer_item_table.html.erb +10 -1
  124. data/app/views/spree/admin/stock_transfers/index.html.erb +29 -27
  125. data/app/views/spree/admin/stock_transfers/show.html.erb +26 -24
  126. data/app/views/spree/admin/store_credits/_form.html.erb +3 -3
  127. data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +1 -1
  128. data/app/views/spree/admin/store_credits/edit_amount.html.erb +1 -1
  129. data/app/views/spree/admin/store_credits/index.html.erb +2 -2
  130. data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +49 -47
  131. data/app/views/spree/admin/style_guide/topics/messaging/_loading.html.erb +11 -1
  132. data/app/views/spree/admin/tax_categories/_form.html.erb +4 -4
  133. data/app/views/spree/admin/tax_categories/index.html.erb +1 -1
  134. data/app/views/spree/admin/tax_rates/_form.html.erb +28 -28
  135. data/app/views/spree/admin/tax_rates/index.html.erb +1 -1
  136. data/app/views/spree/admin/taxonomies/index.html.erb +1 -1
  137. data/app/views/spree/admin/taxons/_form.html.erb +6 -6
  138. data/app/views/spree/admin/taxons/index.html.erb +2 -2
  139. data/app/views/spree/admin/users/_addresses_form.html.erb +19 -15
  140. data/app/views/spree/admin/users/_form.html.erb +9 -6
  141. data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -1
  142. data/app/views/spree/admin/users/addresses.html.erb +1 -1
  143. data/app/views/spree/admin/users/edit.html.erb +2 -2
  144. data/app/views/spree/admin/users/items.html.erb +2 -2
  145. data/app/views/spree/admin/users/orders.html.erb +2 -2
  146. data/app/views/spree/admin/variants/_form.html.erb +73 -49
  147. data/app/views/spree/admin/variants/_table_filter.html.erb +12 -8
  148. data/app/views/spree/admin/variants/index.html.erb +2 -2
  149. data/app/views/spree/admin/zones/_country_members.html.erb +1 -1
  150. data/app/views/spree/admin/zones/_form.html.erb +34 -31
  151. data/app/views/spree/admin/zones/_state_members.html.erb +1 -1
  152. data/app/views/spree/admin/zones/index.html.erb +1 -3
  153. data/app/views/spree/layouts/admin.html.erb +4 -4
  154. data/config/routes.rb +0 -11
  155. data/solidus_backend.gemspec +4 -1
  156. data/spec/controllers/spree/admin/payments_controller_spec.rb +2 -3
  157. data/spec/controllers/spree/admin/prices_controller_spec.rb +5 -3
  158. data/spec/features/admin/configuration/general_settings_spec.rb +12 -0
  159. data/spec/features/admin/configuration/payment_methods_spec.rb +3 -2
  160. data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
  161. data/spec/features/admin/homepage_spec.rb +0 -3
  162. data/spec/features/admin/orders/adjustments_spec.rb +28 -25
  163. data/spec/features/admin/orders/customer_details_spec.rb +1 -1
  164. data/spec/features/admin/orders/order_details_spec.rb +27 -1
  165. data/spec/features/admin/orders/payments_spec.rb +1 -1
  166. data/spec/features/admin/products/edit/images_spec.rb +28 -1
  167. data/spec/features/admin/products/pricing_spec.rb +17 -2
  168. data/spec/features/admin/products/products_spec.rb +0 -104
  169. data/spec/features/admin/store_credits_spec.rb +3 -3
  170. data/spec/features/admin/users_spec.rb +7 -1
  171. metadata +21 -32
  172. data/app/assets/javascripts/spree/backend/nested-attribute.js +0 -27
  173. data/app/assets/stylesheets/spree/backend/sections/_adjustments_table.scss +0 -8
  174. data/app/assets/stylesheets/spree/backend/sections/_edit_checkouts.scss +0 -72
  175. data/app/assets/stylesheets/spree/backend/sections/_tax_zones.scss +0 -15
  176. data/app/controllers/spree/admin/prototypes_controller.rb +0 -26
  177. data/app/controllers/spree/admin/trackers_controller.rb +0 -6
  178. data/app/views/spree/admin/prototypes/_form.html.erb +0 -36
  179. data/app/views/spree/admin/prototypes/_prototypes.html.erb +0 -25
  180. data/app/views/spree/admin/prototypes/available.js.erb +0 -2
  181. data/app/views/spree/admin/prototypes/edit.html.erb +0 -15
  182. data/app/views/spree/admin/prototypes/index.html.erb +0 -50
  183. data/app/views/spree/admin/prototypes/new.html.erb +0 -9
  184. data/app/views/spree/admin/prototypes/new.js.erb +0 -5
  185. data/app/views/spree/admin/prototypes/select.js.erb +0 -4
  186. data/app/views/spree/admin/prototypes/show.html.erb +0 -42
  187. data/app/views/spree/admin/trackers/_form.html.erb +0 -28
  188. data/app/views/spree/admin/trackers/edit.html.erb +0 -19
  189. data/app/views/spree/admin/trackers/index.html.erb +0 -54
  190. data/app/views/spree/admin/trackers/new.html.erb +0 -18
  191. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -50
  192. data/spec/features/admin/products/prototypes_spec.rb +0 -110
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55510f03148db2e09cdb1aaa0523baeec5bbae9d
4
- data.tar.gz: eb123f0ad9a9e839c463596375c3b20a5644b193
3
+ metadata.gz: 843448fe45669bd2d5c20177528681a86678af12
4
+ data.tar.gz: 07bc2239dacdc468b0f0b3b5de5524b1cbf46d17
5
5
  SHA512:
6
- metadata.gz: 710b34f8c86cb2c27a473742ba065bc970ea305a91e426d3983b384d3b97e0641283ff1f957f05ec0fc7d18f40561e608f515fdb0fe4735151ecfa1d7c1fd7e9
7
- data.tar.gz: f81f091d59880d78d158dbd49348c0a8e1d9176231b1d239c50021651142acfd1312870884ab809d52473640c6520055b9ad327910996f2995a7d949bb85ff3b
6
+ metadata.gz: ac0d850fe4e077c868e6f695a5d69f8f8c467f64bfc72eaa6f7d57a6ca569ffa8a2d99610de334e0e562a0c3962b477ab2baa73205ff418dd97c9ac74eae03f7
7
+ data.tar.gz: 475ea49cd2c1f70ee7599dcb87980969cd95f744bd46f7e4554c57b71f3ff3a14f53e1b2954cac648a0a9ab8f71a7644184c5e106f9de1175bab193bcd4c9c3c
@@ -1,11 +1,19 @@
1
1
  #= require handlebars
2
2
 
3
- Handlebars.registerHelper "t", (key)->
4
- if Spree.translations[key]
5
- Spree.translations[key]
6
- else
7
- console.error "No translation found for #{key}."
8
- key
3
+ # Resolves string keys with dots in a deeply nested object
4
+ # http://stackoverflow.com/a/22129960/4405214
5
+ resolveObject = (path, obj) ->
6
+ path.split('.').reduce ((prev, curr) ->
7
+ if prev then prev[curr] else undefined
8
+ ), obj || self
9
+
10
+
11
+ Handlebars.registerHelper "t", (key) ->
12
+ translation = resolveObject key, Spree.translations
13
+ return translation if translation
14
+
15
+ console.error "No translation found for #{key}."
16
+ key
9
17
 
10
18
  Handlebars.registerHelper "admin_url", ->
11
19
  Spree.pathFor("admin")
@@ -0,0 +1,203 @@
1
+ // Inspired by: http://html5demos.com/dnd-upload
2
+ Spree.prepareImageUploader = function () {
3
+ var uploadZone = document.getElementById('upload-zone');
4
+ if(!uploadZone) return;
5
+
6
+ var UploadZone = Backbone.View.extend({
7
+ el: uploadZone,
8
+
9
+ events: {
10
+ "dragover" : "onDragOver",
11
+ "dragleave" : "onDragLeave",
12
+ "drop" : "onDrop",
13
+ 'change input[type="file"]' : "onFileBrowserSelect"
14
+ },
15
+
16
+ progressZone: document.getElementById('progress-zone'),
17
+
18
+ // Hide or highlight supported browser features
19
+ initialize: function() {
20
+ "filereader formdata progress".split(' ').forEach(function (api) {
21
+ this.support[api].className = (this.tests[api] === false) ? 'red' : 'hidden'
22
+ }, this);
23
+ },
24
+
25
+ upload: function(file) {
26
+ if (!FormData) return;
27
+
28
+ var progressModel = new ProgressModel({file: file});
29
+ progressModel.previewFile();
30
+ progressModel.uploadFile();
31
+
32
+ var progressView = new ProgressView({model: progressModel});
33
+ this.progressZone.appendChild(progressView.render().el);
34
+ },
35
+
36
+ dragClass: 'with-images',
37
+
38
+ onDragOver: function(e) {
39
+ this.el.classList.add(this.dragClass);
40
+ e.preventDefault();
41
+ },
42
+
43
+ onDragLeave: function() {
44
+ this.el.classList.remove(this.dragClass);
45
+ },
46
+
47
+ onDrop: function(e) {
48
+ this.el.classList.remove(this.dragClass);
49
+ e.preventDefault();
50
+
51
+ _.each(e.originalEvent.dataTransfer.files, this.upload, this);
52
+ },
53
+
54
+ onFileBrowserSelect: function(e) {
55
+ _.each(e.target.files, this.upload, this);
56
+ },
57
+
58
+ tests: {
59
+ filereader: typeof FileReader != 'undefined',
60
+ dnd: 'draggable' in document.createElement('span'),
61
+ formdata: !!window.FormData,
62
+ progress: "upload" in new XMLHttpRequest
63
+ },
64
+
65
+ support: {
66
+ filereader: document.getElementById('filereader'),
67
+ formdata: document.getElementById('formdata'),
68
+ progress: document.getElementById('progress')
69
+ }
70
+ });
71
+
72
+ var ProgressModel = Backbone.Model.extend({
73
+ initialize: function() {
74
+ this.set({summary: this.get("file").name});
75
+ },
76
+
77
+ defaults: function() {
78
+ return {
79
+ file: null,
80
+ imgSrc: '',
81
+ progress: 0,
82
+ serverError: false,
83
+ summary: ''
84
+ }
85
+ },
86
+
87
+ acceptedTypes: {
88
+ 'image/png': true,
89
+ 'image/jpeg': true,
90
+ 'image/gif': true
91
+ },
92
+
93
+ variantId: document.querySelector('input[name="image[viewable_id]"]').value,
94
+
95
+ previewFile: function () {
96
+ var file = this.get('file'),
97
+ that = this;
98
+
99
+ if (FileReader && this.acceptedTypes[file.type] === true) {
100
+ var reader = new FileReader();
101
+ reader.onload = function (event) {
102
+ that.set({imgSrc: event.target.result});
103
+ };
104
+
105
+ reader.readAsDataURL(file);
106
+ } else {
107
+ var summary = 'Uploading ' + file.name + ' ' + (file.size ? (file.size/1024|0) + 'K' : '');
108
+ this.set({summary: summary});
109
+ }
110
+ },
111
+
112
+ uploadFile: function () {
113
+ var formData = new FormData(),
114
+ that = this;
115
+
116
+ formData.append('image[attachment]', this.get('file'));
117
+ formData.append('image[viewable_id]', this.variantId);
118
+ formData.append('upload_id', this.cid);
119
+
120
+ // send the image to the server
121
+ Spree.ajax({
122
+ url: window.location.pathname,
123
+ type: "POST",
124
+ dataType: 'script',
125
+ data: formData,
126
+ processData: false, // tell jQuery not to process the data
127
+ contentType: false, // tell jQuery not to set contentType
128
+ xhr: function () {
129
+ xhr = $.ajaxSettings.xhr();
130
+ if (xhr.upload) {
131
+ xhr.upload.onprogress = function (event) {
132
+ if (event.lengthComputable) {
133
+ var complete = (event.loaded / event.total * 100 | 0);
134
+ that.set({progress: complete})
135
+ }
136
+ };
137
+ }
138
+ return xhr;
139
+ }
140
+ }).done(function() {
141
+ that.set({progress: 100})
142
+ }).error(function(jqXHR, textStatus, errorThrown) {
143
+ that.set({serverError: true});
144
+ });
145
+ }
146
+ }); // end ProgressModel
147
+
148
+
149
+ var ProgressView = Backbone.View.extend({
150
+ tagName: "div",
151
+
152
+ // Cache the template function for a single item.
153
+ template: HandlebarsTemplates["products/upload_progress"],
154
+
155
+ initialize: function() {
156
+ this.listenTo(this.model, 'change:progress', this.updateProgressBar);
157
+ this.listenTo(this.model, 'change', this.render);
158
+ this.listenTo(this.model, 'destroy', this.remove);
159
+ },
160
+
161
+ events: {
162
+ "clear" : "clear"
163
+ },
164
+
165
+ className: 'col-sm-6 col-md-4 margin-bottom-one',
166
+
167
+ attributes: function() {
168
+ return {
169
+ "data-upload-id": this.model.cid
170
+ }
171
+ },
172
+
173
+ render: function() {
174
+ // Skip progress bar update for better performance
175
+ var changedAttrs = Object.keys(this.model.changed);
176
+ if(changedAttrs.length === 1 && changedAttrs[0] == 'progress') return this;
177
+
178
+ this.el.innerHTML = this.template(this.model.attributes);
179
+ return this;
180
+ },
181
+
182
+ updateProgressBar: function() {
183
+ var progressBar = this.el.querySelector('progress');
184
+ progressBar.value = progressBar.innerHTML = this.model.get('progress');
185
+ return this;
186
+ },
187
+
188
+ // Remove the item, destroy the model
189
+ clear: function() {
190
+ this.model.destroy();
191
+ }
192
+ }); // end ProgressView
193
+
194
+
195
+ // Kick off by binding the events on the upload zone
196
+ new UploadZone();
197
+
198
+ }; // end prepareImageUploader
199
+
200
+
201
+ Spree.ready(function () {
202
+ Spree.prepareImageUploader();
203
+ });
@@ -15,7 +15,8 @@ $.fn.optionValueAutocomplete = function (options) {
15
15
  multiple: multiple,
16
16
  initSelection: function (element, callback) {
17
17
  $.get(Spree.routes.option_value_search, {
18
- ids: element.val().split(',')
18
+ ids: element.val().split(','),
19
+ token: Spree.api_key
19
20
  }, function (data) {
20
21
  callback(multiple ? data : data[0]);
21
22
  });
@@ -46,7 +46,7 @@ Spree.EditStockItemView = Backbone.View.extend
46
46
  onSubmit: (ev) ->
47
47
  ev.preventDefault()
48
48
  backorderable = @$('[name=backorderable]').prop("checked")
49
- countOnHand = parseInt($("input[name='count_on_hand']").val(), 10)
49
+ countOnHand = parseInt(@$("input[name='count_on_hand']").val(), 10)
50
50
 
51
51
  @model.set
52
52
  count_on_hand: countOnHand
@@ -5,11 +5,15 @@ $.fn.taxonAutocomplete = function () {
5
5
  placeholder: Spree.translations.taxon_placeholder,
6
6
  multiple: true,
7
7
  initSelection: function (element, callback) {
8
+ var ids = element.val(),
9
+ count = ids.split(",").length;
10
+
8
11
  Spree.ajax({
9
12
  type: "GET",
10
13
  url: Spree.routes.taxons_search,
11
14
  data: {
12
- ids: element.val(),
15
+ ids: ids,
16
+ per_page: count,
13
17
  without_children: true
14
18
  },
15
19
  success: function (data) {
@@ -68,6 +68,6 @@ $ ->
68
68
  $('#taxon_id').on "change", (e) ->
69
69
  Spree.ajax
70
70
  url: Spree.routes.taxon_products_api,
71
- data: { id: e.val }
71
+ data: { id: e.val, simple: 1 }
72
72
  success: (data) ->
73
73
  sortable.html productListTemplate(data.products)
@@ -0,0 +1,15 @@
1
+ //= require spree/backend/templates/orders/customer_details/autocomplete
2
+ //= require spree/backend/templates/products/sortable
3
+ //= require spree/backend/templates/products/upload_progress
4
+ //= require spree/backend/templates/promotions/calculators/fields/tiered_flat_rate
5
+ //= require spree/backend/templates/promotions/calculators/fields/tiered_percent
6
+ //= require spree/backend/templates/promotions/rules/option_values
7
+ //= require spree/backend/templates/promotions/rules/option_values_select
8
+ //= require spree/backend/templates/stock_items/stock_location_stock_item
9
+ //= require spree/backend/templates/stock_transfers/transfer_item
10
+ //= require spree/backend/templates/taxons/_tree
11
+ //= require spree/backend/templates/taxons/tree
12
+ //= require spree/backend/templates/variants/autocomplete
13
+ //= require spree/backend/templates/variants/autocomplete_stock
14
+ //= require spree/backend/templates/variants/line_items_autocomplete_stock
15
+ //= require spree/backend/templates/variants/split
@@ -0,0 +1,12 @@
1
+ <div class="card progress-card">
2
+ <img src="{{ imgSrc }}" class="card-img-top img-fluid">
3
+
4
+ <div class="card-block">
5
+ <progress min="0" max="100" value="{{ progress }}">{{ progress }}</progress>
6
+
7
+ <summary>{{ summary }}</summary>
8
+ <br>
9
+
10
+ <error class="text-danger {{#unless serverError}} hidden {{/unless}}">{{t 'admin.images.index.image_process_failed' }}</error>
11
+ </div>
12
+ </div>
@@ -1,16 +1,18 @@
1
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}}>
2
+ <div class="row">
3
+ <div class="col-xs-6">
4
+ <a class="fa fa-trash remove js-remove-tier"></a>
5
+ <div class="input-group">
6
+ <span class="input-group-addon">$</span>
7
+ <input class="js-base-input form-control" type="text" value={{baseField.value}}>
8
+ </div>
7
9
  </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}}>
10
+ <div class="col-xs-6">
11
+ <div class="input-group">
12
+ <span class="input-group-addon">$</span>
13
+ <input class="js-value-input form-control"
14
+ name="{{valueField.name}}" type="text" value={{valueField.value}}>
15
+ </div>
14
16
  </div>
15
17
  </div>
16
18
  <div class="clear"></div>
@@ -1,16 +1,18 @@
1
1
  <div class="fullwidth tier">
2
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}}>
3
+ <div class="row">
4
+ <div class="col-xs-6">
5
+ <div class="input-group">
6
+ <span class="input-group-addon">$</span>
7
+ <input class="js-base-input form-control" type="text" value={{baseField.value}}>
8
+ </div>
7
9
  </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>
10
+ <div class="col-xs-6">
11
+ <div class="input-group">
12
+ <input class="js-value-input form-control right-align"
13
+ name="{{valueField.name}}" type="text" value={{valueField.value}}>
14
+ <span class="input-group-addon">%</span>
15
+ </div>
14
16
  </div>
15
17
  </div>
16
18
  <div class="clear"></div>
@@ -1,9 +1,11 @@
1
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}}>
2
+ <div class="row">
3
+ <div class="col-xs-6">
4
+ <input class="js-promo-rule-option-value-product-select fullwidth" type="hidden" value="{{ productSelect.value }}">
5
+ </div>
6
+ <div class="col-xs-5">
7
+ <input class="js-promo-rule-option-value-option-values-select fullwidth" name="{{ paramPrefix }}[preferred_eligible_values][{{ productSelect.value }}]" type="hidden" value={{optionValuesSelect.value}}>
8
+ </div>
7
9
  </div>
8
10
  <a class="fa fa-trash remove js-remove-promo-rule-option-value"></a>
9
11
  <div class="clear"></div>
@@ -12,7 +12,61 @@
12
12
  //= require solidus_admin/bootstrap
13
13
  //= require prism
14
14
  //= require spree
15
- //= require ./backend/backbone-overrides
15
+ //= require spree/backend/backbone-overrides
16
16
  //= require spree/backend/spree-select2
17
- //= require_tree ./backend/templates
18
- //= require_tree .
17
+ //
18
+ //= require spree/backend/templates
19
+ //
20
+ //= require spree/backend/address_states
21
+ //= require spree/backend/adjustments
22
+ //= require spree/backend/admin
23
+ //= require spree/backend/calculator
24
+ //= require spree/backend/checkouts/edit
25
+ //= require spree/backend/components/tabs
26
+ //= require spree/backend/components/tooltips
27
+ //= require spree/backend/flash
28
+ //= require spree/backend/gateway
29
+ //= require spree/backend/handlebars_extensions
30
+ //= require spree/backend/images/index
31
+ //= require spree/backend/images/new
32
+ //= require spree/backend/images/upload
33
+ //= require spree/backend/line_items
34
+ //= require spree/backend/line_items_on_order_edit
35
+ //= require spree/backend/navigation
36
+ //= require spree/backend/number_field_updater
37
+ //= require spree/backend/option_type_autocomplete
38
+ //= require spree/backend/option_value_picker
39
+ //= require spree/backend/orders/edit
40
+ //= require spree/backend/payments/edit
41
+ //= require spree/backend/payments/new
42
+ //= require spree/backend/product_picker
43
+ //= require spree/backend/progress
44
+ //= require spree/backend/promotions
45
+ //= require spree/backend/returns/expedited_exchanges_warning
46
+ //= require spree/backend/returns/return_item_selection
47
+ //= require spree/backend/routes
48
+ //= require spree/backend/select_payments
49
+ //= require spree/backend/shipments
50
+ //= require spree/backend/spree-select2
51
+ //= require spree/backend/states
52
+ //= require spree/backend/stock_management/index_add_forms
53
+ //= require spree/backend/stock_management/index_update_forms
54
+ //= require spree/backend/stock_management/stock_item
55
+ //= require spree/backend/stock_movement
56
+ //= require spree/backend/stock_transfers/count_update_forms
57
+ //= require spree/backend/stock_transfers/edit
58
+ //= require spree/backend/stock_transfers/receive
59
+ //= require spree/backend/stock_transfers/received_counter
60
+ //= require spree/backend/stock_transfers/stock_transfer
61
+ //= require spree/backend/stock_transfers/transfer_item
62
+ //= require spree/backend/stock_transfers/transfer_item_deleting
63
+ //= require spree/backend/stock_transfers/variant_form
64
+ //= require spree/backend/store_credits
65
+ //= require spree/backend/style_guide
66
+ //= require spree/backend/taxon_autocomplete
67
+ //= require spree/backend/taxonomy
68
+ //= require spree/backend/taxons
69
+ //= require spree/backend/user_picker
70
+ //= require spree/backend/variant_autocomplete
71
+ //= require spree/backend/variant_management
72
+ //= require spree/backend/zone
@@ -49,7 +49,7 @@ $enable-shadows: false !default;
49
49
  $enable-gradients: false !default;
50
50
  $enable-transitions: false !default;
51
51
  $enable-hover-media-query: false !default;
52
- $enable-grid-classes: false !default;
52
+ $enable-grid-classes: true !default;
53
53
 
54
54
 
55
55
  // Spacing
@@ -26,6 +26,8 @@ body:not(.new-layout) #sidebar {
26
26
  min-height: 3em;
27
27
  }
28
28
  }
29
+
30
+ @media print { display: none }
29
31
  }
30
32
 
31
33
  body.new-layout .content-sidebar {
@@ -11,4 +11,6 @@
11
11
  .actions {
12
12
  text-align: center;
13
13
  }
14
- }
14
+
15
+ @media print { display: none }
16
+ }
@@ -13,6 +13,8 @@
13
13
  a {
14
14
  padding: 1em;
15
15
  }
16
+
17
+ @media print { display: none }
16
18
  }
17
19
 
18
20
  .tabs > li:not(.in-dropdown) {
@@ -0,0 +1,3 @@
1
+ .adjustment-ineligible {
2
+ text-decoration: line-through;
3
+ }
@@ -1,20 +1,3 @@
1
- [data-hook="admin_products_index_search"] {
2
- @include make-row();
3
-
4
- > * {
5
- @include make-col();
6
- @include padding(0 null); // override the padding on .field
7
- }
8
- }
9
-
10
- .product-search-field-name {
11
- @include make-col-span(6);
12
- }
13
-
14
- .product-search-field-sku {
15
- @include make-col-span(4);
16
- }
17
-
18
1
  .product-search-field-show-deleted.field.checkbox {
19
2
  // extra specificity to override styles
20
3
  @include make-col-span(2);
@@ -52,3 +35,32 @@ div[data-hook="admin_products_index_search_buttons"] {
52
35
  color: $color-2;
53
36
  }
54
37
  }
38
+
39
+ #upload-zone {
40
+ border: 2px dashed $color-border;
41
+ padding: 2rem 5rem;
42
+ text-align: center;
43
+ margin: 1rem auto;
44
+ width: 70%;
45
+
46
+ label.upload {
47
+ display: block;
48
+ }
49
+
50
+ &.with-images {
51
+ border-color: $color-success;
52
+ }
53
+ }
54
+
55
+ progress {
56
+ width: 100%;
57
+ }
58
+
59
+ .margin-bottom-one {
60
+ margin-bottom: 1rem;
61
+ }
62
+
63
+ .progress-card {
64
+ height: 100%;
65
+ padding: 1rem;
66
+ }
@@ -10,6 +10,7 @@
10
10
  > tr.stock-item-edit-row {
11
11
  td {
12
12
  background-color: $color-tbl-even;
13
+ border-left: none;
13
14
  }
14
15
  &:nth-child(even) td {
15
16
  /* An nth-even child is actually an odd row */
@@ -39,4 +40,9 @@
39
40
  }
40
41
  }
41
42
 
43
+ tr:hover {
44
+ .stock-variant-field-table td {
45
+ background-color: transparent;
46
+ }
47
+ }
42
48
  }
@@ -8,6 +8,8 @@
8
8
  body:not(.new-layout) & {
9
9
  margin-left: $width-sidebar;
10
10
  }
11
+
12
+ @media print { display: none }
11
13
  }
12
14
 
13
15
  .page-title {
@@ -14,11 +14,16 @@ body {
14
14
  .admin-nav {
15
15
  @include position(absolute, 0 null 0 0);
16
16
  width: $width-sidebar;
17
+ img {
18
+ max-width: 100%;
19
+ }
20
+ @media print { display: none }
17
21
  }
18
22
 
19
23
  .content-wrapper {
20
24
  body:not(.new-layout) & {
21
25
  margin-left: $width-sidebar;
26
+ @media print { margin-left: 0 }
22
27
  }
23
28
 
24
29
  body.new-layout & {
@@ -26,8 +26,7 @@
26
26
  margin-right: -10px;
27
27
  }
28
28
 
29
- .container .column,
30
- .container .columns {
29
+ .container {
31
30
  // Float container right instead of left.
32
31
  .right {
33
32
  float: right;
@@ -37,14 +37,12 @@
37
37
  @import 'spree/backend/plugins/select2';
38
38
  @import 'spree/backend/plugins/bootstrap_tooltip';
39
39
 
40
- @import 'spree/backend/sections/adjustments_table';
40
+ @import 'spree/backend/sections/adjustments';
41
41
  @import 'spree/backend/sections/orders';
42
42
  @import 'spree/backend/sections/products';
43
43
  @import 'spree/backend/sections/promotions';
44
- @import 'spree/backend/sections/edit_checkouts';
45
44
  @import 'spree/backend/sections/bulk_transfer';
46
45
  @import 'spree/backend/sections/return_authorizations';
47
- @import 'spree/backend/sections/tax_zones';
48
46
  @import 'spree/backend/sections/log_entries';
49
47
  @import 'spree/backend/sections/taxonomies';
50
48
  @import 'spree/backend/sections/taxons';
@@ -1,6 +1,8 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class OrdersController < Spree::Admin::BaseController
4
+ helper 'spree/admin/payments'
5
+
4
6
  before_action :initialize_order_events
5
7
  before_action :load_order, only: [:edit, :update, :complete, :advance, :cancel, :resume, :approve, :resend, :unfinalize_adjustments, :finalize_adjustments, :cart, :confirm]
6
8
  around_action :lock_order, only: [:update, :advance, :complete, :confirm, :cancel, :resume, :approve, :resend]
@@ -78,7 +78,7 @@ module Spree
78
78
 
79
79
  def load_data
80
80
  @amount = params[:amount] || load_order.total
81
- @payment_methods = PaymentMethod.available(:back_end)
81
+ @payment_methods = PaymentMethod.available_to_admin
82
82
  if @payment && @payment.payment_method
83
83
  @payment_method = @payment.payment_method
84
84
  else