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
@@ -25,14 +25,17 @@
25
25
  }
26
26
  }
27
27
 
28
- .flash, .alert {
28
+ .flash-wrapper {
29
29
  position: fixed;
30
30
  top: 0;
31
31
  left: 0;
32
32
  width: 100%;
33
+ z-index: 1000;
34
+ }
35
+
36
+ .flash {
33
37
  padding: 16px;
34
38
  text-align: center;
35
- z-index: 1000;
36
39
  font-size: 120%;
37
40
  color: $color-1;
38
41
  font-weight: $font-weight-bold;
@@ -51,4 +54,4 @@
51
54
  }
52
55
 
53
56
  &.error a { color: very-light($color-error, 10) }
54
- }
57
+ }
@@ -34,6 +34,22 @@
34
34
  margin-bottom: 0;
35
35
  }
36
36
 
37
+ .promo-rule-option-value {
38
+ position: relative;
39
+ padding-bottom: 10px;
40
+
41
+ .remove {
42
+ cursor: pointer;
43
+ position: absolute;
44
+ right: 10px;
45
+ top: 10px;
46
+
47
+ &:hover {
48
+ color: #c60f13;
49
+ }
50
+ }
51
+ }
52
+
37
53
  .tier {
38
54
  position: relative;
39
55
  padding-bottom: 10px;
@@ -7,7 +7,7 @@ module Spree
7
7
 
8
8
  before_action :authorize_admin
9
9
 
10
- protected
10
+ private
11
11
 
12
12
  def action
13
13
  params[:action].to_sym
@@ -14,7 +14,7 @@ module Spree
14
14
  end
15
15
  end
16
16
 
17
- protected
17
+ private
18
18
 
19
19
  def location_after_save
20
20
  if @option_type.created_at == @option_type.updated_at
@@ -24,8 +24,6 @@ module Spree
24
24
  end
25
25
  end
26
26
 
27
-
28
- private
29
27
  def load_product
30
28
  @product = Product.find_by_param!(params[:product_id])
31
29
  end
@@ -9,7 +9,7 @@ module Spree
9
9
  end
10
10
 
11
11
  def edit
12
- country_id = Address.default.country.id
12
+ country_id = Country.default.id
13
13
  @order.build_bill_address(:country_id => country_id) if @order.bill_address.nil?
14
14
  @order.build_ship_address(:country_id => country_id) if @order.ship_address.nil?
15
15
 
@@ -145,23 +145,23 @@ module Spree
145
145
  end
146
146
 
147
147
  def resend
148
- OrderMailer.confirm_email(@order.id, true).deliver_now
148
+ OrderMailer.confirm_email(@order.id, true).deliver_later
149
149
  flash[:success] = Spree.t(:order_email_resent)
150
150
 
151
151
  redirect_to :back
152
152
  end
153
153
 
154
154
  def open_adjustments
155
- adjustments = @order.all_adjustments.where(state: 'closed')
156
- adjustments.update_all(state: 'open')
155
+ adjustments = @order.all_adjustments.finalized
156
+ adjustments.each(&:unfinalize!)
157
157
  flash[:success] = Spree.t(:all_adjustments_opened)
158
158
 
159
159
  respond_with(@order) { |format| format.html { redirect_to :back } }
160
160
  end
161
161
 
162
162
  def close_adjustments
163
- adjustments = @order.all_adjustments.where(state: 'open')
164
- adjustments.update_all(state: 'closed')
163
+ adjustments = @order.all_adjustments.not_finalized
164
+ adjustments.each(&:finalize!)
165
165
  flash[:success] = Spree.t(:all_adjustments_closed)
166
166
 
167
167
  respond_with(@order) { |format| format.html { redirect_to :back } }
@@ -169,16 +169,11 @@ module Spree
169
169
 
170
170
  private
171
171
  def order_params
172
- params.merge!(extra_order_params)
173
- params.permit(extra_order_params.keys)
174
- end
175
-
176
- def extra_order_params
177
172
  {
178
173
  created_by_id: try_spree_current_user.try(:id),
179
174
  frontend_viewable: false,
180
175
  store_id: current_store.try(:id)
181
- }
176
+ }.with_indifferent_access
182
177
  end
