spree_backend 4.1.11 → 4.2.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/backend-add.svg +5 -0
- data/app/assets/images/backend-adjust.svg +5 -0
- data/app/assets/images/backend-approve.svg +3 -0
- data/app/assets/images/backend-arrow-down.svg +1 -0
- data/app/assets/images/backend-arrow-left.svg +1 -0
- data/app/assets/images/backend-arrow-right.svg +1 -0
- data/app/assets/images/backend-arrow-up.svg +1 -0
- data/app/assets/images/backend-calendar.svg +9 -0
- data/app/assets/images/backend-cancel.svg +7 -0
- data/app/assets/images/backend-capture.svg +3 -0
- data/app/assets/images/backend-cart.svg +1 -0
- data/app/assets/images/backend-chevron-down.svg +1 -0
- data/app/assets/images/backend-chevron-left.svg +1 -0
- data/app/assets/images/backend-chevron-right.svg +1 -0
- data/app/assets/images/backend-chevron-up.svg +1 -0
- data/app/assets/images/backend-clone.svg +7 -0
- data/app/assets/images/backend-close.svg +7 -0
- data/app/assets/images/backend-delete.svg +6 -0
- data/app/assets/images/backend-double-chevron-left.svg +15 -0
- data/app/assets/images/backend-double-chevron-right.svg +17 -0
- data/app/assets/images/backend-edit.svg +14 -0
- data/app/assets/images/backend-enter.svg +6 -0
- data/app/assets/images/backend-envelope.svg +3 -0
- data/app/assets/images/backend-exit.svg +13 -0
- data/app/assets/images/backend-extensions.svg +4 -0
- data/app/assets/images/backend-eye-open.svg +8 -0
- data/app/assets/images/backend-file.svg +6 -0
- data/app/assets/images/backend-filter.svg +3 -0
- data/app/assets/images/backend-folder.svg +4 -0
- data/app/assets/images/backend-images.svg +7 -0
- data/app/assets/images/backend-info.svg +7 -0
- data/app/assets/images/backend-items.svg +5 -0
- data/app/assets/images/backend-leaf.svg +7 -0
- data/app/assets/images/backend-list.svg +5 -0
- data/app/assets/images/backend-location.svg +4 -0
- data/app/assets/images/backend-menu.svg +5 -0
- data/app/assets/images/backend-money.svg +1 -0
- data/app/assets/images/backend-move.svg +5 -0
- data/app/assets/images/backend-ok.svg +3 -0
- data/app/assets/images/backend-pagination-double-arrow-right.svg +8 -0
- data/app/assets/images/backend-payments.svg +8 -0
- data/app/assets/images/backend-pencil.svg +1 -0
- data/app/assets/images/backend-products.svg +5 -0
- data/app/assets/images/backend-promotion.svg +8 -0
- data/app/assets/images/backend-recycle.svg +5 -0
- data/app/assets/images/backend-remove.svg +6 -0
- data/app/assets/images/backend-report.svg +6 -0
- data/app/assets/images/backend-resume.svg +5 -0
- data/app/assets/images/backend-returns.svg +3 -0
- data/app/assets/images/backend-save.svg +3 -0
- data/app/assets/images/backend-search.svg +1 -0
- data/app/assets/images/backend-settings.svg +6 -0
- data/app/assets/images/backend-shipping.svg +3 -0
- data/app/assets/images/backend-slack.svg +3 -0
- data/app/assets/images/backend-sort.svg +5 -0
- data/app/assets/images/backend-split.svg +3 -0
- data/app/assets/images/backend-store.svg +14 -0
- data/app/assets/images/backend-tick.svg +3 -0
- data/app/assets/images/backend-update.svg +3 -0
- data/app/assets/images/backend-user.svg +3 -0
- data/app/assets/images/backend-users.svg +6 -0
- data/app/assets/images/backend-view.svg +8 -0
- data/app/assets/images/backend-void.svg +7 -0
- data/app/assets/javascripts/spree/backend.js +5 -2
- data/app/assets/javascripts/spree/backend/admin.js +156 -147
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +1 -0
- data/app/assets/javascripts/spree/backend/flatpickr_locals.js +37 -0
- data/app/assets/javascripts/spree/backend/multi_currency.js +38 -0
- data/app/assets/javascripts/spree/backend/payments/edit.js +4 -3
- data/app/assets/javascripts/spree/backend/payments/new.js +18 -18
- data/app/assets/javascripts/spree/backend/promotions.js +1 -1
- data/app/assets/javascripts/spree/backend/spree-select2.js +18 -4
- data/app/assets/javascripts/spree/backend/stock_management.js +2 -1
- data/app/assets/javascripts/spree/backend/taxon_tree_menu.js +4 -4
- data/app/assets/javascripts/spree/backend/taxonomy.js +8 -1
- data/app/assets/javascripts/spree/backend/taxons.js +25 -16
- data/app/assets/javascripts/spree/backend/user_picker.js +1 -1
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +1 -1
- data/app/assets/javascripts/spree/backend/variant_management.js +2 -1
- data/app/assets/stylesheets/spree/backend.css +1 -1
- data/app/assets/stylesheets/spree/backend/components/_buttons.scss +27 -11
- data/app/assets/stylesheets/spree/backend/components/_filters.scss +35 -5
- data/app/assets/stylesheets/spree/backend/components/_icons.scss +39 -4
- data/app/assets/stylesheets/spree/backend/components/_main.scss +32 -6
- data/app/assets/stylesheets/spree/backend/components/_navbar.scss +16 -8
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +119 -55
- data/app/assets/stylesheets/spree/backend/components/_tables.scss +62 -19
- data/app/assets/stylesheets/spree/backend/components/_taxon_products_view.scss +26 -63
- data/app/assets/stylesheets/spree/backend/global/_variables.scss +5 -1
- data/app/assets/stylesheets/spree/backend/plugins/_flatpickr.scss +95 -0
- data/app/assets/stylesheets/spree/backend/plugins/_jquery_ui.scss +0 -117
- data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +73 -24
- data/app/assets/stylesheets/spree/backend/shared/_base.scss +40 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +38 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +5 -0
- data/app/assets/stylesheets/spree/backend/views/_order_payments.scss +12 -0
- data/app/assets/stylesheets/spree/backend/views/_product_properties.scss +11 -0
- data/app/assets/stylesheets/spree/backend/views/prototypes.scss +42 -0
- data/app/controllers/spree/admin/general_settings_controller.rb +27 -0
- data/app/controllers/spree/admin/prices_controller.rb +39 -0
- data/app/controllers/spree/admin/stock_transfers_controller.rb +8 -1
- data/app/controllers/spree/admin/stores_controller.rb +61 -1
- data/app/controllers/spree/admin/taxons_controller.rb +5 -1
- data/app/helpers/spree/admin/base_helper.rb +25 -8
- data/app/helpers/spree/admin/navigation_helper.rb +50 -19
- data/app/helpers/spree/admin/orders_helper.rb +2 -2
- data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_first_page.html.erb +1 -1
- data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_gap.html.erb +1 -1
- data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_last_page.html.erb +1 -1
- data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_next_page.html.erb +1 -1
- data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_page.html.erb +0 -0
- data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_paginator.html.erb +1 -1
- data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_prev_page.html.erb +1 -1
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +2 -2
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +16 -16
- data/app/views/spree/admin/adjustments/edit.html.erb +2 -2
- data/app/views/spree/admin/adjustments/index.html.erb +3 -3
- data/app/views/spree/admin/adjustments/new.html.erb +1 -1
- data/app/views/spree/admin/countries/_form.html.erb +9 -4
- data/app/views/spree/admin/countries/index.html.erb +27 -24
- data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +37 -35
- data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +2 -0
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +45 -43
- data/app/views/spree/admin/customer_returns/index.html.erb +3 -1
- data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
- data/app/views/spree/admin/general_settings/_form.html.erb +27 -0
- data/app/views/spree/admin/general_settings/edit.html.erb +4 -3
- data/app/views/spree/admin/images/edit.html.erb +2 -2
- data/app/views/spree/admin/images/index.html.erb +7 -7
- data/app/views/spree/admin/images/new.html.erb +2 -2
- data/app/views/spree/admin/log_entries/index.html.erb +4 -3
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
- data/app/views/spree/admin/option_types/edit.html.erb +22 -20
- data/app/views/spree/admin/option_types/index.html.erb +27 -25
- data/app/views/spree/admin/orders/_adjustments.html.erb +26 -26
- data/app/views/spree/admin/orders/_line_items.html.erb +7 -7
- data/app/views/spree/admin/orders/_order_actions.html.erb +1 -1
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +44 -42
- data/app/views/spree/admin/orders/_shipment.html.erb +6 -6
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +5 -5
- data/app/views/spree/admin/orders/_store_form.html.erb +3 -3
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +135 -127
- data/app/views/spree/admin/payment_methods/index.html.erb +6 -4
- data/app/views/spree/admin/payments/_capture_events.html.erb +18 -16
- data/app/views/spree/admin/payments/_form.html.erb +1 -1
- data/app/views/spree/admin/payments/_list.html.erb +39 -37
- data/app/views/spree/admin/payments/index.html.erb +2 -3
- data/app/views/spree/admin/payments/new.html.erb +1 -1
- data/app/views/spree/admin/payments/show.html.erb +1 -1
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +30 -30
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +20 -18
- data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +28 -26
- data/app/views/spree/admin/prices/_variant_prices.html.erb +43 -0
- data/app/views/spree/admin/prices/index.html.erb +21 -0
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +16 -4
- data/app/views/spree/admin/product_properties/index.html.erb +24 -19
- data/app/views/spree/admin/products/_add_stock_form.html.erb +1 -1
- data/app/views/spree/admin/products/_autocomplete.js.erb +27 -21
- data/app/views/spree/admin/products/_form.html.erb +40 -9
- data/app/views/spree/admin/products/edit.html.erb +1 -1
- data/app/views/spree/admin/products/index.html.erb +24 -19
- data/app/views/spree/admin/products/new.html.erb +11 -2
- data/app/views/spree/admin/products/stock.html.erb +3 -3
- data/app/views/spree/admin/promotion_categories/index.html.erb +4 -1
- data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
- data/app/views/spree/admin/promotions/_form.html.erb +44 -17
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +1 -1
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
- data/app/views/spree/admin/promotions/_rules.html.erb +4 -4
- data/app/views/spree/admin/promotions/edit.html.erb +2 -2
- data/app/views/spree/admin/promotions/index.html.erb +5 -3
- data/app/views/spree/admin/promotions/new.html.erb +7 -6
- data/app/views/spree/admin/promotions/rules/_country.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +5 -5
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +6 -13
- data/app/views/spree/admin/promotions/rules/_product.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_taxon.html.erb +1 -1
- data/app/views/spree/admin/properties/index.html.erb +5 -3
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +30 -28
- data/app/views/spree/admin/prototypes/index.html.erb +21 -19
- data/app/views/spree/admin/prototypes/show.html.erb +21 -8
- data/app/views/spree/admin/refunds/edit.html.erb +2 -2
- data/app/views/spree/admin/refunds/new.html.erb +2 -2
- data/app/views/spree/admin/reimbursement_types/_form.html.erb +4 -4
- data/app/views/spree/admin/reimbursement_types/index.html.erb +4 -2
- data/app/views/spree/admin/reimbursements/edit.html.erb +66 -63
- data/app/views/spree/admin/reimbursements/index.html.erb +21 -20
- data/app/views/spree/admin/reimbursements/show.html.erb +66 -60
- data/app/views/spree/admin/reports/index.html.erb +18 -17
- data/app/views/spree/admin/reports/sales_total.html.erb +20 -19
- data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -2
- data/app/views/spree/admin/return_authorizations/edit.html.erb +3 -3
- data/app/views/spree/admin/return_authorizations/index.html.erb +3 -1
- data/app/views/spree/admin/return_authorizations/new.html.erb +2 -2
- data/app/views/spree/admin/return_index/customer_returns.html.erb +4 -4
- data/app/views/spree/admin/return_index/return_authorizations.html.erb +4 -4
- data/app/views/spree/admin/roles/index.html.erb +21 -19
- data/app/views/spree/admin/shared/_account_nav.html.erb +51 -65
- data/app/views/spree/admin/shared/_address_form.html.erb +31 -73
- data/app/views/spree/admin/shared/_cal_close.html.erb +10 -0
- data/app/views/spree/admin/shared/_content_header.html.erb +40 -21
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +2 -2
- data/app/views/spree/admin/shared/_header.html.erb +14 -11
- data/app/views/spree/admin/shared/_index_table_options.html.erb +5 -7
- data/app/views/spree/admin/shared/_main_menu.html.erb +25 -14
- data/app/views/spree/admin/shared/_new_resource_links.html.erb +2 -2
- data/app/views/spree/admin/shared/_order_summary.html.erb +2 -0
- data/app/views/spree/admin/shared/_order_tabs.html.erb +9 -9
- data/app/views/spree/admin/shared/_product_tabs.html.erb +13 -5
- data/app/views/spree/admin/shared/_refunds.html.erb +31 -29
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +27 -6
- data/app/views/spree/admin/shared/_sidebar.html.erb +19 -1
- data/app/views/spree/admin/shared/_table_filter.html.erb +3 -3
- data/app/views/spree/admin/shared/_translations.html.erb +33 -1
- data/app/views/spree/admin/shared/_version.html.erb +1 -1
- data/app/views/spree/admin/shared/named_types/_index.html.erb +3 -1
- data/app/views/spree/admin/shipping_categories/index.html.erb +3 -1
- data/app/views/spree/admin/shipping_methods/index.html.erb +3 -1
- data/app/views/spree/admin/state_changes/index.html.erb +5 -2
- data/app/views/spree/admin/states/_state_list.html.erb +25 -24
- data/app/views/spree/admin/states/index.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +2 -2
- data/app/views/spree/admin/stock_locations/index.html.erb +3 -1
- data/app/views/spree/admin/stock_movements/index.html.erb +28 -26
- data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +20 -18
- data/app/views/spree/admin/stock_transfers/index.html.erb +6 -4
- data/app/views/spree/admin/stock_transfers/new.html.erb +3 -3
- data/app/views/spree/admin/stock_transfers/show.html.erb +3 -3
- data/app/views/spree/admin/store_credit_categories/index.html.erb +3 -1
- data/app/views/spree/admin/store_credits/index.html.erb +3 -1
- data/app/views/spree/admin/stores/_form.html.erb +128 -68
- data/app/views/spree/admin/stores/edit.html.erb +1 -1
- data/app/views/spree/admin/stores/index.html.erb +4 -2
- data/app/views/spree/admin/tax_categories/index.html.erb +29 -27
- data/app/views/spree/admin/tax_rates/index.html.erb +3 -1
- data/app/views/spree/admin/taxonomies/_list.html.erb +24 -22
- data/app/views/spree/admin/taxonomies/edit.html.erb +2 -2
- data/app/views/spree/admin/taxonomies/index.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +3 -3
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +24 -22
- data/app/views/spree/admin/taxons/edit.html.erb +6 -2
- data/app/views/spree/admin/taxons/index.html.erb +1 -1
- data/app/views/spree/admin/users/_lifetime_stats.html.erb +24 -23
- data/app/views/spree/admin/users/_sidebar.html.erb +5 -5
- data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -1
- data/app/views/spree/admin/users/edit.html.erb +2 -2
- data/app/views/spree/admin/users/index.html.erb +25 -23
- data/app/views/spree/admin/users/items.html.erb +3 -2
- data/app/views/spree/admin/users/orders.html.erb +30 -29
- data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +3 -3
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +2 -2
- data/app/views/spree/admin/variants/_form.html.erb +14 -2
- data/app/views/spree/admin/variants/_split.js.erb +2 -2
- data/app/views/spree/admin/variants/index.html.erb +7 -5
- data/app/views/spree/admin/zones/index.html.erb +4 -4
- data/app/views/spree/layouts/admin.html.erb +33 -27
- data/config/initializers/ransack.rb +31 -0
- data/config/routes.rb +1 -0
- data/lib/spree/backend.rb +2 -0
- data/lib/spree_backend.rb +0 -1
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spree_backend.gemspec +6 -4
- data/vendor/assets/javascripts/js.cookie.js +154 -156
- data/vendor/assets/javascripts/purify.js +1217 -0
- data/vendor/assets/javascripts/sortable.js +3709 -0
- data/vendor/assets/stylesheets/animate.css +7 -3156
- data/vendor/assets/stylesheets/jquery.jstree/themes/spree/style.scss +23 -9
- metadata +137 -24
@@ -24,3 +24,41 @@ span.or {
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
}
|
27
|
+
|
28
|
+
// Hide number toggler
|
29
|
+
// Chrome, Safari, Edge, Opera
|
30
|
+
input.hide-number-toggle::-webkit-outer-spin-button,
|
31
|
+
input.hide-number-toggle::-webkit-inner-spin-button {
|
32
|
+
-webkit-appearance: none;
|
33
|
+
margin: 0;
|
34
|
+
}
|
35
|
+
// Firefox
|
36
|
+
input[type=number].hide-number-toggle {
|
37
|
+
-moz-appearance: textfield;
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
// Remove the default 5px outlines and box-shadows
|
42
|
+
// from all inputs on focus.
|
43
|
+
.form-control:focus {
|
44
|
+
box-shadow: none !important;
|
45
|
+
}
|
46
|
+
|
47
|
+
*:focus {
|
48
|
+
outline: none;
|
49
|
+
}
|
50
|
+
|
51
|
+
:-webkit-direct-focus {
|
52
|
+
outline-color: transparent;
|
53
|
+
outline-style: auto;
|
54
|
+
outline-width: 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
.custom-select {
|
58
|
+
background: $input-bg url(asset-path("backend-chevron-down.svg")) no-repeat right 0.5rem center/8px 10px;
|
59
|
+
background-size: 0.7em;
|
60
|
+
&:focus{
|
61
|
+
outline: none;
|
62
|
+
box-shadow: none;
|
63
|
+
}
|
64
|
+
}
|
@@ -20,6 +20,11 @@
|
|
20
20
|
|
21
21
|
@import 'plugins/select2';
|
22
22
|
@import 'plugins/jquery_ui';
|
23
|
+
@import 'plugins/flatpickr';
|
23
24
|
|
24
25
|
@import 'shared/base';
|
25
26
|
@import 'shared/forms';
|
27
|
+
|
28
|
+
@import 'views/order_payments';
|
29
|
+
@import 'views/product_properties';
|
30
|
+
@import 'views/prototypes';
|
@@ -0,0 +1,42 @@
|
|
1
|
+
$color_size: 26px;
|
2
|
+
|
3
|
+
.product-prototype-options {
|
4
|
+
.option-type-values {
|
5
|
+
&__color {
|
6
|
+
display: flex;
|
7
|
+
flex-wrap: wrap;
|
8
|
+
align-items: center;
|
9
|
+
max-width: 350px;
|
10
|
+
input {
|
11
|
+
display: none;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
li {
|
15
|
+
display: flex;
|
16
|
+
align-items: center;
|
17
|
+
margin: 0.25rem;
|
18
|
+
input {
|
19
|
+
margin-right: 0.5rem;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
.option-value__color {
|
24
|
+
border-radius: 50%;
|
25
|
+
border: 2px solid #d3d3d3;
|
26
|
+
width: $color_size;
|
27
|
+
height: $color_size;
|
28
|
+
overflow: hidden;
|
29
|
+
padding: 1px;
|
30
|
+
&:after {
|
31
|
+
content: '';
|
32
|
+
display: inline-block;
|
33
|
+
width: 100%;
|
34
|
+
height: 100%;
|
35
|
+
background-color: var(--presentation);
|
36
|
+
border-radius: 50%;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
input:checked + .option-value__color {
|
40
|
+
border-color: #565656;
|
41
|
+
}
|
42
|
+
}
|
@@ -3,6 +3,8 @@ module Spree
|
|
3
3
|
class GeneralSettingsController < Spree::Admin::BaseController
|
4
4
|
include Spree::Backend::Callbacks
|
5
5
|
|
6
|
+
before_action :update_currency_settings, only: :update
|
7
|
+
|
6
8
|
def edit
|
7
9
|
@preferences_security = []
|
8
10
|
end
|
@@ -23,6 +25,31 @@ module Spree
|
|
23
25
|
invoke_callbacks(:clear_cache, :after)
|
24
26
|
head :no_content
|
25
27
|
end
|
28
|
+
|
29
|
+
def render(*args)
|
30
|
+
@preferences_currency |= [:allow_currency_change, :show_currency_selector]
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def update_currency_settings
|
37
|
+
params.each do |name, value|
|
38
|
+
next unless Spree::Config.has_preference?(name) && name.eql?('supported_currencies')
|
39
|
+
|
40
|
+
value = update_value(value)
|
41
|
+
Spree::Config[name] = value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def update_value(value)
|
46
|
+
value.split(',').
|
47
|
+
map { |curr| ::Money::Currency.find(curr.strip).try(:iso_code) }.
|
48
|
+
concat([Spree::Config[:currency]]).
|
49
|
+
uniq.
|
50
|
+
compact.
|
51
|
+
join(',')
|
52
|
+
end
|
26
53
|
end
|
27
54
|
end
|
28
55
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class PricesController < ResourceController
|
4
|
+
belongs_to 'spree/product', find_by: :slug
|
5
|
+
|
6
|
+
helper_method :supported_currencies_for_all_stores
|
7
|
+
|
8
|
+
def create
|
9
|
+
params.require(:vp).permit!
|
10
|
+
params[:vp].each do |variant_id, prices|
|
11
|
+
next unless variant_id
|
12
|
+
|
13
|
+
variant = Spree::Variant.find(variant_id)
|
14
|
+
next unless variant
|
15
|
+
|
16
|
+
supported_currencies_for_all_stores.each do |currency|
|
17
|
+
price = variant.price_in(currency.iso_code)
|
18
|
+
price.price = (prices[currency.iso_code]['price'].blank? ? nil : prices[currency.iso_code]['price'])
|
19
|
+
price.compare_at_price = (prices[currency.iso_code]['compare_at_price'].blank? ? nil : prices[currency.iso_code]['compare_at_price'])
|
20
|
+
price.save! if price.new_record? && price.price || !price.new_record? && price.changed?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
flash[:success] = Spree.t('notice_messages.prices_saved')
|
24
|
+
redirect_to admin_product_path(parent)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def supported_currencies_for_all_stores
|
30
|
+
@supported_currencies_for_all_stores = begin
|
31
|
+
(
|
32
|
+
Spree::Store.pluck(:supported_currencies).map { |c| c&.split(',') }.flatten + Spree::Store.pluck(:default_currency)
|
33
|
+
).
|
34
|
+
compact.uniq.map { |code| ::Money::Currency.find(code.strip) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -20,7 +20,10 @@ module Spree
|
|
20
20
|
|
21
21
|
def create
|
22
22
|
if params[:variant].nil?
|
23
|
-
flash[:error] = Spree.t('stock_transfer.errors.must_have_variant')
|
23
|
+
flash.now[:error] = Spree.t('stock_transfer.errors.must_have_variant')
|
24
|
+
render :new
|
25
|
+
elsif any_missing_variants?(params[:variant])
|
26
|
+
flash.now[:error] = Spree.t('stock_transfer.errors.variants_unavailable', stock: source_location.name)
|
24
27
|
render :new
|
25
28
|
else
|
26
29
|
variants = Hash.new(0)
|
@@ -51,6 +54,10 @@ module Spree
|
|
51
54
|
def destination_location
|
52
55
|
@destination_location ||= StockLocation.find(params[:transfer_destination_location_id])
|
53
56
|
end
|
57
|
+
|
58
|
+
def any_missing_variants?(variant_ids)
|
59
|
+
source_location&.stock_items&.where(variant_id: variant_ids, count_on_hand: 0)&.any?
|
60
|
+
end
|
54
61
|
end
|
55
62
|
end
|
56
63
|
end
|
@@ -3,9 +3,43 @@ module Spree
|
|
3
3
|
class StoresController < Spree::Admin::BaseController
|
4
4
|
before_action :load_store, only: [:new, :edit, :update]
|
5
5
|
before_action :set_default_currency, only: :new
|
6
|
+
before_action :set_default_locale, only: :new
|
7
|
+
before_action :normalize_supported_currencies, only: [:create, :update]
|
8
|
+
before_action :set_default_country_id, only: :new
|
9
|
+
before_action :load_all_countries, only: [:new, :edit, :update, :create]
|
10
|
+
|
11
|
+
if defined?(SpreeI18n)
|
12
|
+
include SpreeI18n::LocaleHelper
|
13
|
+
end
|
14
|
+
|
15
|
+
helper_method :all_locales_options
|
6
16
|
|
7
17
|
def index
|
8
|
-
|
18
|
+
if params[:ids]
|
19
|
+
load_stores_by_ids
|
20
|
+
elsif params[:q]
|
21
|
+
load_stores_by_query
|
22
|
+
else
|
23
|
+
@stores = Spree::Store.all
|
24
|
+
end
|
25
|
+
|
26
|
+
respond_with(@stores) do |format|
|
27
|
+
format.json { render layout: false }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_stores_by_ids
|
32
|
+
ids = params[:ids].split(',')
|
33
|
+
@stores = Spree::Store.where(id: ids)
|
34
|
+
end
|
35
|
+
|
36
|
+
def load_stores_by_query
|
37
|
+
@stores = if defined?(SpreeGlobalize)
|
38
|
+
Spree::Store.joins(:translations).where("LOWER(#{Store::Translation.table_name}.name) LIKE LOWER(:query)",
|
39
|
+
query: "%#{params[:q]}%")
|
40
|
+
else
|
41
|
+
Spree::Store.where('LOWER(name) LIKE LOWER(:query)', query: "%#{params[:q]}%")
|
42
|
+
end
|
9
43
|
end
|
10
44
|
|
11
45
|
def create
|
@@ -76,9 +110,35 @@ module Spree
|
|
76
110
|
@store = Spree::Store.find_by(id: params[:id]) || Spree::Store.new
|
77
111
|
end
|
78
112
|
|
113
|
+
def load_all_countries
|
114
|
+
@countries = Spree::Country.all
|
115
|
+
end
|
116
|
+
|
79
117
|
def set_default_currency
|
80
118
|
@store.default_currency = Spree::Config[:currency]
|
81
119
|
end
|
120
|
+
|
121
|
+
def set_default_locale
|
122
|
+
@store.default_locale = I18n.locale
|
123
|
+
end
|
124
|
+
|
125
|
+
def normalize_supported_currencies
|
126
|
+
if params[:store][:supported_currencies]&.is_a?(Array)
|
127
|
+
params[:store][:supported_currencies] = params[:store][:supported_currencies].compact.uniq.reject(&:blank?).join(',')
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def set_default_country_id
|
132
|
+
@store.default_country_id = Spree::Config[:default_country_id]
|
133
|
+
end
|
134
|
+
|
135
|
+
# this method is overriten by spree_i18n to add support for more locales
|
136
|
+
# in https://github.com/spree-contrib/spree_i18n/blob/master/app/helpers/spree_i18n/locale_helper.rb#L17
|
137
|
+
unless defined?(SpreeI18n)
|
138
|
+
def all_locales_options
|
139
|
+
[['English (EN)', :en]]
|
140
|
+
end
|
141
|
+
end
|
82
142
|
end
|
83
143
|
end
|
84
144
|
end
|
@@ -77,7 +77,11 @@ module Spree
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def load_taxonomy
|
80
|
-
@taxonomy =
|
80
|
+
@taxonomy = if defined?(SpreeGlobalize)
|
81
|
+
Taxonomy.includes(:translations, taxons: [:translations]).find(params[:taxonomy_id])
|
82
|
+
else
|
83
|
+
Taxonomy.find(params[:taxonomy_id])
|
84
|
+
end
|
81
85
|
end
|
82
86
|
|
83
87
|
def set_position
|
@@ -3,15 +3,13 @@ module Spree
|
|
3
3
|
module BaseHelper
|
4
4
|
def flash_alert(flash)
|
5
5
|
if flash.present?
|
6
|
-
close_button = button_tag(class: 'close', 'data-dismiss' => 'alert', 'aria-label' => Spree.t(:close)) do
|
7
|
-
content_tag('span', '×'.html_safe, 'aria-hidden' => true)
|
8
|
-
end
|
9
6
|
message = flash[:error] || flash[:notice] || flash[:success]
|
10
7
|
flash_class = 'danger' if flash[:error]
|
11
8
|
flash_class = 'info' if flash[:notice]
|
12
9
|
flash_class = 'success' if flash[:success]
|
13
|
-
flash_div = content_tag(:div,
|
14
|
-
content_tag(:div, flash_div,
|
10
|
+
flash_div = content_tag(:div, message, class: "alert alert-#{flash_class} mx-2")
|
11
|
+
content_tag(:div, flash_div,
|
12
|
+
class: 'd-flex justify-content-center position-fixed flash-alert ')
|
15
13
|
end
|
16
14
|
end
|
17
15
|
|
@@ -37,6 +35,15 @@ module Spree
|
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
38
|
+
def svg_icon(name:, classes: '', width:, height:)
|
39
|
+
if name.ends_with?('.svg')
|
40
|
+
icon_name = File.basename(name, File.extname(name))
|
41
|
+
inline_svg_tag "backend-#{icon_name}.svg", class: "icon-#{icon_name} #{classes}", size: "#{width}px*#{height}px"
|
42
|
+
else
|
43
|
+
inline_svg_tag "backend-#{name}.svg", class: "icon-#{name} #{classes}", size: "#{width}px*#{height}px"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
40
47
|
def datepicker_field_value(date)
|
41
48
|
unless date.blank?
|
42
49
|
l(date, format: Spree.t('date_picker.format', default: '%Y/%m/%d'))
|
@@ -130,7 +137,7 @@ module Spree
|
|
130
137
|
# renders hidden field and link to remove record using nested_attributes
|
131
138
|
def link_to_icon_remove_fields(form)
|
132
139
|
url = form.object.persisted? ? [:admin, form.object] : '#'
|
133
|
-
link_to_with_icon('delete', '', url,
|
140
|
+
link_to_with_icon('delete.svg', '', url,
|
134
141
|
class: 'spree_remove_fields btn btn-sm btn-danger',
|
135
142
|
data: {
|
136
143
|
action: 'remove'
|
@@ -152,7 +159,7 @@ module Spree
|
|
152
159
|
def order_time(time)
|
153
160
|
return '' if time.blank?
|
154
161
|
|
155
|
-
[I18n.l(time.to_date), time.strftime('%l:%M %p').strip].join(' ')
|
162
|
+
[I18n.l(time.to_date), time.strftime('%l:%M %p %Z').strip].join(' ')
|
156
163
|
end
|
157
164
|
|
158
165
|
def required_span_tag
|
@@ -165,7 +172,17 @@ module Spree
|
|
165
172
|
button_link_to(
|
166
173
|
Spree.t(:preview_product),
|
167
174
|
spree.product_url(product),
|
168
|
-
class: 'btn-outline-secondary', icon: '
|
175
|
+
class: 'btn-outline-secondary', icon: 'view.svg', id: 'admin_preview_product', target: :blank
|
176
|
+
)
|
177
|
+
end
|
178
|
+
|
179
|
+
def taxon_preview_link(taxon)
|
180
|
+
return unless frontend_available?
|
181
|
+
|
182
|
+
button_link_to(
|
183
|
+
Spree.t(:preview_taxon),
|
184
|
+
seo_url(taxon),
|
185
|
+
class: 'btn-outline-secondary', icon: 'view.svg', id: 'admin_preview_taxon', target: :blank
|
169
186
|
)
|
170
187
|
end
|
171
188
|
end
|
@@ -15,6 +15,9 @@ module Spree
|
|
15
15
|
# Example:
|
16
16
|
# # Link to /admin/orders, also highlight tab for ProductsController and ShipmentsController
|
17
17
|
# tab :orders, :products, :shipments
|
18
|
+
|
19
|
+
ICON_SIZE = 16
|
20
|
+
|
18
21
|
def tab(*args)
|
19
22
|
options = { label: args.first.to_s }
|
20
23
|
|
@@ -48,7 +51,7 @@ module Spree
|
|
48
51
|
link_to(
|
49
52
|
titleized_label,
|
50
53
|
destination_url,
|
51
|
-
class: "sidebar-submenu-item w-100 py-1
|
54
|
+
class: "sidebar-submenu-item w-100 py-2 py-md-1 pl-3 d-block #{'text-success' if selected}"
|
52
55
|
)
|
53
56
|
end
|
54
57
|
|
@@ -61,9 +64,15 @@ module Spree
|
|
61
64
|
# Single main menu item
|
62
65
|
def main_menu_item(text, url: nil, icon: nil)
|
63
66
|
link_to url, 'data-toggle': 'collapse', class: 'd-flex w-100 p-3 position-relative align-items-center' do
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
+
if icon.ends_with?('.svg')
|
68
|
+
svg_icon(name: icon, classes: 'mr-2', width: ICON_SIZE, height: ICON_SIZE) +
|
69
|
+
content_tag(:span, " #{text}", class: 'text') +
|
70
|
+
svg_icon(name: 'chevron-left.svg', classes: 'drop-menu-indicator position-absolute', width: (ICON_SIZE - 4), height: (ICON_SIZE - 4))
|
71
|
+
else
|
72
|
+
content_tag(:span, nil, class: "icon icon-#{icon} mr-2") +
|
73
|
+
content_tag(:span, " #{text}", class: 'text') +
|
74
|
+
svg_icon(name: 'chevron-left.svg', classes: 'drop-menu-indicator position-absolute', width: (ICON_SIZE - 4), height: (ICON_SIZE - 4))
|
75
|
+
end
|
67
76
|
end
|
68
77
|
end
|
69
78
|
|
@@ -86,17 +95,17 @@ module Spree
|
|
86
95
|
end
|
87
96
|
else
|
88
97
|
per_page_default = Spree::Config.admin_orders_per_page
|
89
|
-
per_page_options = %w{
|
98
|
+
per_page_options = %w{25 50 75}
|
90
99
|
end
|
91
100
|
|
92
101
|
selected_option = params[:per_page].try(:to_i) || per_page_default
|
93
102
|
|
94
103
|
select_tag(:per_page,
|
95
104
|
options_for_select(per_page_options, selected_option),
|
96
|
-
class: "form-control
|
105
|
+
class: "w-auto form-control js-per-page-select per-page-selected-#{selected_option} custom-select")
|
97
106
|
end
|
98
107
|
|
99
|
-
# helper method to create proper url to apply per page
|
108
|
+
# helper method to create proper url to apply per page ing
|
100
109
|
# fixes https://github.com/spree/spree/issues/6888
|
101
110
|
def per_page_dropdown_params(args = nil)
|
102
111
|
args = params.permit!.to_h.clone
|
@@ -123,7 +132,7 @@ module Spree
|
|
123
132
|
options[:data] = { action: 'clone', 'original-title': Spree.t(:clone) }
|
124
133
|
options[:class] = 'btn btn-primary btn-sm with-tip'
|
125
134
|
options[:method] = :post
|
126
|
-
options[:icon] =
|
135
|
+
options[:icon] = 'clone.svg'
|
127
136
|
button_link_to '', clone_object_url(resource), options
|
128
137
|
end
|
129
138
|
|
@@ -131,7 +140,7 @@ module Spree
|
|
131
140
|
options[:data] = { action: 'clone', 'original-title': Spree.t(:clone) }
|
132
141
|
options[:class] = 'btn btn-warning btn-sm with-tip'
|
133
142
|
options[:method] = :post
|
134
|
-
options[:icon] =
|
143
|
+
options[:icon] = 'clone.svg'
|
135
144
|
button_link_to '', clone_admin_promotion_path(promotion), options
|
136
145
|
end
|
137
146
|
|
@@ -139,13 +148,13 @@ module Spree
|
|
139
148
|
url = options[:url] || edit_object_url(resource)
|
140
149
|
options[:data] = { action: 'edit' }
|
141
150
|
options[:class] = 'btn btn-primary btn-sm'
|
142
|
-
link_to_with_icon('edit', Spree.t(:edit), url, options)
|
151
|
+
link_to_with_icon('edit.svg', Spree.t(:edit), url, options)
|
143
152
|
end
|
144
153
|
|
145
154
|
def link_to_edit_url(url, options = {})
|
146
155
|
options[:data] = { action: 'edit' }
|
147
156
|
options[:class] = 'btn btn-primary btn-sm'
|
148
|
-
link_to_with_icon('edit', Spree.t(:edit), url, options)
|
157
|
+
link_to_with_icon('edit.svg', Spree.t(:edit), url, options)
|
149
158
|
end
|
150
159
|
|
151
160
|
def link_to_delete(resource, options = {})
|
@@ -153,7 +162,7 @@ module Spree
|
|
153
162
|
name = options[:name] || Spree.t(:delete)
|
154
163
|
options[:class] = 'btn btn-danger btn-sm delete-resource'
|
155
164
|
options[:data] = { confirm: Spree.t(:are_you_sure), action: 'remove' }
|
156
|
-
link_to_with_icon 'delete', name, url, options
|
165
|
+
link_to_with_icon 'delete.svg', name, url, options
|
157
166
|
end
|
158
167
|
|
159
168
|
def link_to_with_icon(icon_name, text, url, options = {})
|
@@ -162,20 +171,32 @@ module Spree
|
|
162
171
|
text = options[:no_text] ? '' : content_tag(:span, text, class: 'text')
|
163
172
|
options.delete(:no_text)
|
164
173
|
if icon_name
|
165
|
-
icon =
|
174
|
+
icon = if icon_name.ends_with?('.svg')
|
175
|
+
svg_icon(name: icon_name, classes: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}", width: ICON_SIZE, height: ICON_SIZE)
|
176
|
+
else
|
177
|
+
content_tag(:span, '', class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
|
178
|
+
end
|
166
179
|
text = "#{icon} #{text}"
|
167
180
|
end
|
168
181
|
link_to(text.html_safe, url, options)
|
169
182
|
end
|
170
183
|
|
171
184
|
def spree_icon(icon_name)
|
172
|
-
icon_name
|
185
|
+
if icon_name.ends_with?('.svg')
|
186
|
+
icon_name ? svg_icon(name: icon_name, classes: icon_name, width: ICON_SIZE, height: ICON_SIZE) : ''
|
187
|
+
else
|
188
|
+
icon_name ? content_tag(:span, '', class: icon_name) : ''
|
189
|
+
end
|
173
190
|
end
|
174
191
|
|
175
192
|
# Override: Add disable_with option to prevent multiple request on consecutive clicks
|
176
193
|
def button(text, icon_name = nil, button_type = 'submit', options = {})
|
177
194
|
if icon_name
|
178
|
-
icon =
|
195
|
+
icon = if icon_name.ends_with?('.svg')
|
196
|
+
svg_icon(name: icon_name, classes: "icon icon-#{icon_name}", width: ICON_SIZE, height: ICON_SIZE)
|
197
|
+
else
|
198
|
+
content_tag(:span, '', class: "icon icon-#{icon_name}")
|
199
|
+
end
|
179
200
|
text = "#{icon} #{text}"
|
180
201
|
end
|
181
202
|
button_tag(
|
@@ -192,7 +213,7 @@ module Spree
|
|
192
213
|
if html_options[:method] &&
|
193
214
|
!html_options[:method].to_s.casecmp('get').zero? &&
|
194
215
|
!html_options[:remote]
|
195
|
-
form_tag(url, method: html_options.delete(:method)
|
216
|
+
form_tag(url, method: html_options.delete(:method)) do
|
196
217
|
button(text, html_options.delete(:icon), nil, html_options)
|
197
218
|
end
|
198
219
|
else
|
@@ -206,11 +227,15 @@ module Spree
|
|
206
227
|
html_options[:class] = html_options[:class] ? "btn #{html_options[:class]}" : 'btn btn-outline-secondary'
|
207
228
|
|
208
229
|
if html_options[:icon]
|
209
|
-
icon =
|
230
|
+
icon = if html_options[:icon].ends_with?('.svg')
|
231
|
+
svg_icon(name: html_options[:icon], classes: "icon icon-#{html_options[:icon]}", width: ICON_SIZE, height: ICON_SIZE)
|
232
|
+
else
|
233
|
+
content_tag(:span, '', class: "icon icon-#{html_options[:icon]}")
|
234
|
+
end
|
210
235
|
text = "#{icon} #{text}"
|
211
236
|
end
|
212
237
|
|
213
|
-
link_to(text.html_safe, url, html_options)
|
238
|
+
link_to(text.html_safe, url, html_options.except(:icon))
|
214
239
|
end
|
215
240
|
end
|
216
241
|
|
@@ -222,7 +247,7 @@ module Spree
|
|
222
247
|
options[:class] = 'sidebar-menu-item d-block w-100'
|
223
248
|
options[:class] << ' selected' if is_selected
|
224
249
|
content_tag(:li, options) do
|
225
|
-
link_to(link_text, url, class: "#{'text-success' if is_selected} py-1
|
250
|
+
link_to(link_text, url, class: "#{'text-success' if is_selected} sidebar-submenu-item w-100 py-2 py-md-1 pl-3 d-block")
|
226
251
|
end
|
227
252
|
end
|
228
253
|
|
@@ -235,6 +260,9 @@ module Spree
|
|
235
260
|
end
|
236
261
|
|
237
262
|
def main_sidebar_classes
|
263
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
264
|
+
Admin::NavigationsHelper#main_sidebar_classes is deprecated and will be removed in Spree 5.0.
|
265
|
+
DEPRECATION
|
238
266
|
if cookies['sidebar-minimized'] == 'true'
|
239
267
|
'col-3 col-md-2 sidebar'
|
240
268
|
else
|
@@ -243,6 +271,9 @@ module Spree
|
|
243
271
|
end
|
244
272
|
|
245
273
|
def wrapper_classes
|
274
|
+
ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
|
275
|
+
Admin::NavigationsHelper#wrapper_classes is deprecated and will be removed in Spree 5.0.
|
276
|
+
DEPRECATION
|
246
277
|
'sidebar-minimized' if cookies['sidebar-minimized'] == 'true'
|
247
278
|
end
|
248
279
|
end
|