spree_backend 4.2.0.rc3 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +1 -1
- data/app/assets/javascripts/spree/backend/admin.js +9 -15
- data/app/assets/stylesheets/spree/backend/global/_mixins.scss +19 -0
- data/app/assets/stylesheets/spree/backend/plugins/_flatpickr.scss +94 -76
- data/app/assets/stylesheets/spree/backend/shared/_base.scss +4 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +1 -0
- data/app/controllers/spree/admin/base_controller.rb +2 -0
- data/app/controllers/spree/admin/general_settings_controller.rb +1 -1
- data/app/controllers/spree/admin/images_controller.rb +3 -3
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/prices_controller.rb +0 -13
- data/app/controllers/spree/admin/stores_controller.rb +7 -14
- data/app/helpers/spree/admin/base_helper.rb +47 -1
- data/app/views/kaminari/admin-twitter-bootstrap-4/_first_page.html.erb +2 -2
- data/app/views/kaminari/admin-twitter-bootstrap-4/_gap.html.erb +2 -2
- data/app/views/kaminari/admin-twitter-bootstrap-4/_last_page.html.erb +2 -2
- data/app/views/kaminari/admin-twitter-bootstrap-4/_next_page.html.erb +2 -2
- data/app/views/kaminari/admin-twitter-bootstrap-4/_page.html.erb +2 -2
- data/app/views/kaminari/admin-twitter-bootstrap-4/_paginator.html.erb +2 -2
- data/app/views/kaminari/admin-twitter-bootstrap-4/_prev_page.html.erb +2 -2
- data/app/views/spree/admin/adjustments/index.html.erb +2 -2
- data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +48 -48
- data/app/views/spree/admin/customer_returns/edit.html.erb +1 -1
- data/app/views/spree/admin/general_settings/edit.html.erb +6 -6
- data/app/views/spree/admin/images/edit.html.erb +1 -1
- data/app/views/spree/admin/log_entries/index.html.erb +1 -1
- data/app/views/spree/admin/option_types/index.html.erb +1 -1
- data/app/views/spree/admin/orders/_adjustments.html.erb +2 -2
- data/app/views/spree/admin/orders/_form.html.erb +6 -10
- data/app/views/spree/admin/orders/_line_items.html.erb +1 -1
- data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +5 -8
- data/app/views/spree/admin/orders/_order_actions.html.erb +1 -2
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +3 -3
- data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
- data/app/views/spree/admin/orders/cart.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +2 -0
- data/app/views/spree/admin/payment_methods/index.html.erb +1 -1
- data/app/views/spree/admin/payments/_form.html.erb +2 -3
- data/app/views/spree/admin/payments/show.html.erb +1 -2
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +3 -4
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +1 -1
- data/app/views/spree/admin/prices/_variant_prices.html.erb +5 -5
- data/app/views/spree/admin/prices/index.html.erb +2 -2
- data/app/views/spree/admin/product_properties/index.html.erb +3 -4
- data/app/views/spree/admin/products/_form.html.erb +5 -6
- data/app/views/spree/admin/products/new.html.erb +3 -1
- data/app/views/spree/admin/products/stock.html.erb +2 -2
- data/app/views/spree/admin/promotions/_actions.html.erb +2 -3
- data/app/views/spree/admin/promotions/_form.html.erb +9 -10
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +1 -1
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +1 -1
- data/app/views/spree/admin/promotions/index.html.erb +7 -5
- data/app/views/spree/admin/promotions/rules/_taxon.html.erb +2 -2
- data/app/views/spree/admin/prototypes/_form.html.erb +1 -1
- data/app/views/spree/admin/prototypes/show.html.erb +1 -1
- 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/reimbursements/edit.html.erb +1 -2
- data/app/views/spree/admin/roles/index.html.erb +1 -1
- data/app/views/spree/admin/shared/_account_nav.html.erb +2 -2
- data/app/views/spree/admin/shared/_address_form.html.erb +2 -2
- data/app/views/spree/admin/shared/_error_messages.html.erb +1 -1
- data/app/views/spree/admin/shared/_head.html.erb +2 -2
- data/app/views/spree/admin/shared/_header.html.erb +0 -2
- data/app/views/spree/admin/shared/_main_menu.html.erb +1 -1
- data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +4 -2
- data/app/views/spree/admin/shared/_translations.html.erb +8 -38
- data/app/views/spree/admin/shipping_categories/index.html.erb +2 -2
- data/app/views/spree/admin/shipping_methods/index.html.erb +2 -2
- data/app/views/spree/admin/states/index.html.erb +2 -2
- data/app/views/spree/admin/stock_locations/_form.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/index.html.erb +4 -4
- data/app/views/spree/admin/stock_movements/_form.html.erb +1 -1
- data/app/views/spree/admin/stock_movements/index.html.erb +2 -2
- data/app/views/spree/admin/stock_transfers/new.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/show.html.erb +0 -1
- data/app/views/spree/admin/stores/_form.html.erb +20 -15
- data/app/views/spree/admin/stores/index.html.erb +4 -2
- data/app/views/spree/admin/tax_categories/index.html.erb +2 -2
- data/app/views/spree/admin/tax_rates/index.html.erb +6 -6
- data/app/views/spree/admin/taxonomies/_js_head.html.erb +1 -2
- data/app/views/spree/admin/taxonomies/_list.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +1 -2
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +2 -2
- data/app/views/spree/admin/users/_form.html.erb +0 -1
- data/app/views/spree/admin/users/edit.html.erb +1 -1
- data/app/views/spree/admin/users/index.html.erb +2 -2
- data/app/views/spree/admin/users/items.html.erb +1 -1
- data/app/views/spree/admin/variants/_form.html.erb +3 -1
- data/app/views/spree/admin/zones/_country_members.html.erb +1 -1
- data/app/views/spree/admin/zones/_form.html.erb +2 -2
- data/app/views/spree/admin/zones/new.html.erb +1 -1
- data/app/views/spree/layouts/admin.html.erb +2 -3
- data/config/initializers/assets.rb +1 -1
- data/spree_backend.gemspec +1 -1
- metadata +13 -14
- data/app/assets/javascripts/spree/backend/flatpickr_locals.js +0 -37
- data/app/helpers/spree/admin/currency_helper.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b96b6d42312d901f1a3734a506999626014d58aa98cbdc6d074ac636334723df
|
4
|
+
data.tar.gz: ddad68dda773f98cf0bc63ba83abe35b4d0802b109b7f86aa9b92399062e5efd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2338cceeaf2eb8f12d2429be3ea4cb746d6ebe8e4fe7593063b17aa25d0fad0fcc014a4a595cdc8564e35b6533319e12eac8cc15f7f77442f819d95c5c53b6ea
|
7
|
+
data.tar.gz: '06782c7f960fd53e784e1d4249166328db1002b1250e0426a0f1de18b2fad75dcce0d291c84a8cf3d31cc948a4ef54157bae29fd342eb908df0ada0bb22acc29'
|
@@ -5,9 +5,6 @@ Hopefully, this will evolve into a propper class.
|
|
5
5
|
**/
|
6
6
|
|
7
7
|
/* global AUTH_TOKEN, order_number, Sortable, flatpickr, DOMPurify */
|
8
|
-
|
9
|
-
//= require spree/backend/flatpickr_locals
|
10
|
-
|
11
8
|
jQuery(function ($) {
|
12
9
|
// Add some tips
|
13
10
|
$('.with-tip').each(function() {
|
@@ -123,7 +120,7 @@ jQuery(function ($) {
|
|
123
120
|
$('.js-filterable').each(function () {
|
124
121
|
var $this = $(this)
|
125
122
|
|
126
|
-
if ($this.val() !== null && $this.val() !== '' && $this.val().length !== 0) {
|
123
|
+
if ($this.val() !== null && $this.val() !== '' && $this.val().length !== 0 && !$this.hasClass('flatpickr-alt-input')) {
|
127
124
|
var ransackValue, filter
|
128
125
|
var ransackFieldId = $this.attr('id')
|
129
126
|
var label = $('label[for="' + ransackFieldId + '"]')
|
@@ -226,29 +223,26 @@ $.fn.radioControlsVisibilityOfElement = function (dependentElementSelector) {
|
|
226
223
|
}
|
227
224
|
|
228
225
|
document.addEventListener('DOMContentLoaded', function() {
|
229
|
-
|
226
|
+
flatpickr.setDefaults({
|
227
|
+
altInput: true,
|
230
228
|
time_24hr: true,
|
231
|
-
|
232
|
-
|
229
|
+
altInputClass: 'flatpickr-alt-input',
|
230
|
+
locale: Spree.translations.flatpickr_locale
|
231
|
+
})
|
232
|
+
|
233
|
+
var dateFrom = flatpickr('.datePickerFrom', {
|
233
234
|
onChange: function(selectedDates) {
|
234
235
|
dateTo.set('minDate', selectedDates[0])
|
235
236
|
}
|
236
237
|
})
|
237
238
|
|
238
239
|
var dateTo = flatpickr('.datePickerTo', {
|
239
|
-
monthSelectorType: 'static',
|
240
|
-
time_24hr: true,
|
241
|
-
dateFormat: Spree.translations.date_picker,
|
242
240
|
onChange: function(selectedDates) {
|
243
241
|
dateFrom.set('maxDate', selectedDates[0])
|
244
242
|
}
|
245
243
|
})
|
246
244
|
|
247
|
-
flatpickr('.datepicker', {
|
248
|
-
monthSelectorType: 'static',
|
249
|
-
time_24hr: true,
|
250
|
-
dateFormat: Spree.translations.date_picker
|
251
|
-
})
|
245
|
+
flatpickr('.datepicker', { })
|
252
246
|
})
|
253
247
|
|
254
248
|
$(document).ready(function() {
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Mixin to prefix several properties at once
|
2
|
+
|
3
|
+
// EXAMPLE
|
4
|
+
// @include prefix((
|
5
|
+
// appearance: none,
|
6
|
+
// touch-callout: none,
|
7
|
+
// user-select: none
|
8
|
+
// ), webkit moz ms khtml);
|
9
|
+
|
10
|
+
@mixin prefix($declarations, $prefixes: ()) {
|
11
|
+
@each $property, $value in $declarations {
|
12
|
+
@each $prefix in $prefixes {
|
13
|
+
#{'-' + $prefix + '-' + $property}: $value;
|
14
|
+
}
|
15
|
+
|
16
|
+
// Output standard non-prefixed declaration
|
17
|
+
#{$property}: $value;
|
18
|
+
}
|
19
|
+
}
|
@@ -1,95 +1,113 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
.flatpickr-calendar {
|
2
|
+
// Custom Flatpickr styling for Spree + BS4.
|
3
|
+
.flatpickr-current-month {
|
4
|
+
span.cur-month:hover {
|
5
|
+
background: transparent;
|
6
|
+
}
|
7
|
+
.numInputWrapper {
|
8
|
+
margin-left: 3px;
|
9
|
+
border-radius: $border-radius;
|
10
|
+
overflow: hidden;
|
11
|
+
}
|
12
|
+
|
13
|
+
.flatpickr-monthDropdown-months {
|
14
|
+
@include prefix((
|
15
|
+
appearance: none
|
16
|
+
), webkit moz ms khtml);
|
17
|
+
|
18
|
+
padding: 0.2em;
|
19
|
+
border-radius: $border-radius;
|
20
|
+
}
|
5
21
|
}
|
6
|
-
}
|
7
22
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
background-color: white !important;
|
13
|
-
}
|
23
|
+
.numInputWrapper span.arrowUp {
|
24
|
+
border-color: transparent;
|
25
|
+
border-radius: 0;
|
26
|
+
}
|
14
27
|
|
15
|
-
.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
20
|
-
.flatpickr-current-month span.cur-month:hover {
|
21
|
-
background: transparent;
|
22
|
-
}
|
23
|
-
.numInputWrapper span.arrowUp {
|
24
|
-
border-color: transparent;
|
25
|
-
border-radius: 0;
|
26
|
-
}
|
27
|
-
.numInputWrapper span.arrowDown {
|
28
|
-
border-color: transparent;
|
29
|
-
border-radius: 0;
|
30
|
-
}
|
28
|
+
.numInputWrapper span.arrowDown {
|
29
|
+
border-color: transparent;
|
30
|
+
border-radius: 0;
|
31
|
+
}
|
31
32
|
|
32
|
-
.
|
33
|
-
|
34
|
-
|
35
|
-
opacity: 0;
|
36
|
-
}
|
33
|
+
.flatpickr-day {
|
34
|
+
margin: 2px 0;
|
35
|
+
border-radius: $border-radius ;
|
37
36
|
}
|
38
|
-
}
|
39
37
|
|
40
|
-
.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
z-index: 0;
|
45
|
-
height: 100%;
|
46
|
-
}
|
38
|
+
.flatpickr-months .flatpickr-prev-month:hover svg,
|
39
|
+
.flatpickr-months .flatpickr-next-month:hover svg {
|
40
|
+
fill: $primary;
|
41
|
+
}
|
47
42
|
|
48
|
-
.flatpickr-
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
.flatpickr-time {
|
44
|
+
border-radius: 0 0 5px 5px;
|
45
|
+
&:after {
|
46
|
+
display: none;
|
47
|
+
}
|
48
|
+
.numInputWrapper {
|
49
|
+
span {
|
50
|
+
border-color: transparent;
|
51
|
+
border-radius: 0;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
52
55
|
|
53
|
-
//
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
-khtml-user-select: none; /* Konqueror HTML */
|
58
|
-
-moz-user-select: none; /* Old versions of Firefox */
|
59
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
60
|
-
user-select: none; /* Non-prefixed version, currently
|
61
|
-
supported by Chrome, Edge, Opera and Firefox */
|
56
|
+
// Required to stop an opened cal showing above the nav bar.
|
57
|
+
&.open {
|
58
|
+
z-index: $zindex-dropdown;
|
59
|
+
}
|
62
60
|
}
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
// Mixin for calendar toggle icon show/hide.
|
63
|
+
@mixin swith-appended-icon {
|
64
|
+
&:placeholder-shown:not(:focus) + * {
|
65
|
+
@content;
|
66
|
+
}
|
67
67
|
}
|
68
68
|
|
69
|
-
|
70
|
-
.input-group
|
71
|
-
.input-group
|
72
|
-
.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
}
|
69
|
+
.input-group.datePickerFrom,
|
70
|
+
.input-group.datePickerTo,
|
71
|
+
.input-group.datepicker {
|
72
|
+
input.flatpickr-alt-input[readonly] {
|
73
|
+
// Flatpickr alternate input is read-only,
|
74
|
+
// style it as an active input field.
|
75
|
+
background-color: white !important;
|
77
76
|
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
// Fix a bug where occasionally the whole screen will highlight
|
78
|
+
// if you clicked the Flatpcikr input box while moving the cursor.
|
79
|
+
@include prefix((
|
80
|
+
appearance: none,
|
81
|
+
touch-callout: none,
|
82
|
+
user-select: none
|
83
|
+
), webkit moz ms khtml);
|
81
84
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
display: none;
|
85
|
+
@include swith-appended-icon {
|
86
|
+
opacity: 0;
|
87
|
+
}
|
86
88
|
}
|
87
|
-
.numInputWrapper {
|
88
|
-
span {
|
89
|
-
border-color: transparent;
|
90
|
-
border-radius: 0;
|
91
89
|
|
92
|
-
|
90
|
+
// Required for calendar toggle icon show/hide.
|
91
|
+
.append_under {
|
92
|
+
position: absolute;
|
93
|
+
right: 0;
|
94
|
+
top: 0;
|
95
|
+
z-index: 0;
|
96
|
+
height: 100%;
|
97
|
+
}
|
98
|
+
|
99
|
+
// Styling for calendar toggle icon toggle
|
100
|
+
.input-group-append:not(:last-child) >
|
101
|
+
.force-round {
|
102
|
+
z-index: 5;
|
103
|
+
border-top-right-radius: $border-radius !important;
|
104
|
+
border-bottom-right-radius: $border-radius !important;
|
105
|
+
}
|
93
106
|
|
107
|
+
// Styling for calendar toggle icon toggle
|
108
|
+
.form-control:not(:first-child),
|
109
|
+
.input-group >.flatpickr-alt-input:not(:first-child) {
|
110
|
+
border-top-left-radius: $border-radius !important;
|
111
|
+
border-bottom-left-radius: $border-radius !important;
|
94
112
|
}
|
95
113
|
}
|
@@ -18,15 +18,15 @@ module Spree
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def load_index_data
|
21
|
-
@product = Product.friendly.
|
21
|
+
@product = Product.friendly.preload(*variant_index_includes).find(params[:product_id])
|
22
22
|
end
|
23
23
|
|
24
24
|
def load_edit_data
|
25
|
-
@product = Product.friendly.
|
25
|
+
@product = Product.friendly.preload(*variant_edit_includes).find(params[:product_id])
|
26
26
|
@variants = @product.variants.map do |variant|
|
27
27
|
[variant.sku_and_options_text, variant.id]
|
28
28
|
end
|
29
|
-
@variants.insert(0, [Spree.t(:all), @product.
|
29
|
+
@variants.insert(0, [Spree.t(:all), @product.master_id])
|
30
30
|
end
|
31
31
|
|
32
32
|
def set_viewable
|
@@ -11,7 +11,7 @@ module Spree
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def edit
|
14
|
-
country_id = Address.default.
|
14
|
+
country_id = Address.default.country_id
|
15
15
|
@order.build_bill_address(country_id: country_id) if @order.bill_address.nil?
|
16
16
|
@order.build_ship_address(country_id: country_id) if @order.ship_address.nil?
|
17
17
|
|
@@ -3,8 +3,6 @@ module Spree
|
|
3
3
|
class PricesController < ResourceController
|
4
4
|
belongs_to 'spree/product', find_by: :slug
|
5
5
|
|
6
|
-
helper_method :supported_currencies_for_all_stores
|
7
|
-
|
8
6
|
def create
|
9
7
|
params.require(:vp).permit!
|
10
8
|
params[:vp].each do |variant_id, prices|
|
@@ -23,17 +21,6 @@ module Spree
|
|
23
21
|
flash[:success] = Spree.t('notice_messages.prices_saved')
|
24
22
|
redirect_to admin_product_path(parent)
|
25
23
|
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
24
|
end
|
38
25
|
end
|
39
26
|
end
|
@@ -5,16 +5,11 @@ module Spree
|
|
5
5
|
before_action :set_default_currency, only: :new
|
6
6
|
before_action :set_default_locale, only: :new
|
7
7
|
before_action :normalize_supported_currencies, only: [:create, :update]
|
8
|
+
before_action :normalize_supported_locales, only: [:create, :update]
|
8
9
|
before_action :set_default_country_id, only: :new
|
9
10
|
before_action :load_all_countries, only: [:new, :edit, :update, :create]
|
10
11
|
before_action :load_all_zones, only: %i[new edit]
|
11
12
|
|
12
|
-
if defined?(SpreeI18n)
|
13
|
-
include SpreeI18n::LocaleHelper
|
14
|
-
end
|
15
|
-
|
16
|
-
helper_method :all_locales_options
|
17
|
-
|
18
13
|
def index
|
19
14
|
if params[:ids]
|
20
15
|
load_stores_by_ids
|
@@ -133,16 +128,14 @@ module Spree
|
|
133
128
|
end
|
134
129
|
end
|
135
130
|
|
136
|
-
def
|
137
|
-
|
131
|
+
def normalize_supported_locales
|
132
|
+
if params[:store][:supported_locales]&.is_a?(Array)
|
133
|
+
params[:store][:supported_locales] = params[:store][:supported_locales].compact.uniq.reject(&:blank?).join(',')
|
134
|
+
end
|
138
135
|
end
|
139
136
|
|
140
|
-
|
141
|
-
|
142
|
-
unless defined?(SpreeI18n)
|
143
|
-
def all_locales_options
|
144
|
-
[['English (EN)', :en]]
|
145
|
-
end
|
137
|
+
def set_default_country_id
|
138
|
+
@store.default_country_id = Spree::Config[:default_country_id]
|
146
139
|
end
|
147
140
|
end
|
148
141
|
end
|
@@ -1,6 +1,18 @@
|
|
1
1
|
module Spree
|
2
2
|
module Admin
|
3
3
|
module BaseHelper
|
4
|
+
SELECT2_SUPPORTED_LOCALES = %w[
|
5
|
+
af ar az bg bn bs ca cs da de dsb el en eo es et eu fa fi fr gl he
|
6
|
+
hi hr hsb hu hy id is it ja ka km ko lt lv mk ms nb ne nl pa pl ps
|
7
|
+
pt pt-BR ro ru sk sl sq sr sr-Cyrl sv th tk tr uk vi zh-CN zh-TW
|
8
|
+
].freeze
|
9
|
+
|
10
|
+
FLATPICKR_SUPPORTED_LOCALES = %w[
|
11
|
+
ar at az be bg bn bs cs cy da de eo es et fa fi fo fr ga gr he
|
12
|
+
hi hr hu id is it ja ka km ko kz lv mk mn ms my nl no pa pl pt ro ru
|
13
|
+
si sk sl sq sr sv th tr uk uz vn zh
|
14
|
+
].freeze
|
15
|
+
|
4
16
|
def flash_alert(flash)
|
5
17
|
if flash.present?
|
6
18
|
message = flash[:error] || flash[:notice] || flash[:success]
|
@@ -46,7 +58,7 @@ module Spree
|
|
46
58
|
|
47
59
|
def datepicker_field_value(date)
|
48
60
|
unless date.blank?
|
49
|
-
l(date, format:
|
61
|
+
l(date, format: '%Y/%m/%d')
|
50
62
|
end
|
51
63
|
end
|
52
64
|
|
@@ -201,6 +213,40 @@ module Spree
|
|
201
213
|
class: 'btn-outline-secondary', icon: 'view.svg', id: 'admin_preview_taxon', target: :blank
|
202
214
|
)
|
203
215
|
end
|
216
|
+
|
217
|
+
def admin_logout_link
|
218
|
+
if defined?(admin_logout_path)
|
219
|
+
admin_logout_path
|
220
|
+
elsif defined?(spree_logout_path)
|
221
|
+
spree_logout_path
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def select2_local_fallback
|
226
|
+
stripped_locale = I18n.locale.to_s.split('-').first
|
227
|
+
|
228
|
+
if ['zh-CN', 'zh-TW', 'sr-Cyrl', 'pt-BR'].include?(I18n.locale.to_s)
|
229
|
+
I18n.locale
|
230
|
+
elsif SELECT2_SUPPORTED_LOCALES.include? stripped_locale
|
231
|
+
stripped_locale
|
232
|
+
else
|
233
|
+
'en'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def flatpickr_local_fallback
|
238
|
+
stripped_locale = I18n.locale.to_s.split('-').first
|
239
|
+
|
240
|
+
if I18n.locale.to_s == 'zh-TW'
|
241
|
+
# Taiwanese is a popular language in Spree,
|
242
|
+
# it has been well translated.
|
243
|
+
'zh-tw'
|
244
|
+
elsif FLATPICKR_SUPPORTED_LOCALES.include? stripped_locale
|
245
|
+
stripped_locale
|
246
|
+
else
|
247
|
+
'default'
|
248
|
+
end
|
249
|
+
end
|
204
250
|
end
|
205
251
|
end
|
206
252
|
end
|