183
178
 
184
179
  def load_order
@@ -4,8 +4,10 @@ module Spree
4
4
  belongs_to 'spree/product', :find_by => :slug
5
5
  before_action :find_properties
6
6
  before_action :setup_property, only: :index, if: -> { can?(:create, model_class) }
7
+ before_action :setup_variant_property_rules, only: :index
7
8
 
8
9
  private
10
+
9
11
  def find_properties
10
12
  @properties = Spree::Property.pluck(:name)
11
13
  end
@@ -13,6 +15,13 @@ module Spree
13
15
  def setup_property
14
16
  @product.product_properties.build
15
17
  end
18
+
19
+ def setup_variant_property_rules
20
+ @option_types = @product.variant_option_values_by_option_type
21
+ @option_value_ids = (params[:ovi] || []).reject(&:blank?).map(&:to_i)
22
+ @variant_property_rule = @product.find_variant_property_rule(@option_value_ids) || @product.variant_property_rules.build
23
+ @variant_property_rule.values.build if can?(:create, Spree::VariantPropertyRuleValue)
24
+ end
16
25
  end
17
26
  end
18
27
  end
@@ -25,6 +25,11 @@ module Spree
25
25
  if params[:product][:option_type_ids].present?
26
26
  params[:product][:option_type_ids] = params[:product][:option_type_ids].split(',')
27
27
  end
28
+ if updating_variant_property_rules?
29
+ params[:product][:variant_property_rules_attributes].each do |index, param_attrs|
30
+ param_attrs[:option_value_ids] = param_attrs[:option_value_ids].split(',')
31
+ end
32
+ end
28
33
  invoke_callbacks(:update, :before)
29
34
  if @object.update_attributes(permitted_resource_params)
30
35
  invoke_callbacks(:update, :after)
@@ -66,14 +71,23 @@ module Spree
66
71
  redirect_to edit_admin_product_url(@new)
67
72
  end
68
73
 
69
- protected
74
+ private
70
75
 
71
76
  def find_resource
72
77
  Product.with_deleted.friendly.find(params[:id])
73
78
  end
74
79
 
75
80
  def location_after_save
76
- spree.edit_admin_product_url(@product)
81
+ if updating_variant_property_rules?
82
+ url_params = {}
83
+ url_params[:ovi] = []
84
+ params[:product][:variant_property_rules_attributes].each do |index, param_attrs|
85
+ url_params[:ovi] += param_attrs[:option_value_ids]
86
+ end
87
+ spree.admin_product_product_properties_url(@product, url_params)
88
+ else
89
+ spree.edit_admin_product_url(@product)
90
+ end
77
91
  end
78
92
 
79
93
  def load_data
@@ -122,16 +136,17 @@ module Spree
122
136
  clone_admin_product_url resource
123
137
  end
124
138
 
125
- private
126
-
127
139
  def variant_stock_includes
128
140
  [:images, stock_items: :stock_location, option_values: :option_type]
129
141
  end
130
142
 
131
-
132
143
  def variant_scope
133
144
  @product.variants
134
145
  end
146
+
147
+ def updating_variant_property_rules?
148
+ params[:product][:variant_property_rules_attributes].present?
149
+ end
135
150
  end
136
151
  end
137
152
  end
@@ -24,7 +24,8 @@ module Spree
24
24
  end
25
25
  end
26
26
 
27
- protected
27
+ private
28
+
28
29
  def load_bulk_code_information
