solidus_admin 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.prettierrc +4 -0
- data/app/assets/builds/solidus_admin/tailwind.css +13 -1
- data/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/adjustment_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +22 -8
- data/app/components/solidus_admin/adjustment_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/adjustment_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/base_component.rb +2 -18
- data/app/components/solidus_admin/layout/navigation/component.js +1 -1
- data/app/components/solidus_admin/orders/index/component.rb +2 -2
- data/app/components/solidus_admin/orders/show/address/component.js +2 -2
- data/app/components/solidus_admin/orders/show/component.js +2 -2
- data/app/components/solidus_admin/orders/show/customer_search/component.js +5 -4
- data/app/components/solidus_admin/orders/show/summary/component.html.erb +6 -6
- data/app/components/solidus_admin/products/show/component.html.erb +7 -1
- data/app/components/solidus_admin/products/show/component.rb +6 -0
- data/app/components/solidus_admin/properties/edit/component.html.erb +16 -0
- data/app/components/solidus_admin/properties/edit/component.rb +4 -0
- data/app/components/solidus_admin/properties/edit/component.yml +4 -0
- data/app/components/solidus_admin/properties/index/component.rb +19 -6
- data/app/components/solidus_admin/properties/new/component.html.erb +16 -0
- data/app/components/solidus_admin/properties/new/component.rb +4 -0
- data/app/components/solidus_admin/properties/new/component.yml +4 -0
- data/app/components/solidus_admin/refund_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/refund_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/refund_reasons/index/component.rb +22 -8
- data/app/components/solidus_admin/refund_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/refund_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/resources/base_component.rb +20 -0
- data/app/components/solidus_admin/resources/edit/component.rb +11 -0
- data/app/components/solidus_admin/resources/new/component.rb +11 -0
- data/app/components/solidus_admin/return_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/return_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/return_reasons/index/component.rb +13 -7
- data/app/components/solidus_admin/return_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/return_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/roles/edit/component.html.erb +2 -4
- data/app/components/solidus_admin/roles/edit/component.rb +1 -10
- data/app/components/solidus_admin/roles/index/component.rb +16 -8
- data/app/components/solidus_admin/roles/new/component.html.erb +2 -4
- data/app/components/solidus_admin/roles/new/component.rb +1 -10
- data/app/components/solidus_admin/shipping_categories/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/shipping_categories/edit/component.rb +1 -9
- data/app/components/solidus_admin/shipping_categories/index/component.rb +14 -17
- data/app/components/solidus_admin/shipping_categories/new/component.html.erb +2 -4
- data/app/components/solidus_admin/shipping_categories/new/component.rb +1 -9
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +74 -73
- data/app/components/solidus_admin/stock_items/edit/component.js +4 -3
- data/app/components/solidus_admin/stock_items/edit/component.rb +1 -10
- data/app/components/solidus_admin/stock_items/index/component.rb +9 -5
- data/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/store_credit_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +14 -7
- data/app/components/solidus_admin/store_credit_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/store_credit_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/tax_categories/edit/component.html.erb +2 -4
- data/app/components/solidus_admin/tax_categories/edit/component.rb +1 -9
- data/app/components/solidus_admin/tax_categories/index/component.rb +30 -9
- data/app/components/solidus_admin/tax_categories/new/component.html.erb +2 -4
- data/app/components/solidus_admin/tax_categories/new/component.rb +1 -9
- data/app/components/solidus_admin/ui/dropdown/component.js +3 -3
- data/app/components/solidus_admin/ui/forms/address/component.js +5 -6
- data/app/components/solidus_admin/ui/forms/field/component.rb +1 -1
- data/app/components/solidus_admin/ui/forms/input/component.js +3 -4
- data/app/components/solidus_admin/ui/forms/input/component.rb +15 -4
- data/app/components/solidus_admin/ui/modal/component.js +2 -2
- data/app/components/solidus_admin/ui/pages/index/component.html.erb +3 -3
- data/app/components/solidus_admin/ui/pages/index/component.rb +6 -1
- data/app/components/solidus_admin/ui/table/component.html.erb +4 -3
- data/app/components/solidus_admin/ui/table/component.js +13 -17
- data/app/components/solidus_admin/ui/table/ransack_filter/component.js +18 -16
- data/app/components/solidus_admin/ui/toast/component.js +3 -3
- data/app/components/solidus_admin/ui/toggletip/component.js +14 -12
- data/app/components/solidus_admin/users/orders/component.rb +1 -1
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.html.erb +22 -0
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.rb +22 -0
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.yml +5 -0
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.html.erb +15 -0
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.rb +16 -0
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.yml +4 -0
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.html.erb +21 -0
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.rb +22 -0
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.yml +5 -0
- data/app/components/solidus_admin/users/store_credits/index/component.html.erb +27 -11
- data/app/components/solidus_admin/users/store_credits/index/component.rb +18 -10
- data/app/components/solidus_admin/users/store_credits/new/component.html.erb +30 -0
- data/app/components/solidus_admin/users/store_credits/new/component.rb +22 -0
- data/app/components/solidus_admin/users/store_credits/new/component.yml +5 -0
- data/app/components/solidus_admin/users/store_credits/show/component.html.erb +83 -0
- data/app/components/solidus_admin/users/store_credits/show/component.rb +120 -0
- data/app/components/solidus_admin/users/store_credits/show/component.yml +18 -0
- data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +3 -105
- data/app/controllers/solidus_admin/authentication_adapters/backend.rb +1 -1
- data/app/controllers/solidus_admin/base_controller.rb +12 -1
- data/app/controllers/solidus_admin/properties_controller.rb +6 -24
- data/app/controllers/solidus_admin/refund_reasons_controller.rb +5 -105
- data/app/controllers/solidus_admin/resources_controller.rb +152 -0
- data/app/controllers/solidus_admin/return_reasons_controller.rb +4 -104
- data/app/controllers/solidus_admin/roles_controller.rb +3 -105
- data/app/controllers/solidus_admin/shipping_categories_controller.rb +3 -107
- data/app/controllers/solidus_admin/stock_items_controller.rb +12 -29
- data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +5 -105
- data/app/controllers/solidus_admin/store_credits_controller.rb +231 -0
- data/app/controllers/solidus_admin/tax_categories_controller.rb +3 -109
- data/app/controllers/solidus_admin/users_controller.rb +1 -9
- data/app/helpers/solidus_admin/void_elements_helper.rb +13 -0
- data/app/views/layouts/solidus_admin/application.html.erb +3 -0
- data/config/locales/menu_item.en.yml +0 -1
- data/config/locales/properties.en.yml +4 -0
- data/config/locales/store_credits.en.yml +16 -0
- data/config/routes.rb +12 -2
- data/lib/solidus_admin/configuration.rb +0 -5
- data/lib/solidus_admin/engine.rb +6 -0
- data/lib/solidus_admin/install_tailwindcss.rb +1 -1
- data/lib/solidus_admin/testing_support/component_helpers.rb +3 -9
- data/lib/solidus_admin/testing_support/shared_examples/bulk_delete_resources.rb +20 -0
- data/lib/solidus_admin/testing_support/shared_examples/crud_resource_requests.rb +138 -0
- data/lib/solidus_admin/testing_support/shared_examples/promotion_categories_features.rb +72 -0
- data/lib/solidus_admin/version.rb +1 -1
- metadata +35 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad8d6194f5a37ead1b362139f65c296fa6c7485807e79be11122d4689db00e9f
|
4
|
+
data.tar.gz: 17f079ab01043b7529e013eff1b613c95de6385c2e85e6664a8476e42c7ff940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c60e10eceed8c821298dee0ad21cf3c0069953f7269a0b483a5c5778f3532bd8e6ba84a46531082eb774682b59fb6a631fd654eaa78033b800cb30a87e7a6bcb
|
7
|
+
data.tar.gz: 837117c43cc7618445d41b2d500a2e9c79eb4f5b7c4f485ce21d4f2ab3dc816cdace1ad930208b970ab22096deda3e0c4a0e43a4f472caee39b21c048b7f0b77
|
data/.prettierrc
ADDED
@@ -109,7 +109,7 @@
|
|
109
109
|
}
|
110
110
|
|
111
111
|
/*
|
112
|
-
! tailwindcss v3.4.
|
112
|
+
! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com
|
113
113
|
*/
|
114
114
|
|
115
115
|
/*
|
@@ -1141,6 +1141,10 @@ summary{
|
|
1141
1141
|
width: 10%;
|
1142
1142
|
}
|
1143
1143
|
|
1144
|
+
.w-\[100\%\]{
|
1145
|
+
width: 100%;
|
1146
|
+
}
|
1147
|
+
|
1144
1148
|
.w-\[12\%\]{
|
1145
1149
|
width: 12%;
|
1146
1150
|
}
|
@@ -1165,6 +1169,10 @@ summary{
|
|
1165
1169
|
width: 1rem;
|
1166
1170
|
}
|
1167
1171
|
|
1172
|
+
.w-\[20\%\]{
|
1173
|
+
width: 20%;
|
1174
|
+
}
|
1175
|
+
|
1168
1176
|
.w-\[22\%\]{
|
1169
1177
|
width: 22%;
|
1170
1178
|
}
|
@@ -1177,6 +1185,10 @@ summary{
|
|
1177
1185
|
width: 24%;
|
1178
1186
|
}
|
1179
1187
|
|
1188
|
+
.w-\[25\%\]{
|
1189
|
+
width: 25%;
|
1190
|
+
}
|
1191
|
+
|
1180
1192
|
.w-\[400px\]{
|
1181
1193
|
width: 400px;
|
1182
1194
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @adjustment_reason, url:
|
3
|
+
<%= form_for @adjustment_reason, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -24,4 +24,3 @@
|
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
|
-
<%= render component("adjustment_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::AdjustmentReasons::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, adjustment_reason:)
|
5
|
-
@page = page
|
6
|
-
@adjustment_reason = adjustment_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@adjustment_reason, "#{stimulus_id}_edit_adjustment_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::AdjustmentReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
12
4
|
end
|
@@ -17,7 +17,8 @@ class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsA
|
|
17
17
|
render component("ui/button").new(
|
18
18
|
tag: :a,
|
19
19
|
text: t('.add'),
|
20
|
-
href: solidus_admin.new_adjustment_reason_path,
|
20
|
+
href: solidus_admin.new_adjustment_reason_path(**search_filter_params),
|
21
|
+
data: { turbo_frame: :resource_modal },
|
21
22
|
icon: "add-line",
|
22
23
|
class: "align-self-end w-full",
|
23
24
|
)
|
@@ -25,20 +26,19 @@ class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsA
|
|
25
26
|
|
26
27
|
def turbo_frames
|
27
28
|
%w[
|
28
|
-
|
29
|
-
edit_adjustment_reason_modal
|
29
|
+
resource_modal
|
30
30
|
]
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
spree.edit_admin_adjustment_reason_path(adjustment_reason,
|
33
|
+
def edit_path(adjustment_reason)
|
34
|
+
spree.edit_admin_adjustment_reason_path(adjustment_reason, **search_filter_params)
|
35
35
|
end
|
36
36
|
|
37
37
|
def batch_actions
|
38
38
|
[
|
39
39
|
{
|
40
40
|
label: t('.batch_actions.delete'),
|
41
|
-
action: solidus_admin.adjustment_reasons_path,
|
41
|
+
action: solidus_admin.adjustment_reasons_path(**search_filter_params),
|
42
42
|
method: :delete,
|
43
43
|
icon: 'delete-bin-7-line',
|
44
44
|
},
|
@@ -47,8 +47,22 @@ class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsA
|
|
47
47
|
|
48
48
|
def columns
|
49
49
|
[
|
50
|
-
|
51
|
-
|
50
|
+
{
|
51
|
+
header: :name,
|
52
|
+
data: ->(adjustment_reason) do
|
53
|
+
link_to adjustment_reason.name, edit_path(adjustment_reason),
|
54
|
+
class: 'body-link',
|
55
|
+
data: { turbo_frame: :resource_modal }
|
56
|
+
end
|
57
|
+
},
|
58
|
+
{
|
59
|
+
header: :code,
|
60
|
+
data: ->(adjustment_reason) do
|
61
|
+
link_to adjustment_reason.code, edit_path(adjustment_reason),
|
62
|
+
class: 'body-link',
|
63
|
+
data: { turbo_frame: :resource_modal }
|
64
|
+
end
|
65
|
+
},
|
52
66
|
{
|
53
67
|
header: :active,
|
54
68
|
data: ->(adjustment_reason) do
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @adjustment_reason, url:
|
3
|
+
<%= form_for @adjustment_reason, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -24,5 +24,3 @@
|
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
|
-
|
28
|
-
<%= render component("adjustment_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, adjustment_reason:)
|
5
|
-
@page = page
|
6
|
-
@adjustment_reason = adjustment_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@adjustment_reason, "#{stimulus_id}_new_adjustment_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::Resources::New::Component
|
12
4
|
end
|
@@ -7,6 +7,7 @@ module SolidusAdmin
|
|
7
7
|
# BaseComponent is the base class for all components in Solidus Admin.
|
8
8
|
class BaseComponent < ViewComponent::Base
|
9
9
|
include SolidusAdmin::ComponentsHelper
|
10
|
+
include SolidusAdmin::VoidElementsHelper
|
10
11
|
include Turbo::FramesHelper
|
11
12
|
|
12
13
|
def icon_tag(name, **attrs)
|
@@ -37,23 +38,6 @@ module SolidusAdmin
|
|
37
38
|
end
|
38
39
|
|
39
40
|
delegate :stimulus_id, to: :class
|
40
|
-
|
41
|
-
class << self
|
42
|
-
private
|
43
|
-
|
44
|
-
def engines_with_routes
|
45
|
-
Rails::Engine.subclasses.map(&:instance).reject do |engine|
|
46
|
-
engine.routes.empty?
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# For each engine with routes, define a method that returns the routes proxy.
|
52
|
-
# This allows us to use the routes in the context of a component class.
|
53
|
-
engines_with_routes.each do |engine|
|
54
|
-
define_method(engine.engine_name) do
|
55
|
-
engine.routes.url_helpers
|
56
|
-
end
|
57
|
-
end
|
41
|
+
delegate :search_filter_params, to: :helpers
|
58
42
|
end
|
59
43
|
end
|
@@ -143,7 +143,7 @@ class SolidusAdmin::Orders::Index::Component < SolidusAdmin::UI::Pages::Index::C
|
|
143
143
|
col: { class: "w-[400px]" },
|
144
144
|
header: :customer,
|
145
145
|
data: ->(order) do
|
146
|
-
customer_email = order.
|
146
|
+
customer_email = order.email
|
147
147
|
content_tag :div, String(customer_email)
|
148
148
|
end
|
149
149
|
}
|
@@ -153,7 +153,7 @@ class SolidusAdmin::Orders::Index::Component < SolidusAdmin::UI::Pages::Index::C
|
|
153
153
|
{
|
154
154
|
header: :total,
|
155
155
|
data: ->(order) do
|
156
|
-
content_tag :div,
|
156
|
+
content_tag :div, order.display_total
|
157
157
|
end
|
158
158
|
}
|
159
159
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
static targets = ["addresses"]
|
5
5
|
|
6
6
|
close() {
|
7
|
-
this.addressesTarget.removeAttribute(
|
7
|
+
this.addressesTarget.removeAttribute("open")
|
8
8
|
}
|
9
9
|
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
closeMenus() {
|
5
|
-
this.element.querySelectorAll(
|
5
|
+
this.element.querySelectorAll("details").forEach((details) => details.removeAttribute("open"))
|
6
6
|
}
|
7
7
|
}
|
@@ -1,14 +1,15 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
static values = { customersUrl: String }
|
5
5
|
|
6
6
|
async search({ detail: { query, controller } }) {
|
7
|
-
controller.resultsValue =
|
8
|
-
|
7
|
+
controller.resultsValue = await (
|
8
|
+
await fetch(`${this.customersUrlValue}?q[name_or_variants_including_master_sku_cont]=${query}`)
|
9
|
+
).text()
|
9
10
|
}
|
10
11
|
|
11
12
|
submit(event) {
|
12
|
-
event.detail.resultTarget.querySelector(
|
13
|
+
event.detail.resultTarget.querySelector("form").submit()
|
13
14
|
}
|
14
15
|
}
|
@@ -2,12 +2,12 @@
|
|
2
2
|
<%= render component('ui/panel').new(title: t('.summary')) do %>
|
3
3
|
<%= render component('ui/details_list').new(
|
4
4
|
items: [
|
5
|
-
{ label: t('.subtotal'), value:
|
6
|
-
{ label: t('.taxes'), value:
|
7
|
-
{ label: t('.shipping'), value:
|
8
|
-
{ label: link_to(t('.add_promo_code'), '#', class: "body-link"), value:
|
9
|
-
{ label: link_to(t('.adjustments'), solidus_admin.order_adjustments_path(@order), class: "body-link"), value:
|
10
|
-
{ label: t('.total'), value:
|
5
|
+
{ label: t('.subtotal'), value: @order.display_item_total, class: 'font-semibold' },
|
6
|
+
{ label: t('.taxes'), value: @order.display_additional_tax_total },
|
7
|
+
{ label: t('.shipping'), value: @order.display_shipment_total },
|
8
|
+
{ label: link_to(t('.add_promo_code'), '#', class: "body-link"), value: @order.display_promo_total },
|
9
|
+
{ label: link_to(t('.adjustments'), solidus_admin.order_adjustments_path(@order), class: "body-link"), value: @order.display_adjustment_total },
|
10
|
+
{ label: t('.total'), value: @order.display_total, class: 'font-semibold' }
|
11
11
|
]
|
12
12
|
) %>
|
13
13
|
<% end %>
|
@@ -36,8 +36,14 @@
|
|
36
36
|
<%= render component("ui/forms/field").text_field(f, :meta_title) %>
|
37
37
|
<%= render component("ui/forms/field").text_field(f, :meta_description) %>
|
38
38
|
<%= render component("ui/forms/field").text_area(f, :meta_keywords) %>
|
39
|
+
<%= render component("ui/forms/field").text_field(f, :gtin) %>
|
40
|
+
<%= render component("ui/forms/field").select(
|
41
|
+
f,
|
42
|
+
:condition,
|
43
|
+
condition_options,
|
44
|
+
include_blank: t('spree.unset'),
|
45
|
+
) %>
|
39
46
|
<% end %>
|
40
|
-
|
41
47
|
<%= render component('ui/panel').new(title: "Media") do |panel| %>
|
42
48
|
<% panel.with_action(
|
43
49
|
name: t(".manage_images"),
|
@@ -25,4 +25,10 @@ class SolidusAdmin::Products::Show::Component < SolidusAdmin::BaseComponent
|
|
25
25
|
["#{_1} (#{_2})", _3]
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
def condition_options
|
30
|
+
@condition_options ||= Spree::Variant.conditions.map do |key, value|
|
31
|
+
[t("spree.condition.#{key}"), value]
|
32
|
+
end
|
33
|
+
end
|
28
34
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @property, url: form_url, html: { id: form_id } do |f| %>
|
4
|
+
<div class="flex flex-col gap-6 pb-4">
|
5
|
+
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
|
+
<%= render component("ui/forms/field").text_field(f, :presentation, class: "required") %>
|
7
|
+
</div>
|
8
|
+
<% modal.with_actions do %>
|
9
|
+
<form method="dialog">
|
10
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
11
|
+
</form>
|
12
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
@@ -5,6 +5,10 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
5
5
|
Spree::Property
|
6
6
|
end
|
7
7
|
|
8
|
+
def title
|
9
|
+
t('solidus_admin.properties.title')
|
10
|
+
end
|
11
|
+
|
8
12
|
def search_key
|
9
13
|
:name_cont
|
10
14
|
end
|
@@ -13,15 +17,20 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
13
17
|
solidus_admin.properties_path
|
14
18
|
end
|
15
19
|
|
16
|
-
def
|
17
|
-
|
20
|
+
def edit_path(property)
|
21
|
+
solidus_admin.edit_property_path(property, **search_filter_params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def turbo_frames
|
25
|
+
%w[resource_modal]
|
18
26
|
end
|
19
27
|
|
20
28
|
def page_actions
|
21
29
|
render component("ui/button").new(
|
22
30
|
tag: :a,
|
23
31
|
text: t('.add'),
|
24
|
-
href:
|
32
|
+
href: solidus_admin.new_property_path(**search_filter_params),
|
33
|
+
data: { turbo_frame: :resource_modal },
|
25
34
|
icon: "add-line",
|
26
35
|
)
|
27
36
|
end
|
@@ -30,7 +39,7 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
30
39
|
[
|
31
40
|
{
|
32
41
|
label: t('.batch_actions.delete'),
|
33
|
-
action: solidus_admin.properties_path,
|
42
|
+
action: solidus_admin.properties_path(**search_filter_params),
|
34
43
|
method: :delete,
|
35
44
|
icon: 'delete-bin-7-line',
|
36
45
|
},
|
@@ -48,7 +57,9 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
48
57
|
{
|
49
58
|
header: :name,
|
50
59
|
data: ->(property) do
|
51
|
-
|
60
|
+
link_to property.name, edit_path(property),
|
61
|
+
data: { turbo_frame: :resource_modal },
|
62
|
+
class: 'body-link'
|
52
63
|
end
|
53
64
|
}
|
54
65
|
end
|
@@ -57,7 +68,9 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
57
68
|
{
|
58
69
|
header: :presentation,
|
59
70
|
data: ->(property) do
|
60
|
-
|
71
|
+
link_to property.presentation, edit_path(property),
|
72
|
+
data: { turbo_frame: :resource_modal },
|
73
|
+
class: 'body-link'
|
61
74
|
end
|
62
75
|
}
|
63
76
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @property, url: form_url, html: { id: form_id } do |f| %>
|
4
|
+
<div class="flex flex-col gap-6 pb-4">
|
5
|
+
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
|
+
<%= render component("ui/forms/field").text_field(f, :presentation, class: "required") %>
|
7
|
+
</div>
|
8
|
+
<% modal.with_actions do %>
|
9
|
+
<form method="dialog">
|
10
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
11
|
+
</form>
|
12
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @refund_reason, url:
|
3
|
+
<%= form_for @refund_reason, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -24,4 +24,3 @@
|
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
|
-
<%= render component("refund_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::RefundReasons::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, refund_reason:)
|
5
|
-
@page = page
|
6
|
-
@refund_reason = refund_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@refund_reason, "#{stimulus_id}_edit_refund_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::RefundReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
12
4
|
end
|
@@ -13,14 +13,13 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
13
13
|
:name_or_code_cont
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
spree.edit_admin_refund_reason_path(refund_reason,
|
16
|
+
def edit_path(refund_reason)
|
17
|
+
spree.edit_admin_refund_reason_path(refund_reason, **search_filter_params)
|
18
18
|
end
|
19
19
|
|
20
20
|
def turbo_frames
|
21
21
|
%w[
|
22
|
-
|
23
|
-
edit_refund_reason_modal
|
22
|
+
resource_modal
|
24
23
|
]
|
25
24
|
end
|
26
25
|
|
@@ -28,7 +27,8 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
28
27
|
render component("ui/button").new(
|
29
28
|
tag: :a,
|
30
29
|
text: t('.add'),
|
31
|
-
href: solidus_admin.new_refund_reason_path,
|
30
|
+
href: solidus_admin.new_refund_reason_path(**search_filter_params),
|
31
|
+
data: { turbo_frame: :resource_modal },
|
32
32
|
icon: "add-line",
|
33
33
|
class: "align-self-end w-full",
|
34
34
|
)
|
@@ -38,7 +38,7 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
38
38
|
[
|
39
39
|
{
|
40
40
|
label: t('.batch_actions.delete'),
|
41
|
-
action: solidus_admin.refund_reasons_path,
|
41
|
+
action: solidus_admin.refund_reasons_path(**search_filter_params),
|
42
42
|
method: :delete,
|
43
43
|
icon: 'delete-bin-7-line',
|
44
44
|
},
|
@@ -47,8 +47,22 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
47
47
|
|
48
48
|
def columns
|
49
49
|
[
|
50
|
-
|
51
|
-
|
50
|
+
{
|
51
|
+
header: :name,
|
52
|
+
data: ->(refund_reason) do
|
53
|
+
link_to refund_reason.name, edit_path(refund_reason),
|
54
|
+
data: { turbo_frame: :resource_modal },
|
55
|
+
class: 'body-link'
|
56
|
+
end
|
57
|
+
},
|
58
|
+
{
|
59
|
+
header: :code,
|
60
|
+
data: ->(refund_reason) do
|
61
|
+
link_to_if refund_reason.code, refund_reason.code, edit_path(refund_reason),
|
62
|
+
data: { turbo_frame: :resource_modal },
|
63
|
+
class: 'body-link'
|
64
|
+
end
|
65
|
+
},
|
52
66
|
{
|
53
67
|
header: :active,
|
54
68
|
data: ->(refund_reason) do
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @refund_reason, url:
|
3
|
+
<%= form_for @refund_reason, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -23,5 +23,3 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
|
27
|
-
<%= render component("refund_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::RefundReasons::New::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, refund_reason:)
|
5
|
-
@page = page
|
6
|
-
@refund_reason = refund_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@refund_reason, "#{stimulus_id}_new_refund_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::RefundReasons::New::Component < SolidusAdmin::Resources::New::Component
|
12
4
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Resources::BaseComponent < SolidusAdmin::BaseComponent
|
4
|
+
def initialize(resource)
|
5
|
+
@resource = resource
|
6
|
+
instance_variable_set("@#{resource_name}", resource)
|
7
|
+
end
|
8
|
+
|
9
|
+
def back_url
|
10
|
+
solidus_admin.send("#{plural_resource_name}_path")
|
11
|
+
end
|
12
|
+
|
13
|
+
def resource_name
|
14
|
+
@resource.model_name.singular_route_key
|
15
|
+
end
|
16
|
+
|
17
|
+
def plural_resource_name
|
18
|
+
@resource.model_name.route_key
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Resources::Edit::Component < SolidusAdmin::Resources::BaseComponent
|
4
|
+
def form_id
|
5
|
+
dom_id(@resource, "#{stimulus_id}_edit_#{resource_name}_form")
|
6
|
+
end
|
7
|
+
|
8
|
+
def form_url
|
9
|
+
solidus_admin.send("#{resource_name}_path", @resource, **search_filter_params)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Resources::New::Component < SolidusAdmin::Resources::BaseComponent
|
4
|
+
def form_id
|
5
|
+
dom_id(@resource, "#{stimulus_id}_new_#{resource_name}_form")
|
6
|
+
end
|
7
|
+
|
8
|
+
def form_url
|
9
|
+
solidus_admin.send("#{plural_resource_name}_path", **search_filter_params)
|
10
|
+
end
|
11
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @return_reason, url:
|
3
|
+
<%= form_for @return_reason, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<label class="flex gap-2 items-center">
|
@@ -23,4 +23,3 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
<%= render component("return_reasons/index").new(page: @page) %>
|