solidus_admin 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +9 -19
- data/app/components/solidus_admin/base_component.rb +29 -1
- data/app/components/solidus_admin/option_types/index/component.rb +20 -6
- data/app/components/solidus_admin/orders/index/component.rb +20 -15
- data/app/components/solidus_admin/orders/index/component.yml +0 -1
- data/app/components/solidus_admin/payment_methods/index/component.rb +28 -18
- data/app/components/solidus_admin/payment_methods/index/component.yml +0 -5
- data/app/components/solidus_admin/products/index/component.rb +17 -10
- data/app/components/solidus_admin/products/index/component.yml +0 -2
- data/app/components/solidus_admin/promotion_categories/index/component.rb +12 -13
- data/app/components/solidus_admin/promotions/index/component.rb +17 -10
- data/app/components/solidus_admin/promotions/index/component.yml +0 -4
- data/app/components/solidus_admin/properties/index/component.rb +17 -18
- data/app/components/solidus_admin/refund_reasons/index/component.rb +18 -18
- data/app/components/solidus_admin/refunds_and_returns/component.rb +33 -13
- data/app/components/solidus_admin/reimbursement_types/index/component.rb +7 -25
- data/app/components/solidus_admin/return_reasons/index/component.rb +9 -19
- data/app/components/solidus_admin/shipping/component.rb +23 -11
- data/app/components/solidus_admin/shipping_categories/index/component.rb +18 -18
- data/app/components/solidus_admin/shipping_methods/index/component.rb +18 -18
- data/app/components/solidus_admin/stock_items/index/component.rb +9 -15
- data/app/components/solidus_admin/stock_locations/index/component.rb +18 -10
- data/app/components/solidus_admin/stock_locations/index/component.yml +0 -3
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +18 -18
- data/app/components/solidus_admin/stores/index/component.rb +17 -18
- data/app/components/solidus_admin/tax_categories/index/component.rb +20 -20
- data/app/components/solidus_admin/tax_rates/index/component.rb +18 -14
- data/app/components/solidus_admin/taxes/component.rb +8 -8
- data/app/components/solidus_admin/taxonomies/index/component.rb +17 -11
- data/app/components/solidus_admin/ui/pages/index/component.html.erb +30 -0
- data/app/components/solidus_admin/ui/pages/index/component.rb +119 -0
- data/app/components/solidus_admin/ui/table/component.html.erb +2 -1
- data/app/components/solidus_admin/ui/table/component.rb +1 -1
- data/app/components/solidus_admin/users/index/component.rb +17 -10
- data/app/components/solidus_admin/users/index/component.yml +0 -3
- data/app/components/solidus_admin/zones/index/component.rb +18 -10
- data/app/controllers/solidus_admin/promotion_categories_controller.rb +0 -9
- data/app/controllers/solidus_admin/properties_controller.rb +1 -1
- data/app/views/layouts/solidus_admin/preview.html.erb +2 -0
- data/config/initializers/view_component.rb +1 -1
- data/lib/solidus_admin/configuration.rb +3 -1
- data/lib/solidus_admin/version.rb +1 -1
- metadata +6 -43
- data/app/components/solidus_admin/adjustment_reasons/index/component.html.erb +0 -32
- data/app/components/solidus_admin/adjustment_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/option_types/index/component.html.erb +0 -30
- data/app/components/solidus_admin/orders/index/component.html.erb +0 -35
- data/app/components/solidus_admin/payment_methods/index/component.html.erb +0 -38
- data/app/components/solidus_admin/products/index/component.html.erb +0 -34
- data/app/components/solidus_admin/promotion_categories/index/component.html.erb +0 -26
- data/app/components/solidus_admin/promotion_categories/index/component.yml +0 -4
- data/app/components/solidus_admin/promotions/index/component.html.erb +0 -34
- data/app/components/solidus_admin/properties/index/component.html.erb +0 -34
- data/app/components/solidus_admin/properties/index/component.yml +0 -4
- data/app/components/solidus_admin/refund_reasons/index/component.html.erb +0 -31
- data/app/components/solidus_admin/refund_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/refunds_and_returns/component.html.erb +0 -26
- data/app/components/solidus_admin/reimbursement_types/index/component.html.erb +0 -22
- data/app/components/solidus_admin/reimbursement_types/index/component.yml +0 -4
- data/app/components/solidus_admin/return_reasons/index/component.html.erb +0 -31
- data/app/components/solidus_admin/return_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/shipping/component.html.erb +0 -30
- data/app/components/solidus_admin/shipping_categories/index/component.html.erb +0 -32
- data/app/components/solidus_admin/shipping_categories/index/component.yml +0 -4
- data/app/components/solidus_admin/shipping_methods/index/component.html.erb +0 -32
- data/app/components/solidus_admin/shipping_methods/index/component.yml +0 -4
- data/app/components/solidus_admin/stock_items/index/component.html.erb +0 -26
- data/app/components/solidus_admin/stock_locations/index/component.html.erb +0 -32
- data/app/components/solidus_admin/store_credit_reasons/index/component.html.erb +0 -31
- data/app/components/solidus_admin/store_credit_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/stores/index/component.html.erb +0 -34
- data/app/components/solidus_admin/stores/index/component.yml +0 -4
- data/app/components/solidus_admin/tax_categories/index/component.html.erb +0 -32
- data/app/components/solidus_admin/tax_categories/index/component.yml +0 -6
- data/app/components/solidus_admin/tax_rates/index/component.html.erb +0 -32
- data/app/components/solidus_admin/tax_rates/index/component.yml +0 -4
- data/app/components/solidus_admin/taxes/component.html.erb +0 -24
- data/app/components/solidus_admin/taxonomies/index/component.html.erb +0 -28
- data/app/components/solidus_admin/taxonomies/index/component.yml +0 -4
- data/app/components/solidus_admin/users/index/component.html.erb +0 -34
- data/app/components/solidus_admin/zones/index/component.html.erb +0 -35
- data/app/components/solidus_admin/zones/index/component.yml +0 -4
- /data/app/components/solidus_admin/{option_types → ui/pages}/index/component.yml +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28b57ee7cd36b6042c6a1f7a735587aaba8a9e78d6050744ff6687b3799154fc
|
4
|
+
data.tar.gz: de8a6150a3b9c7445d4b572cc4cd6af8aba87e6be2ffcd81582b7bdfd96b2b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9db4b1349c35d1778bad7f922951a8c9f9d35e97e90c25a78c71d97a7e3ec6f772c9411490f6b66a1323c016e94a283ed2311ff11c4a142891fee2695bee6ba4
|
7
|
+
data.tar.gz: f24a6d904d75739bd41ef956f40489459b281e9aa9b3aa9981affdbe260865019a75c2200f56e201a0dd6f647d6d48d92483766ec5b6e99cc9e2f1d133924c65
|
data/README.md
CHANGED
@@ -26,6 +26,6 @@ bin/rails admin g solidus_admin:component foo
|
|
26
26
|
## Releasing
|
27
27
|
|
28
28
|
1. Update the version in `lib/solidus_admin/version.rb`
|
29
|
-
2. Commit the changes with the message `Release v1.2.3`
|
29
|
+
2. Commit the changes with the message `Release solidus_admin/v1.2.3`
|
30
30
|
3. `cd admin; bundle exec rake release`
|
31
31
|
4. Manually release on GitHub
|
@@ -1,22 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(page:)
|
7
|
-
@page = page
|
3
|
+
class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsAndReturns::Component
|
4
|
+
def model_class
|
5
|
+
Spree::AdjustmentReason
|
8
6
|
end
|
9
7
|
|
10
|
-
def
|
11
|
-
|
8
|
+
def search_url
|
9
|
+
solidus_admin.adjustment_reasons_path
|
12
10
|
end
|
13
11
|
|
14
|
-
def
|
15
|
-
|
12
|
+
def search_key
|
13
|
+
:name_or_code_cont
|
16
14
|
end
|
17
15
|
|
18
|
-
def
|
19
|
-
|
16
|
+
def row_url(adjustment_reason)
|
17
|
+
spree.edit_admin_adjustment_reason_path(adjustment_reason)
|
20
18
|
end
|
21
19
|
|
22
20
|
def batch_actions
|
@@ -30,14 +28,6 @@ class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::BaseComp
|
|
30
28
|
]
|
31
29
|
end
|
32
30
|
|
33
|
-
def scopes
|
34
|
-
[]
|
35
|
-
end
|
36
|
-
|
37
|
-
def filters
|
38
|
-
[]
|
39
|
-
end
|
40
|
-
|
41
31
|
def columns
|
42
32
|
[
|
43
33
|
:name,
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "view_component/version"
|
4
|
+
require "view_component/translatable"
|
5
|
+
|
3
6
|
module SolidusAdmin
|
4
7
|
# BaseComponent is the base class for all components in Solidus Admin.
|
5
8
|
class BaseComponent < ViewComponent::Base
|
@@ -10,12 +13,37 @@ module SolidusAdmin
|
|
10
13
|
render component("ui/icon").new(name: name, **attrs)
|
11
14
|
end
|
12
15
|
|
16
|
+
module InheritableTranslations
|
17
|
+
def build_i18n_backend
|
18
|
+
return if compiled?
|
19
|
+
|
20
|
+
# We need to load the translations files from the ancestors so a component
|
21
|
+
# can inherit translations from its parent and is able to overwrite them.
|
22
|
+
translation_files = ancestors.reverse_each.with_object([]) do |ancestor, files|
|
23
|
+
if ancestor.is_a?(Class) && ancestor < ViewComponent::Base
|
24
|
+
files.concat(ancestor.sidecar_files(%w[yml yaml].freeze))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# In development it will become nil if the translations file is removed
|
29
|
+
self.i18n_backend = if translation_files.any?
|
30
|
+
ViewComponent::Translatable::I18nBackend.new(
|
31
|
+
i18n_scope: i18n_scope,
|
32
|
+
load_paths: translation_files
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Can be removed once https://github.com/ViewComponent/view_component/pull/1934 is released
|
39
|
+
extend InheritableTranslations unless Gem::Version.new(ViewComponent::VERSION::STRING) >= Gem::Version.new("3.9")
|
40
|
+
|
13
41
|
def missing_translation(key, options)
|
14
42
|
keys = I18n.normalize_keys(options[:locale] || I18n.locale, key, options[:scope])
|
15
43
|
|
16
44
|
logger.debug " [#{self.class}] Missing translation: #{keys.join('.')}"
|
17
45
|
|
18
|
-
if options[:locale] != :en
|
46
|
+
if (options[:locale] || I18n.default_locale) != :en
|
19
47
|
t(key, **options, locale: :en)
|
20
48
|
else
|
21
49
|
"translation missing: #{keys.join('.')}"
|
@@ -1,14 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::OptionTypes::Index::Component < SolidusAdmin::
|
4
|
-
|
3
|
+
class SolidusAdmin::OptionTypes::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def model_class
|
5
|
+
Spree::OptionType
|
6
|
+
end
|
7
|
+
|
8
|
+
def row_url(option_type)
|
9
|
+
spree.edit_admin_option_type_path(option_type)
|
10
|
+
end
|
5
11
|
|
6
|
-
def
|
7
|
-
|
12
|
+
def sortable_options
|
13
|
+
{
|
14
|
+
url: ->(option_type) { solidus_admin.move_option_type_path(option_type) },
|
15
|
+
param: 'position',
|
16
|
+
}
|
8
17
|
end
|
9
18
|
|
10
|
-
def
|
11
|
-
|
19
|
+
def page_actions
|
20
|
+
render component("ui/button").new(
|
21
|
+
tag: :a,
|
22
|
+
text: t('.add'),
|
23
|
+
href: spree.new_admin_option_type_path,
|
24
|
+
icon: "add-line",
|
25
|
+
)
|
12
26
|
end
|
13
27
|
|
14
28
|
def prev_page_path
|
@@ -1,28 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::Orders::Index::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(page:)
|
7
|
-
@page = page
|
3
|
+
class SolidusAdmin::Orders::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def model_class
|
5
|
+
Spree::Order
|
8
6
|
end
|
9
7
|
|
10
|
-
|
8
|
+
def search_key
|
9
|
+
:number_or_shipments_number_or_bill_address_name_or_email_cont
|
10
|
+
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def search_url
|
13
|
+
solidus_admin.orders_path(scope: params[:scope])
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
16
|
+
def row_url(order)
|
17
|
+
spree.edit_admin_order_path(order)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
|
20
|
+
def row_fade(order)
|
21
|
+
order.paid? && order.shipped?
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
|
24
|
+
def page_actions
|
25
|
+
render component("ui/button").new(
|
26
|
+
tag: :a,
|
27
|
+
text: t('.add'),
|
28
|
+
href: spree.new_admin_order_path,
|
29
|
+
icon: "add-line",
|
30
|
+
)
|
26
31
|
end
|
27
32
|
|
28
33
|
def scopes
|
@@ -100,7 +105,7 @@ class SolidusAdmin::Orders::Index::Component < SolidusAdmin::BaseComponent
|
|
100
105
|
{
|
101
106
|
header: :order,
|
102
107
|
data: ->(order) do
|
103
|
-
if !row_fade
|
108
|
+
if !row_fade(order)
|
104
109
|
content_tag :div, order.number, class: 'font-semibold'
|
105
110
|
else
|
106
111
|
content_tag :div, order.number
|
@@ -1,22 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::
|
4
|
-
|
3
|
+
class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def model_class
|
5
|
+
Spree::PaymentMethod
|
6
|
+
end
|
7
|
+
|
8
|
+
def search_key
|
9
|
+
:name_or_description_cont
|
10
|
+
end
|
5
11
|
|
6
|
-
def
|
7
|
-
|
12
|
+
def search_url
|
13
|
+
solidus_admin.payment_methods_path
|
8
14
|
end
|
9
15
|
|
10
|
-
def
|
11
|
-
|
16
|
+
def row_url(payment_method)
|
17
|
+
spree.edit_admin_payment_method_path(payment_method)
|
12
18
|
end
|
13
19
|
|
14
|
-
def
|
15
|
-
|
20
|
+
def sortable_options
|
21
|
+
{
|
22
|
+
url: ->(payment_method) { solidus_admin.move_payment_method_path(payment_method) },
|
23
|
+
param: 'position',
|
24
|
+
}
|
16
25
|
end
|
17
26
|
|
18
|
-
def
|
19
|
-
|
27
|
+
def page_actions
|
28
|
+
render component("ui/button").new(
|
29
|
+
tag: :a,
|
30
|
+
text: t('.add'),
|
31
|
+
href: spree.new_admin_payment_method_path,
|
32
|
+
icon: "add-line",
|
33
|
+
)
|
20
34
|
end
|
21
35
|
|
22
36
|
def batch_actions
|
@@ -40,10 +54,6 @@ class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::BaseCompone
|
|
40
54
|
]
|
41
55
|
end
|
42
56
|
|
43
|
-
def filters
|
44
|
-
[]
|
45
|
-
end
|
46
|
-
|
47
57
|
def columns
|
48
58
|
[
|
49
59
|
{
|
@@ -62,9 +72,9 @@ class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::BaseCompone
|
|
62
72
|
header: :available_to_users,
|
63
73
|
data: ->(payment_method) do
|
64
74
|
if payment_method.available_to_users?
|
65
|
-
component('ui/badge').
|
75
|
+
component('ui/badge').yes
|
66
76
|
else
|
67
|
-
component('ui/badge').
|
77
|
+
component('ui/badge').no
|
68
78
|
end
|
69
79
|
end
|
70
80
|
},
|
@@ -72,9 +82,9 @@ class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::BaseCompone
|
|
72
82
|
header: :available_to_admin,
|
73
83
|
data: ->(payment_method) do
|
74
84
|
if payment_method.available_to_admin?
|
75
|
-
component('ui/badge').
|
85
|
+
component('ui/badge').yes
|
76
86
|
else
|
77
|
-
component('ui/badge').
|
87
|
+
component('ui/badge').no
|
78
88
|
end
|
79
89
|
end
|
80
90
|
},
|
@@ -1,22 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::Products::Index::Component < SolidusAdmin::
|
4
|
-
|
3
|
+
class SolidusAdmin::Products::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def model_class
|
5
|
+
Spree::Product
|
6
|
+
end
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
+
def search_key
|
9
|
+
:name_or_variants_including_master_sku_cont
|
8
10
|
end
|
9
11
|
|
10
|
-
def
|
11
|
-
|
12
|
+
def search_url
|
13
|
+
solidus_admin.products_path
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
15
|
-
solidus_admin.
|
16
|
+
def row_url(product)
|
17
|
+
solidus_admin.product_path(product)
|
16
18
|
end
|
17
19
|
|
18
|
-
def
|
19
|
-
|
20
|
+
def page_actions
|
21
|
+
render component("ui/button").new(
|
22
|
+
tag: :a,
|
23
|
+
text: t('.add'),
|
24
|
+
href: spree.new_admin_product_path,
|
25
|
+
icon: "add-line",
|
26
|
+
)
|
20
27
|
end
|
21
28
|
|
22
29
|
def batch_actions
|
@@ -1,22 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::PromotionCategories::Index::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(page:)
|
7
|
-
@page = page
|
8
|
-
end
|
9
|
-
|
10
|
-
def title
|
11
|
-
Spree::PromotionCategory.model_name.human.pluralize
|
3
|
+
class SolidusAdmin::PromotionCategories::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def model_class
|
5
|
+
Spree::PromotionCategory
|
12
6
|
end
|
13
7
|
|
14
|
-
def
|
15
|
-
|
8
|
+
def row_url(promotion_category)
|
9
|
+
spree.edit_admin_promotion_category_path(promotion_category)
|
16
10
|
end
|
17
11
|
|
18
|
-
def
|
19
|
-
|
12
|
+
def page_actions
|
13
|
+
render component("ui/button").new(
|
14
|
+
tag: :a,
|
15
|
+
text: t('.add'),
|
16
|
+
href: spree.new_admin_promotion_category_path,
|
17
|
+
icon: "add-line",
|
18
|
+
)
|
20
19
|
end
|
21
20
|
|
22
21
|
def batch_actions
|
@@ -1,22 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::Promotions::Index::Component < SolidusAdmin::
|
4
|
-
|
3
|
+
class SolidusAdmin::Promotions::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def model_class
|
5
|
+
Spree::Promotion
|
6
|
+
end
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
+
def search_key
|
9
|
+
:name_or_codes_value_or_path_or_description_cont
|
8
10
|
end
|
9
11
|
|
10
|
-
def
|
11
|
-
|
12
|
+
def search_url
|
13
|
+
solidus_admin.promotions_path
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
15
|
-
|
16
|
+
def row_url(promotion)
|
17
|
+
spree.admin_promotion_path(promotion)
|
16
18
|
end
|
17
19
|
|
18
|
-
def
|
19
|
-
|
20
|
+
def page_actions
|
21
|
+
render component("ui/button").new(
|
22
|
+
tag: :a,
|
23
|
+
text: t('.add'),
|
24
|
+
href: spree.new_admin_promotion_path,
|
25
|
+
icon: "add-line",
|
26
|
+
)
|
20
27
|
end
|
21
28
|
|
22
29
|
def batch_actions
|
@@ -1,22 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::Properties::Index::Component < SolidusAdmin::
|
4
|
-
|
3
|
+
class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def model_class
|
5
|
+
Spree::Property
|
6
|
+
end
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
+
def search_key
|
9
|
+
:name_cont
|
8
10
|
end
|
9
11
|
|
10
|
-
def
|
11
|
-
|
12
|
+
def search_url
|
13
|
+
solidus_admin.properties_path
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
15
|
-
|
16
|
+
def row_url(property)
|
17
|
+
spree.admin_property_path(property)
|
16
18
|
end
|
17
19
|
|
18
|
-
def
|
19
|
-
|
20
|
+
def page_actions
|
21
|
+
render component("ui/button").new(
|
22
|
+
tag: :a,
|
23
|
+
text: t('.add'),
|
24
|
+
href: spree.new_admin_property_path,
|
25
|
+
icon: "add-line",
|
26
|
+
)
|
20
27
|
end
|
21
28
|
|
22
29
|
def batch_actions
|
@@ -30,14 +37,6 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::BaseComponent
|
|
30
37
|
]
|
31
38
|
end
|
32
39
|
|
33
|
-
def scopes
|
34
|
-
[]
|
35
|
-
end
|
36
|
-
|
37
|
-
def filters
|
38
|
-
[]
|
39
|
-
end
|
40
|
-
|
41
40
|
def columns
|
42
41
|
[
|
43
42
|
name_column,
|
@@ -1,22 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::
|
4
|
-
|
3
|
+
class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndReturns::Component
|
4
|
+
def model_class
|
5
|
+
Spree::RefundReason
|
6
|
+
end
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
+
def search_url
|
9
|
+
solidus_admin.refund_reasons_path
|
8
10
|
end
|
9
11
|
|
10
|
-
def
|
11
|
-
|
12
|
+
def search_key
|
13
|
+
:name_or_code_cont
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
15
|
-
|
16
|
+
def row_url(refund_reason)
|
17
|
+
spree.edit_admin_refund_reason_path(refund_reason)
|
16
18
|
end
|
17
19
|
|
18
|
-
def
|
19
|
-
|
20
|
+
def actions
|
21
|
+
render component("ui/button").new(
|
22
|
+
tag: :a,
|
23
|
+
text: t('.add'),
|
24
|
+
href: spree.new_admin_refund_reason_path,
|
25
|
+
icon: "add-line",
|
26
|
+
class: "align-self-end w-full",
|
27
|
+
)
|
20
28
|
end
|
21
29
|
|
22
30
|
def batch_actions
|
@@ -30,14 +38,6 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::BaseComponen
|
|
30
38
|
]
|
31
39
|
end
|
32
40
|
|
33
|
-
def scopes
|
34
|
-
[]
|
35
|
-
end
|
36
|
-
|
37
|
-
def filters
|
38
|
-
[]
|
39
|
-
end
|
40
|
-
|
41
41
|
def columns
|
42
42
|
[
|
43
43
|
:name,
|
@@ -1,20 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::RefundsAndReturns::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
class SolidusAdmin::RefundsAndReturns::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def title
|
5
|
+
page_header_title safe_join([
|
6
|
+
tag.div(t(".title")),
|
7
|
+
tag.div(t(".subtitle"), class: "font-normal text-sm text-gray-500"),
|
8
|
+
])
|
9
9
|
end
|
10
10
|
|
11
11
|
def tabs
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
[
|
13
|
+
{
|
14
|
+
text: Spree::RefundReason.model_name.human(count: 2),
|
15
|
+
href: solidus_admin.refund_reasons_path,
|
16
|
+
current: model_class == Spree::RefundReason,
|
17
|
+
},
|
18
|
+
{
|
19
|
+
text: Spree::ReimbursementType.model_name.human(count: 2),
|
20
|
+
href: solidus_admin.reimbursement_types_path,
|
21
|
+
current: model_class == Spree::ReimbursementType,
|
22
|
+
},
|
23
|
+
{
|
24
|
+
text: Spree::ReturnReason.model_name.human(count: 2),
|
25
|
+
href: solidus_admin.return_reasons_path,
|
26
|
+
current: model_class == Spree::ReturnReason,
|
27
|
+
},
|
28
|
+
{
|
29
|
+
text: Spree::AdjustmentReason.model_name.human(count: 2),
|
30
|
+
href: solidus_admin.adjustment_reasons_path,
|
31
|
+
current: model_class == Spree::AdjustmentReason,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
text: Spree::StoreCreditReason.model_name.human(count: 2),
|
35
|
+
href: solidus_admin.store_credit_reasons_path,
|
36
|
+
current: model_class == Spree::StoreCreditReason,
|
37
|
+
},
|
38
|
+
]
|
19
39
|
end
|
20
40
|
end
|
@@ -1,34 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ReimbursementTypes::Index::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(page:)
|
7
|
-
@page = page
|
8
|
-
end
|
9
|
-
|
10
|
-
def title
|
11
|
-
Spree::ReimbursementType.model_name.human.pluralize
|
12
|
-
end
|
13
|
-
|
14
|
-
def prev_page_path
|
15
|
-
solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
|
16
|
-
end
|
17
|
-
|
18
|
-
def next_page_path
|
19
|
-
solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last?
|
20
|
-
end
|
21
|
-
|
22
|
-
def batch_actions
|
23
|
-
[]
|
3
|
+
class SolidusAdmin::ReimbursementTypes::Index::Component < SolidusAdmin::RefundsAndReturns::Component
|
4
|
+
def model_class
|
5
|
+
Spree::ReimbursementType
|
24
6
|
end
|
25
7
|
|
26
|
-
def
|
27
|
-
|
8
|
+
def search_url
|
9
|
+
solidus_admin.reimbursement_types_path
|
28
10
|
end
|
29
11
|
|
30
|
-
def
|
31
|
-
|
12
|
+
def search_key
|
13
|
+
:name_cont
|
32
14
|
end
|
33
15
|
|
34
16
|
def columns
|