29
30
  @promotion_builder = Spree::PromotionBuilder.new(
30
31
  base_code: @promotion.codes.first.try!(:value),
@@ -3,6 +3,7 @@ module Spree
3
3
  class ReimbursementsController < ResourceController
4
4
  belongs_to 'spree/order', find_by: :number
5
5
 
6
+ before_action :load_stock_locations, only: :edit
6
7
  before_action :load_simulated_refunds, only: :edit
7
8
 
8
9
  rescue_from Spree::Core::GatewayError, with: :spree_core_gateway_error, only: :perform
@@ -32,6 +33,25 @@ module Spree
32
33
  end
33
34
  end
34
35
 
36
+ # We don't currently have a real Reimbursement "new" page. And the only
37
+ # built-in way to create reimburesments via Solidus admin is from the
38
+ # customer returns admin page via a button that supplies the
39
+ # "build_from_customer_return" parameter. The "edit" page is not
40
+ # suitable for use here for that reason as well.
41
+ # Perhaps we should add a reimbursement new page of some sort.
42
+ def render_after_create_error
43
+ flash.keep
44
+ if request.referer
45
+ redirect_to request.referer
46
+ else
47
+ redirect_to admin_url
48
+ end
49
+ end
50
+
51
+ def load_stock_locations
52
+ @stock_locations = Spree::StockLocation.active
53
+ end
54
+
35
55
  def load_simulated_refunds
36
56
  @reimbursement_objects = @reimbursement.simulate
37
57
  end
@@ -100,7 +100,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
100
100
  end
101
101
  end
102
102
 
103
- protected
103
+ private
104
104
 
105
105
  class << self
106
106
  attr_accessor :parent_data
@@ -19,6 +19,7 @@ module Spree
19
19
  load_return_items
20
20
  load_reimbursement_types
21
21
  load_return_reasons
22
+ load_stock_locations
22
23
  end
23
24
 
24
25
  # To satisfy how nested attributes works we want to create placeholder ReturnItems for
@@ -41,6 +42,10 @@ module Spree
41
42
  def load_return_reasons
42
43
  @reasons = Spree::ReturnReason.reasons_for_return_items(@return_authorization.return_items)
43
44
  end
45
+
46
+ def load_stock_locations
47
+ @stock_locations = Spree::StockLocation.order_default.active
48
+ end
44
49
  end
45
50
  end
46
51
  end
@@ -7,7 +7,7 @@ module Spree
7
7
  redirect_to admin_root_redirect_path
8
8
  end
9
9
 
10
- protected
10
+ private
11
11
 
12
12
  def admin_root_redirect_path
13
13
  if can?(:display, Spree::Order) && can?(:admin, Spree::Order)
@@ -14,10 +14,8 @@ module Spree
14
14
  @users = Spree.user_class.ransack({
15
15
  :m => 'or',
16
16
  :email_start => params[:q],
17
- :ship_address_firstname_start => params[:q],
18
- :ship_address_lastname_start => params[:q],
19
- :bill_address_firstname_start => params[:q],
20
- :bill_address_lastname_start => params[:q]
17
+ :addresses_firstname_start => params[:q],
18
+ :addresses_lastname_start => params[:q]
21
19
  }).result.limit(10)
22
20
  end
23
21
  end
@@ -11,7 +11,7 @@ module Spree
11
11
  end
12
12
  end
13
13
 
14
- protected
14
+ private
15
15
 
16
16
  def location_after_save
17
17
  admin_country_states_url(@country)
@@ -49,7 +49,7 @@ module Spree
49
49
  @stock_locations = Spree::StockLocation.accessible_by(current_ability, :read)
50
50
  @stock_item_stock_locations = params[:stock_location_id].present? ? @stock_locations.where(id: params[:stock_location_id]) : @stock_locations
51
51
  @variant_display_attributes = self.class.variant_display_attributes
52
- @variants = Spree::Core::Search::Variant.new(params[:variant_search_term], scope: variant_scope).results
52
+ @variants = Spree::Config.variant_search_class.new(params[:variant_search_term], scope: variant_scope).results
53
53
  @variants = @variants.includes(:images, stock_items: :stock_location, product: :variant_images)
54
54
  @variants = @variants.includes(option_values: :option_type)
55
55
  @variants = @variants.order(id: :desc).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])
@@ -7,8 +7,7 @@ module Spree
7
7
  { translation_key: :name, attr_name: :name }
8
8
  ]
9
9
 
10
- before_filter :load_readable_stock_locations, only: :index
11
- before_filter :load_transferable_stock_locations, only: :new
10
+ before_filter :load_transferable_stock_locations, only: [:index, :new]
12
11
  before_filter :load_variant_display_attributes, only: [:receive, :edit, :show, :tracking_info]
13
12
  before_filter :load_destination_stock_locations, only: :edit
14
13
  before_filter :ensure_access_to_stock_location, only: :create
@@ -52,7 +51,7 @@ module Spree
52
51
  end
