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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +3 -0
- data/app/assets/javascripts/spree/backend/admin.js.erb +17 -24
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +3 -5
- data/app/assets/javascripts/spree/backend/flash.coffee +17 -0
- data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +9 -0
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/option_value_picker.js +43 -0
- data/app/assets/javascripts/spree/backend/product_picker.js +10 -8
- data/app/assets/javascripts/spree/backend/promotions.js.coffee +101 -0
- data/app/assets/javascripts/spree/backend/routes.js +2 -1
- data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
- data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +1 -1
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
- data/app/assets/javascripts/spree/backend/stock_transfers/variant_form.coffee +1 -1
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/taxons.js.coffee +6 -7
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/products/sortable.hbs +5 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +10 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs +1 -0
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +19 -0
- data/app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb +52 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +23 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +51 -0
- data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +67 -0
- data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +27 -0
- data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +6 -8
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +6 -3
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +16 -0
- data/app/controllers/spree/admin/base_controller.rb +1 -1
- data/app/controllers/spree/admin/option_types_controller.rb +1 -3
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +6 -11
- data/app/controllers/spree/admin/product_properties_controller.rb +9 -0
- data/app/controllers/spree/admin/products_controller.rb +20 -5
- data/app/controllers/spree/admin/promotions_controller.rb +2 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +20 -0
- data/app/controllers/spree/admin/resource_controller.rb +1 -1
- data/app/controllers/spree/admin/return_authorizations_controller.rb +5 -0
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/search_controller.rb +2 -4
- data/app/controllers/spree/admin/states_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +3 -14
- data/app/controllers/spree/admin/users_controller.rb +2 -3
- data/app/controllers/spree/admin/variant_property_rule_values_controller.rb +7 -0
- data/app/controllers/spree/admin/variants_controller.rb +1 -1
- data/app/controllers/spree/admin/zones_controller.rb +1 -1
- data/app/helpers/spree/admin/adjustments_helper.rb +4 -9
- data/app/helpers/spree/admin/base_helper.rb +7 -6
- data/app/helpers/spree/admin/navigation_helper.rb +8 -2
- data/app/helpers/spree/admin/orders_helper.rb +1 -1
- data/app/helpers/spree/admin/products_helper.rb +2 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +1 -1
- data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -5
- data/app/views/spree/admin/orders/_add_product.html.erb +0 -3
- data/app/views/spree/admin/orders/_carton.html.erb +0 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/confirm/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +0 -1
- data/app/views/spree/admin/orders/index.html.erb +1 -2
- data/app/views/spree/admin/payment_methods/_form.html.erb +0 -4
- data/app/views/spree/admin/payment_methods/index.html.erb +0 -2
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +3 -0
- data/app/views/spree/admin/product_properties/index.html.erb +52 -2
- data/app/views/spree/admin/promotions/_actions.html.erb +14 -10
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +5 -3
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +5 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +18 -14
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +5 -28
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +5 -27
- data/app/views/spree/admin/promotions/edit.html.erb +6 -4
- data/app/views/spree/admin/promotions/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -0
- data/app/views/spree/admin/refund_reasons/index.html.erb +2 -2
- data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
- data/app/views/spree/admin/search/users.rabl +1 -1
- data/app/views/spree/admin/shared/_order_summary.html.erb +6 -0
- data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/_translations.html.erb +16 -46
- data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +0 -2
- data/app/views/spree/admin/stock_movements/_form.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -3
- data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
- data/app/views/spree/admin/taxons/index.html.erb +0 -1
- data/app/views/spree/admin/users/_addresses_form.html.erb +4 -4
- data/app/views/spree/layouts/admin.html.erb +11 -9
- data/config/routes.rb +5 -0
- data/lib/spree/backend.rb +1 -2
- metadata +41 -139
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -6
- data/Rakefile +0 -15
- data/app/assets/javascripts/spree/backend/handlebar_extensions.js +0 -9
- data/app/assets/javascripts/spree/backend/promotions.js +0 -73
- data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +0 -196
- data/app/views/spree/admin/products/_autocomplete.js.erb +0 -14
- data/app/views/spree/admin/products/_sortable.html +0 -7
- data/app/views/spree/admin/stock_items/_stock_location_stock_item_template.html.erb +0 -21
- data/app/views/spree/admin/stock_transfers/_transfer_item_template.html.erb +0 -54
- data/app/views/spree/admin/variants/_autocomplete.js.erb +0 -25
- data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +0 -69
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -53
- data/app/views/spree/admin/variants/_split.js.erb +0 -29
- data/script/rails +0 -9
- data/solidus_backend.gemspec +0 -30
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -24
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -77
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -234
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -80
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -472
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -175
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -75
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -134
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -166
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -226
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -104
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -50
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -331
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -309
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -236
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -54
- data/spec/features/admin/configuration/countries_spec.rb +0 -22
- data/spec/features/admin/configuration/general_settings_spec.rb +0 -45
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -125
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -64
- data/spec/features/admin/configuration/states_spec.rb +0 -64
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -50
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -30
- data/spec/features/admin/configuration/taxonomies_spec.rb +0 -52
- data/spec/features/admin/configuration/zones_spec.rb +0 -39
- data/spec/features/admin/homepage_spec.rb +0 -78
- data/spec/features/admin/locale_spec.rb +0 -30
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
- data/spec/features/admin/orders/adjustments_spec.rb +0 -126
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -48
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -48
- data/spec/features/admin/orders/customer_details_spec.rb +0 -163
- data/spec/features/admin/orders/line_items_spec.rb +0 -50
- data/spec/features/admin/orders/listing_spec.rb +0 -130
- data/spec/features/admin/orders/log_entries_spec.rb +0 -55
- data/spec/features/admin/orders/new_order_spec.rb +0 -197
- data/spec/features/admin/orders/order_details_spec.rb +0 -533
- data/spec/features/admin/orders/payments_spec.rb +0 -228
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -47
- data/spec/features/admin/orders/shipments_spec.rb +0 -65
- data/spec/features/admin/payments/store_credits_spec.rb +0 -21
- data/spec/features/admin/products/edit/images_spec.rb +0 -87
- data/spec/features/admin/products/edit/products_spec.rb +0 -66
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -56
- data/spec/features/admin/products/edit/variants_spec.rb +0 -61
- data/spec/features/admin/products/option_types_spec.rb +0 -114
- data/spec/features/admin/products/products_spec.rb +0 -392
- data/spec/features/admin/products/properties_spec.rb +0 -139
- data/spec/features/admin/products/prototypes_spec.rb +0 -110
- data/spec/features/admin/products/stock_management_spec.rb +0 -82
- data/spec/features/admin/products/variant_spec.rb +0 -51
- data/spec/features/admin/promotion_adjustments_spec.rb +0 -220
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -69
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
- data/spec/features/admin/reports_spec.rb +0 -61
- data/spec/features/admin/stock_transfer_spec.rb +0 -86
- data/spec/features/admin/store_credits_spec.rb +0 -82
- data/spec/features/admin/taxons_spec.rb +0 -31
- data/spec/features/admin/users_spec.rb +0 -270
- data/spec/helpers/admin/base_helper_spec.rb +0 -24
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -73
- data/spec/helpers/admin/reimbursements_helper_spec.rb +0 -34
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -95
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -108
- data/spec/support/appear_before_matcher.rb +0 -8
- data/spec/support/ror_ringer.jpeg +0 -0
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
- data/vendor/assets/javascripts/handlebars.js +0 -2746
@@ -25,14 +25,17 @@
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
-
.flash
|
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;
|
@@ -14,7 +14,7 @@ module Spree
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
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 =
|
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).
|
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.
|
156
|
-
adjustments.
|
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.
|
164
|
-
adjustments.
|
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
|
-
|
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
|
-
|
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
|
@@ -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
|
@@ -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
|
@@ -14,10 +14,8 @@ module Spree
|
|
14
14
|
@users = Spree.user_class.ransack({
|
15
15
|
:m => 'or',
|
16
16
|
:email_start => params[:q],
|
17
|
-
:
|
18
|
-
:
|
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
|
@@ -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::
|
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 :
|
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
|
-
|
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
|
-
|
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
|
-
|
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 =>
|
@@ -2,9 +2,8 @@ module Spree
|
|
2
2
|
module Admin
|
3
3
|
module AdjustmentsHelper
|
4
4
|
def adjustment_state(adjustment)
|
5
|
-
|
6
|
-
|
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
|
-
|
29
|
+
parts.join("<br>").html_safe
|
31
30
|
end
|
32
31
|
|
33
32
|
def display_shipment(shipment)
|
34
|
-
|
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)
|