53
52
  end
54
53
 
55
- protected
54
+ private
56
55
 
57
56
  def collection
58
57
  params[:q] = params[:q] || {}
@@ -94,24 +93,14 @@ module Spree
94
93
  end
95
94
  end
96
95
 
97
- private
98
-
99
96
  def authorize_transfer_attributes!
100
97
  duplicate = @object.dup
101
98
  duplicate.assign_attributes(permitted_resource_params)
102
99
  authorize! :create, duplicate
103
100
  end
104
101
 
105
- def accessible_stock_locations
106
- Spree::StockLocation.accessible_by(current_ability, :index)
107
- end
108
-
109
102
  def transferable_stock_locations
110
- accessible_stock_locations.accessible_by(current_ability, :transfer)
111
- end
112
-
113
- def load_readable_stock_locations
114
- @stock_locations = accessible_stock_locations
103
+ Spree::StockLocation.accessible_by(current_ability, :transfer)
115
104
  end
116
105
 
117
106
  def load_transferable_stock_locations
@@ -89,7 +89,7 @@ module Spree
89
89
  Spree.user_class
90
90
  end
91
91
 
92
- protected
92
+ private
93
93
 
94
94
  def collection
95
95
  return @collection if @collection.present?
@@ -108,7 +108,6 @@ module Spree
108
108
  end
109
109
  end
110
110
 
111
- private
112
111
  def user_params
113
112
  attributes = permitted_user_attributes | [
114
113
  ship_address_attributes: permitted_address_attributes,
@@ -135,7 +134,7 @@ module Spree
135
134
  when 'basic'
136
135
  collection.map { |u| { 'id' => u.id, 'name' => u.email } }.to_json
137
136
  else
138
- address_fields = [:firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name, :state_id, :country_id]
137
+ address_fields = [:firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name, :state_id, :country_id, :country_iso]
139
138
  includes = { :only => address_fields , :include => { :state => { :only => :name }, :country => { :only => :name } } }
140
139
 
141
140
  collection.to_json(:only => [:id, :email], :include =>
@@ -0,0 +1,7 @@
1
+ module Spree
2
+ module Admin
3
+ class VariantPropertyRuleValuesController < ResourceController
4
+ belongs_to 'spree/product', find_by: :slug
5
+ end
6
+ end
7
+ end
@@ -22,7 +22,7 @@ module Spree
22
22
  end
23
23
  end
24
24
 
25
- protected
25
+ private
26
26
 
27
27
  def new_before
28
28
  @object.attributes = @object.product.master.attributes.except('id', 'created_at', 'deleted_at',
@@ -7,7 +7,7 @@ module Spree
7
7
  @zone.zone_members.build
8
8
  end
9
9
 
10
- protected
10
+ private
11
11
 
12
12
  def collection
13
13
  params[:q] ||= {}
@@ -2,9 +2,8 @@ module Spree
2
2
  module Admin
3
3
  module AdjustmentsHelper
4
4
  def adjustment_state(adjustment)
5
- state = adjustment.state.to_sym
6
- icon = { closed: 'lock', open: 'unlock' }
7
- content_tag(:span, '', class: "fa fa-#{ icon[state] }")
5
+ icon = adjustment.finalized? ? 'lock' : 'unlock'
6
+ content_tag(:span, '', class: "fa fa-#{icon}")
8
7
  end
9
8
 
10
9
  def display_adjustable(adjustable)
@@ -27,15 +26,11 @@ module Spree
27
26
  parts << variant.product.name
28
27
  parts << "(#{variant.options_text})" if variant.options_text.present?
29
28
  parts << line_item.display_total
30
- safe_join(parts, "<br />".html_safe)
29
+ parts.join("<br>").html_safe
31
30
  end
32
31
 
33
32
  def display_shipment(shipment)
34
- parts = [
35
- "#{Spree.t(:shipment)} ##{shipment.number}",
36
- shipment.display_cost
37
- ]
38
- safe_join(parts, "<br />".html_safe)
33
+ "#{Spree.t(:shipment)} ##{shipment.number}<br>#{shipment.display_cost}".html_safe
39
34
  end
40
35
 
41
36
  def display_order(order)