solidus_admin 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +60 -6
  3. data/Rakefile +1 -0
  4. data/app/assets/builds/solidus_admin/tailwind.css +198 -163
  5. data/app/assets/stylesheets/solidus_admin/dark.css +1 -0
  6. data/app/assets/stylesheets/solidus_admin/dimmed.css +1 -0
  7. data/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb +27 -0
  8. data/app/components/solidus_admin/adjustment_reasons/edit/component.rb +12 -0
  9. data/app/components/solidus_admin/adjustment_reasons/edit/component.yml +8 -0
  10. data/app/components/solidus_admin/adjustment_reasons/index/component.rb +19 -2
  11. data/app/components/solidus_admin/adjustment_reasons/new/component.html.erb +28 -0
  12. data/app/components/solidus_admin/adjustment_reasons/new/component.rb +12 -0
  13. data/app/components/solidus_admin/adjustment_reasons/new/component.yml +8 -0
  14. data/app/components/solidus_admin/base_component.rb +0 -25
  15. data/app/components/solidus_admin/option_types/index/component.rb +1 -1
  16. data/app/components/solidus_admin/orders/index/component.rb +8 -8
  17. data/app/components/solidus_admin/orders/index/component.yml +1 -0
  18. data/app/components/solidus_admin/orders/show/address/component.html.erb +56 -54
  19. data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/component.rb +27 -0
  20. data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/spree_line_item/component.rb +14 -0
  21. data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/spree_order/component.rb +11 -0
  22. data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/spree_shipment/component.rb +15 -0
  23. data/app/components/solidus_admin/orders/show/adjustments/index/component.rb +147 -0
  24. data/app/components/solidus_admin/orders/show/adjustments/index/component.yml +21 -0
  25. data/app/components/solidus_admin/orders/show/adjustments/index/source/component.rb +26 -0
  26. data/app/components/solidus_admin/orders/show/adjustments/index/source/spree_tax_rate/component.rb +17 -0
  27. data/app/components/solidus_admin/orders/show/adjustments/index/source/spree_unit_cancel/component.rb +7 -0
  28. data/app/components/solidus_admin/orders/show/component.html.erb +7 -3
  29. data/app/components/solidus_admin/orders/show/component.rb +8 -0
  30. data/app/components/solidus_admin/orders/show/email/component.html.erb +18 -13
  31. data/app/components/solidus_admin/orders/show/email/component.rb +0 -4
  32. data/app/components/solidus_admin/orders/show/summary/component.html.erb +1 -1
  33. data/app/components/solidus_admin/payment_methods/index/component.rb +1 -1
  34. data/app/components/solidus_admin/products/index/component.rb +8 -5
  35. data/app/components/solidus_admin/products/show/component.html.erb +14 -3
  36. data/app/components/solidus_admin/products/status/component.rb +4 -1
  37. data/app/components/solidus_admin/products/status/component.yml +1 -0
  38. data/app/components/solidus_admin/properties/index/component.rb +1 -1
  39. data/app/components/solidus_admin/refund_reasons/edit/component.html.erb +27 -0
  40. data/app/components/solidus_admin/refund_reasons/edit/component.rb +12 -0
  41. data/app/components/solidus_admin/refund_reasons/edit/component.yml +8 -0
  42. data/app/components/solidus_admin/refund_reasons/index/component.rb +11 -4
  43. data/app/components/solidus_admin/refund_reasons/new/component.html.erb +27 -0
  44. data/app/components/solidus_admin/refund_reasons/new/component.rb +12 -0
  45. data/app/components/solidus_admin/refund_reasons/new/component.yml +6 -0
  46. data/app/components/solidus_admin/return_reasons/edit/component.html.erb +26 -0
  47. data/app/components/solidus_admin/return_reasons/edit/component.rb +12 -0
  48. data/app/components/solidus_admin/return_reasons/edit/component.yml +8 -0
  49. data/app/components/solidus_admin/return_reasons/index/component.rb +20 -2
  50. data/app/components/solidus_admin/return_reasons/new/component.html.erb +27 -0
  51. data/app/components/solidus_admin/return_reasons/new/component.rb +12 -0
  52. data/app/components/solidus_admin/return_reasons/new/component.yml +8 -0
  53. data/app/components/solidus_admin/roles/edit/component.html.erb +33 -0
  54. data/app/components/solidus_admin/roles/edit/component.rb +20 -0
  55. data/app/components/solidus_admin/roles/edit/component.yml +19 -0
  56. data/app/components/solidus_admin/roles/index/component.rb +70 -0
  57. data/app/components/solidus_admin/roles/index/component.yml +6 -0
  58. data/app/components/solidus_admin/roles/new/component.html.erb +33 -0
  59. data/app/components/solidus_admin/roles/new/component.rb +20 -0
  60. data/app/components/solidus_admin/roles/new/component.yml +19 -0
  61. data/app/components/solidus_admin/shipping_categories/edit/component.html.erb +16 -0
  62. data/app/components/solidus_admin/shipping_categories/edit/component.rb +12 -0
  63. data/app/components/solidus_admin/shipping_categories/edit/component.yml +6 -0
  64. data/app/components/solidus_admin/shipping_categories/index/component.rb +20 -3
  65. data/app/components/solidus_admin/shipping_categories/new/component.html.erb +17 -0
  66. data/app/components/solidus_admin/shipping_categories/new/component.rb +12 -0
  67. data/app/components/solidus_admin/shipping_categories/new/component.yml +6 -0
  68. data/app/components/solidus_admin/shipping_methods/index/component.rb +2 -2
  69. data/app/components/solidus_admin/stock_items/edit/component.html.erb +66 -72
  70. data/app/components/solidus_admin/stock_items/edit/component.rb +0 -5
  71. data/app/components/solidus_admin/stock_items/index/component.rb +5 -6
  72. data/app/components/solidus_admin/stock_locations/index/component.rb +1 -1
  73. data/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb +26 -0
  74. data/app/components/solidus_admin/store_credit_reasons/edit/component.rb +12 -0
  75. data/app/components/solidus_admin/store_credit_reasons/edit/component.yml +8 -0
  76. data/app/components/solidus_admin/store_credit_reasons/index/component.rb +11 -4
  77. data/app/components/solidus_admin/store_credit_reasons/new/component.html.erb +27 -0
  78. data/app/components/solidus_admin/store_credit_reasons/new/component.rb +12 -0
  79. data/app/components/solidus_admin/store_credit_reasons/new/component.yml +8 -0
  80. data/app/components/solidus_admin/stores/index/component.rb +1 -1
  81. data/app/components/solidus_admin/tax_categories/edit/component.html.erb +28 -0
  82. data/app/components/solidus_admin/tax_categories/edit/component.rb +12 -0
  83. data/app/components/solidus_admin/tax_categories/edit/component.yml +8 -0
  84. data/app/components/solidus_admin/tax_categories/index/component.rb +11 -4
  85. data/app/components/solidus_admin/tax_categories/new/component.html.erb +28 -0
  86. data/app/components/solidus_admin/tax_categories/new/component.rb +12 -0
  87. data/app/components/solidus_admin/tax_categories/new/component.yml +8 -0
  88. data/app/components/solidus_admin/tax_rates/index/component.rb +3 -3
  89. data/app/components/solidus_admin/taxonomies/index/component.rb +1 -1
  90. data/app/components/solidus_admin/ui/button/component.rb +1 -1
  91. data/app/components/solidus_admin/ui/checkbox_row/component.html.erb +29 -0
  92. data/app/components/solidus_admin/ui/checkbox_row/component.rb +11 -0
  93. data/app/components/solidus_admin/ui/forms/address/component.html.erb +27 -9
  94. data/app/components/solidus_admin/ui/forms/address/component.js +38 -13
  95. data/app/components/solidus_admin/ui/forms/search/component.html.erb +2 -3
  96. data/app/components/solidus_admin/ui/forms/search/component.js +3 -3
  97. data/app/components/solidus_admin/ui/modal/component.html.erb +7 -7
  98. data/app/components/solidus_admin/ui/modal/component.js +7 -0
  99. data/app/components/solidus_admin/ui/modal/component.rb +1 -1
  100. data/app/components/solidus_admin/ui/pages/index/component.html.erb +17 -3
  101. data/app/components/solidus_admin/ui/pages/index/component.rb +29 -43
  102. data/app/components/solidus_admin/ui/panel/component.html.erb +5 -16
  103. data/app/components/solidus_admin/ui/panel/component.rb +11 -7
  104. data/app/components/solidus_admin/ui/table/component.js +31 -2
  105. data/app/components/solidus_admin/ui/table/component.rb +23 -7
  106. data/app/components/solidus_admin/ui/table/component.yml +1 -0
  107. data/app/components/solidus_admin/ui/thumbnail/component.rb +1 -1
  108. data/app/components/solidus_admin/ui/thumbnail_with_caption/component.html.erb +17 -0
  109. data/app/components/solidus_admin/ui/thumbnail_with_caption/component.rb +15 -0
  110. data/app/components/solidus_admin/users/addresses/component.html.erb +46 -0
  111. data/app/components/solidus_admin/users/addresses/component.rb +61 -0
  112. data/app/components/solidus_admin/users/addresses/component.yml +14 -0
  113. data/app/components/solidus_admin/users/edit/api_access/component.html.erb +49 -0
  114. data/app/components/solidus_admin/users/edit/api_access/component.js +9 -0
  115. data/app/components/solidus_admin/users/edit/api_access/component.rb +7 -0
  116. data/app/components/solidus_admin/users/edit/api_access/component.yml +10 -0
  117. data/app/components/solidus_admin/users/edit/component.html.erb +52 -0
  118. data/app/components/solidus_admin/users/edit/component.rb +51 -0
  119. data/app/components/solidus_admin/users/edit/component.yml +12 -0
  120. data/app/components/solidus_admin/users/index/component.rb +10 -8
  121. data/app/components/solidus_admin/users/items/component.html.erb +41 -0
  122. data/app/components/solidus_admin/users/items/component.rb +170 -0
  123. data/app/components/solidus_admin/users/items/component.yml +16 -0
  124. data/app/components/solidus_admin/users/orders/component.html.erb +42 -0
  125. data/app/components/solidus_admin/users/orders/component.rb +131 -0
  126. data/app/components/solidus_admin/users/orders/component.yml +12 -0
  127. data/app/components/solidus_admin/users/stats/component.html.erb +11 -0
  128. data/app/components/solidus_admin/users/stats/component.rb +9 -0
  129. data/app/components/solidus_admin/users/stats/component.yml +2 -0
  130. data/app/components/solidus_admin/users_and_roles/component.rb +24 -0
  131. data/app/components/solidus_admin/users_and_roles/component.yml +2 -0
  132. data/app/components/solidus_admin/zones/index/component.rb +1 -1
  133. data/app/controllers/solidus_admin/addresses_controller.rb +6 -1
  134. data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +85 -10
  135. data/app/controllers/solidus_admin/adjustments_controller.rb +57 -0
  136. data/app/controllers/solidus_admin/customers_controller.rb +5 -1
  137. data/app/controllers/solidus_admin/orders_controller.rb +5 -1
  138. data/app/controllers/solidus_admin/products_controller.rb +11 -0
  139. data/app/controllers/solidus_admin/refund_reasons_controller.rb +85 -10
  140. data/app/controllers/solidus_admin/reimbursement_types_controller.rb +0 -5
  141. data/app/controllers/solidus_admin/return_reasons_controller.rb +85 -10
  142. data/app/controllers/solidus_admin/roles_controller.rb +118 -0
  143. data/app/controllers/solidus_admin/shipping_categories_controller.rb +87 -10
  144. data/app/controllers/solidus_admin/shipping_methods_controller.rb +0 -5
  145. data/app/controllers/solidus_admin/stock_items_controller.rb +6 -6
  146. data/app/controllers/solidus_admin/stock_locations_controller.rb +0 -5
  147. data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +85 -10
  148. data/app/controllers/solidus_admin/stores_controller.rb +0 -5
  149. data/app/controllers/solidus_admin/tax_categories_controller.rb +89 -10
  150. data/app/controllers/solidus_admin/tax_rates_controller.rb +0 -5
  151. data/app/controllers/solidus_admin/users_controller.rb +85 -6
  152. data/app/controllers/solidus_admin/zones_controller.rb +0 -5
  153. data/app/helpers/solidus_admin/last_login_helper.rb +16 -0
  154. data/app/helpers/solidus_admin/permission_sets_helper.rb +32 -0
  155. data/app/views/layouts/solidus_admin/application.html.erb +2 -1
  156. data/config/locales/adjustment_reasons.en.yml +5 -1
  157. data/config/locales/adjustments.en.yml +10 -0
  158. data/config/locales/refund_reasons.en.yml +10 -0
  159. data/config/locales/return_reasons.en.yml +5 -1
  160. data/config/locales/roles.en.yml +10 -0
  161. data/config/locales/shipping_categories.en.yml +4 -0
  162. data/config/locales/store_credit_reasons.en.yml +5 -1
  163. data/config/locales/tax_categories.en.yml +4 -0
  164. data/config/locales/users.en.yml +10 -0
  165. data/config/routes.rb +24 -7
  166. data/docs/components.md +109 -0
  167. data/docs/{customizing_view_components.md → customizing_components.md} +2 -7
  168. data/docs/index_pages.md +146 -0
  169. data/docs/{customizing_menu_items.md → menu_items.md} +1 -1
  170. data/docs/stimulusjs.md +85 -0
  171. data/docs/{customizing_tailwindcss.md → tailwindcss.md} +27 -8
  172. data/lib/solidus_admin/component_registry.rb +40 -0
  173. data/lib/solidus_admin/configuration.rb +2 -26
  174. data/lib/solidus_admin/install_tailwindcss.rb +4 -2
  175. data/lib/solidus_admin/testing_support/admin_assets.rb +10 -0
  176. data/lib/solidus_admin/testing_support/component_helpers.rb +27 -0
  177. data/lib/solidus_admin/testing_support/dummy_app/rake_tasks.rb +60 -0
  178. data/lib/solidus_admin/testing_support/feature_helpers.rb +34 -0
  179. data/lib/solidus_admin/version.rb +1 -1
  180. data/solidus_admin.gemspec +7 -3
  181. metadata +108 -19
  182. data/app/components/solidus_admin/promotion_categories/index/component.rb +0 -56
  183. data/app/components/solidus_admin/promotions/index/component.rb +0 -104
  184. data/app/components/solidus_admin/promotions/index/component.yml +0 -10
  185. data/app/controllers/solidus_admin/promotion_categories_controller.rb +0 -29
  186. data/app/controllers/solidus_admin/promotions_controller.rb +0 -46
  187. data/config/locales/promotion_categories.en.yml +0 -6
  188. data/config/locales/promotions.en.yml +0 -6
  189. data/config/locales/refund_reasons_.en.yml +0 -6
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::Roles::New::Component < SolidusAdmin::BaseComponent
4
+ include SolidusAdmin::PermissionSetsHelper
5
+
6
+ def initialize(page:, role:)
7
+ @page = page
8
+ @role = role
9
+ end
10
+
11
+ def form_id
12
+ dom_id(@role, "#{stimulus_id}_new_role_form")
13
+ end
14
+
15
+ private
16
+
17
+ def permission_set_options
18
+ @permission_set_options ||= organize_permissions(permission_sets: Spree::PermissionSet.all, view_label: t(".view"), edit_label: t(".edit"))
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ # Add your component translations here.
2
+ # Use the translation in the example in your template with `t(".hello")`.
3
+ en:
4
+ title: "New Role"
5
+ cancel: "Cancel"
6
+ submit: "Add Role"
7
+ edit: "Edit"
8
+ view: "View"
9
+ name_placeholder: "Enter a clear role name"
10
+ description_placeholder: "Enter a brief description"
11
+ choose_permissions: "Choose permissions"
12
+ orders: "Orders"
13
+ products: "Products"
14
+ stock: "Stock"
15
+ restricted_stock: "Restricted Stock"
16
+ customers: "Customers"
17
+ promotions: "Promotions"
18
+ settings: "Settings"
19
+ other: "Other permissions"
@@ -0,0 +1,16 @@
1
+ <%= turbo_frame_tag :edit_shipping_category_modal do %>
2
+ <%= render component("ui/modal").new(title: t(".title")) do |modal| %>
3
+ <%= form_for @shipping_category, url: solidus_admin.shipping_category_path(@shipping_category), 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) %>
6
+ </div>
7
+ <% modal.with_actions do %>
8
+ <form method="dialog">
9
+ <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
10
+ </form>
11
+ <%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
15
+ <% end %>
16
+ <%= render component("shipping_categories/index").new(page: @page) %>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::ShippingCategories::Edit::Component < SolidusAdmin::ShippingCategories::Index::Component
4
+ def initialize(page:, shipping_category:)
5
+ @page = page
6
+ @shipping_category = shipping_category
7
+ end
8
+
9
+ def form_id
10
+ dom_id(@shipping_category, "#{stimulus_id}_edit_shipping_category_form")
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ # Add your component translations here.
2
+ # Use the translation in the example in your template with `t(".hello")`.
3
+ en:
4
+ title: "Edit Shipping Category"
5
+ cancel: "Cancel"
6
+ submit: "Update Shipping Category"
@@ -15,12 +15,29 @@ class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::Shippin
15
15
  )
16
16
  end
17
17
 
18
+ def page_actions
19
+ render component("ui/button").new(
20
+ tag: :a,
21
+ text: t('.add'),
22
+ href: solidus_admin.new_shipping_category_path, data: { turbo_frame: :new_shipping_category_modal },
23
+ icon: "add-line",
24
+ class: "align-self-end w-full",
25
+ )
26
+ end
27
+
28
+ def turbo_frames
29
+ %w[
30
+ new_shipping_category_modal
31
+ edit_shipping_category_modal
32
+ ]
33
+ end
34
+
18
35
  def row_url(shipping_category)
19
- spree.edit_admin_shipping_category_path(shipping_category)
36
+ spree.edit_admin_shipping_category_path(shipping_category, _turbo_frame: :edit_shipping_category_modal)
20
37
  end
21
38
 
22
39
  def search_key
23
- :name_or_description_cont
40
+ :name_cont
24
41
  end
25
42
 
26
43
  def search_url
@@ -30,7 +47,7 @@ class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::Shippin
30
47
  def batch_actions
31
48
  [
32
49
  {
33
- display_name: t('.batch_actions.delete'),
50
+ label: t('.batch_actions.delete'),
34
51
  action: solidus_admin.shipping_categories_path,
35
52
  method: :delete,
36
53
  icon: 'delete-bin-7-line',
@@ -0,0 +1,17 @@
1
+ <%= turbo_frame_tag :new_shipping_category_modal do %>
2
+ <%= render component("ui/modal").new(title: t(".title")) do |modal| %>
3
+ <%= form_for @shipping_category, url: solidus_admin.shipping_categories_path(page: params[:page], q: params[:q]), 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) %>
6
+ </div>
7
+ <% modal.with_actions do %>
8
+ <form method="dialog">
9
+ <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
10
+ </form>
11
+ <%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
15
+ <% end %>
16
+
17
+ <%= render component("shipping_categories/index").new(page: @page) %>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::ShippingCategories::New::Component < SolidusAdmin::ShippingCategories::Index::Component
4
+ def initialize(page:, shipping_category:)
5
+ @page = page
6
+ @shipping_category = shipping_category
7
+ end
8
+
9
+ def form_id
10
+ dom_id(@shipping_category, "#{stimulus_id}_new_shipping_category_form")
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ # Add your component translations here.
2
+ # Use the translation in the example in your template with `t(".hello")`.
3
+ en:
4
+ title: "New Shipping Category"
5
+ cancel: "Cancel"
6
+ submit: "Add Shipping Category"
@@ -17,7 +17,7 @@ class SolidusAdmin::ShippingMethods::Index::Component < SolidusAdmin::Shipping::
17
17
  :name_or_description_cont
18
18
  end
19
19
 
20
- def actions
20
+ def page_actions
21
21
  render component("ui/button").new(
22
22
  tag: :a,
23
23
  text: t('.add'),
@@ -30,7 +30,7 @@ class SolidusAdmin::ShippingMethods::Index::Component < SolidusAdmin::Shipping::
30
30
  def batch_actions
31
31
  [
32
32
  {
33
- display_name: t('.batch_actions.delete'),
33
+ label: t('.batch_actions.delete'),
34
34
  action: solidus_admin.shipping_methods_path,
35
35
  method: :delete,
36
36
  icon: 'delete-bin-7-line',
@@ -3,85 +3,79 @@
3
3
  data-<%= stimulus_id %>-initial-count-on-hand-value="<%= @stock_item.count_on_hand_was || @stock_item.count_on_hand %>"
4
4
  data-action="input-><%= stimulus_id %>#updateCountOnHand"
5
5
  >
6
- <%= render component("ui/modal").new(title: t(".title"), close_path: solidus_admin.stock_items_path(page: params[:page], q: permitted_query_params)) do |modal| %>
7
- <%= form_for @stock_item, url: solidus_admin.stock_item_path(@stock_item), html: { id: form_id } do |f| %>
8
- <div class="flex flex-col gap-6 pb-4">
9
- <div class="flex gap-4">
10
- <%= link_to spree.edit_admin_product_variant_path(
11
- @stock_item.variant.product,
12
- @stock_item.variant,
13
- ), class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %>
14
- <%= render component("ui/resource_item").new(
15
- thumbnail:
16
- (
17
- @stock_item.variant.images.first ||
18
- @stock_item.variant.product.gallery.images.first
19
- )&.url(:small),
20
- title: @stock_item.variant.name,
21
- subtitle:
22
- "#{@stock_item.variant.sku}#{@stock_item.variant.options_text.presence&.prepend(" - ")}",
23
- ) %>
24
- <% end %>
25
- <%= link_to spree.edit_admin_stock_location_path(@stock_item.stock_location), class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %>
26
- <%= render component("ui/resource_item").new(
27
- title: @stock_item.stock_location.name,
28
- subtitle: "#{Spree::StockLocation.model_name.human} #{@stock_item.stock_location.code}",
6
+ <%= turbo_frame_tag :edit_stock_item_modal do %>
7
+ <%= render component("ui/modal").new(title: t(".title")) do |modal| %>
8
+ <%= form_for @stock_item, url: solidus_admin.stock_item_path(@stock_item), html: { id: form_id } do |f| %>
9
+ <div class="flex flex-col gap-6 pb-4">
10
+ <div class="flex gap-4">
11
+ <%= link_to spree.edit_admin_product_variant_path(
12
+ @stock_item.variant.product,
13
+ @stock_item.variant,
14
+ ), class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %>
15
+ <%= render component("ui/resource_item").new(
16
+ thumbnail:
17
+ (
18
+ @stock_item.variant.images.first ||
19
+ @stock_item.variant.product.gallery.images.first
20
+ )&.url(:small),
21
+ title: @stock_item.variant.name,
22
+ subtitle:
23
+ "#{@stock_item.variant.sku}#{@stock_item.variant.options_text.presence&.prepend(" - ")}",
24
+ ) %>
25
+ <% end %>
26
+ <%= link_to spree.edit_admin_stock_location_path(@stock_item.stock_location), class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %>
27
+ <%= render component("ui/resource_item").new(
28
+ title: @stock_item.stock_location.name,
29
+ subtitle: "#{Spree::StockLocation.model_name.human} #{@stock_item.stock_location.code}",
30
+ ) %>
31
+ <% end %>
32
+ </div>
33
+
34
+ <%= render component("ui/forms/field").text_field(
35
+ f,
36
+ :count_on_hand,
37
+ disabled: true,
38
+ value: @stock_item.count_on_hand_was || @stock_item.count_on_hand,
39
+ "data-#{stimulus_id}-target": 'countOnHand',
40
+ ) %>
41
+ <%= render component("ui/forms/field").new(
42
+ label: t(".quantity_adjustment"),
43
+ hint: t(".quantity_adjustment_hint_html"),
44
+ ) do %>
45
+ <%= render component("ui/forms/input").new(
46
+ value: params[:quantity_adjustment] || 0,
47
+ name: :quantity_adjustment,
48
+ type: :number,
49
+ step: 1,
50
+ "data-#{stimulus_id}-target": 'quantityAdjustment',
29
51
  ) %>
30
52
  <% end %>
53
+
54
+ <%= render component("ui/forms/switch_field").new(
55
+ name: "#{f.object_name}[backorderable]",
56
+ label: Spree::StockItem.human_attribute_name(:backorderable),
57
+ error: f.object.errors[:backorderable],
58
+ hint: t(".backorderable_hint_html"),
59
+ checked: f.object.backorderable?,
60
+ include_hidden: true,
61
+ ) %>
31
62
  </div>
63
+ <% end %>
32
64
 
33
- <%= render component("ui/forms/field").text_field(
34
- f,
35
- :count_on_hand,
36
- disabled: true,
37
- value: @stock_item.count_on_hand_was || @stock_item.count_on_hand,
38
- "data-#{stimulus_id}-target": 'countOnHand',
39
- ) %>
40
- <%= render component("ui/forms/field").new(
41
- label: t(".quantity_adjustment"),
42
- hint: t(".quantity_adjustment_hint_html"),
43
- ) do %>
44
- <%= render component("ui/forms/input").new(
45
- value: params[:quantity_adjustment] || 0,
46
- name: :quantity_adjustment,
47
- type: :number,
48
- step: 1,
49
- "data-#{stimulus_id}-target": 'quantityAdjustment',
65
+ <% modal.with_actions do %>
66
+ <form method="dialog">
67
+ <%= render component("ui/button").new(
68
+ scheme: :secondary,
69
+ text: t(".cancel"),
50
70
  ) %>
51
- <% end %>
71
+ </form>
52
72
 
53
- <%= render component("ui/forms/switch_field").new(
54
- name: "#{f.object_name}[backorderable]",
55
- label: Spree::StockItem.human_attribute_name(:backorderable),
56
- error: f.object.errors[:backorderable],
57
- hint: t(".backorderable_hint_html"),
58
- checked: f.object.backorderable?,
59
- include_hidden: true,
73
+ <%= render component("ui/button").new(
74
+ tag: :button,
75
+ text: t(".submit"),
76
+ form: form_id,
60
77
  ) %>
61
-
62
- <% if params[:q] %>
63
- <%= f.hidden_field :q, value: params[:q].to_json, id: false %>
64
- <% end %>
65
-
66
- <% if params[:page] %>
67
- <%= f.hidden_field :page, value: params[:page], id: false %>
68
- <% end %>
69
- </div>
70
- <% end %>
71
-
72
- <% modal.with_actions do %>
73
- <%= render component("ui/button").new(
74
- tag: :a,
75
- scheme: :secondary,
76
- text: t(".cancel"),
77
- href: solidus_admin.stock_items_path(page: params[:page], q: params[:q]),
78
- ) %>
79
-
80
- <%= render component("ui/button").new(
81
- tag: :button,
82
- text: t(".submit"),
83
- form: form_id,
84
- ) %>
78
+ <% end %>
85
79
  <% end %>
86
80
  <% end %>
87
81
 
@@ -15,9 +15,4 @@ class SolidusAdmin::StockItems::Edit::Component < SolidusAdmin::BaseComponent
15
15
  def form_id
16
16
  "#{stimulus_id}-#{dom_id(@stock_item)}"
17
17
  end
18
-
19
- def permitted_query_params
20
- return params[:q].permit! if params[:q].respond_to?(:permit)
21
- {}
22
- end
23
18
  end
@@ -14,7 +14,7 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
14
14
  end
15
15
 
16
16
  def row_url(stock_item)
17
- solidus_admin.edit_stock_item_path(stock_item, page: params[:page], q: permitted_query_params)
17
+ solidus_admin.edit_stock_item_path(stock_item, _turbo_frame: :edit_stock_item_modal)
18
18
  end
19
19
 
20
20
  def scopes
@@ -30,7 +30,7 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
30
30
  def filters
31
31
  [
32
32
  {
33
- presentation: t('.filters.stock_locations'),
33
+ label: t('.filters.stock_locations'),
34
34
  combinator: 'or',
35
35
  attribute: "stock_location_id",
36
36
  predicate: "eq",
@@ -42,7 +42,7 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
42
42
  end
43
43
  },
44
44
  {
45
- presentation: t('.filters.variants'),
45
+ label: t('.filters.variants'),
46
46
  combinator: 'or',
47
47
  attribute: "variant_id",
48
48
  predicate: "eq",
@@ -167,8 +167,7 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
167
167
  }
168
168
  end
169
169
 
170
- def permitted_query_params
171
- return params[:q].permit! if params[:q].respond_to?(:permit)
172
- {}
170
+ def turbo_frames
171
+ %w[edit_stock_item_modal]
173
172
  end
174
173
  end
@@ -30,7 +30,7 @@ class SolidusAdmin::StockLocations::Index::Component < SolidusAdmin::Shipping::C
30
30
  def batch_actions
31
31
  [
32
32
  {
33
- display_name: t('.batch_actions.delete'),
33
+ label: t('.batch_actions.delete'),
34
34
  action: solidus_admin.stock_locations_path,
35
35
  method: :delete,
36
36
  icon: 'delete-bin-7-line',
@@ -0,0 +1,26 @@
1
+ <%= turbo_frame_tag :edit_store_credit_reason_modal do %>
2
+ <%= render component("ui/modal").new(title: t(".title")) do |modal| %>
3
+ <%= form_for @store_credit_reason, url: solidus_admin.store_credit_reason_path(@store_credit_reason), 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
+ <label class="flex gap-2 items-center">
7
+ <%= hidden_field_tag "#{f.object_name}[active]", "0" %>
8
+ <%= render component("ui/forms/checkbox").new(
9
+ name: "#{f.object_name}[active]",
10
+ value: "1",
11
+ checked: f.object.active
12
+ ) %>
13
+ <span class="font-semibold text-xs ml-2"><%= Spree::StoreCreditReason.human_attribute_name :active %></span>
14
+ <%= render component("ui/toggletip").new(text: t(".hints.active")) %>
15
+ </label>
16
+ </div>
17
+ <% modal.with_actions do %>
18
+ <form method="dialog">
19
+ <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
20
+ </form>
21
+ <%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
25
+ <% end %>
26
+ <%= render component("store_credit_reasons/index").new(page: @page) %>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::StoreCreditReasons::Edit::Component < SolidusAdmin::BaseComponent
4
+ def initialize(page:, store_credit_reason:)
5
+ @page = page
6
+ @store_credit_reason = store_credit_reason
7
+ end
8
+
9
+ def form_id
10
+ dom_id(@store_credit_reason, "#{stimulus_id}_edit_store_credit_reason_form")
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ # Add your component translations here.
2
+ # Use the translation in the example in your template with `t(".hello")`.
3
+ en:
4
+ title: "Edit Store Credit Reason"
5
+ cancel: "Cancel"
6
+ submit: "Update Store Credit Reason"
7
+ hints:
8
+ active: "When checked, this store credit reason will be available for selection when adding store credit to orders."
@@ -5,18 +5,25 @@ class SolidusAdmin::StoreCreditReasons::Index::Component < SolidusAdmin::Refunds
5
5
  Spree::StoreCreditReason
6
6
  end
7
7
 
8
- def actions
8
+ def page_actions
9
9
  render component("ui/button").new(
10
10
  tag: :a,
11
11
  text: t('.add'),
12
- href: spree.new_admin_store_credit_reason_path,
12
+ href: solidus_admin.new_store_credit_reason_path, data: { turbo_frame: :new_store_credit_reason_modal },
13
13
  icon: "add-line",
14
14
  class: "align-self-end w-full",
15
15
  )
16
16
  end
17
17
 
18
+ def turbo_frames
19
+ %w[
20
+ new_store_credit_reason_modal
21
+ edit_store_credit_reason_modal
22
+ ]
23
+ end
24
+
18
25
  def row_url(store_credit_reason)
19
- spree.edit_admin_store_credit_reason_path(store_credit_reason)
26
+ spree.edit_admin_store_credit_reason_path(store_credit_reason, _turbo_frame: :edit_store_credit_reason_modal)
20
27
  end
21
28
 
22
29
  def search_url
@@ -30,7 +37,7 @@ class SolidusAdmin::StoreCreditReasons::Index::Component < SolidusAdmin::Refunds
30
37
  def batch_actions
31
38
  [
32
39
  {
33
- display_name: t('.batch_actions.delete'),
40
+ label: t('.batch_actions.delete'),
34
41
  action: solidus_admin.store_credit_reasons_path,
35
42
  method: :delete,
36
43
  icon: 'delete-bin-7-line',
@@ -0,0 +1,27 @@
1
+ <%= turbo_frame_tag :new_store_credit_reason_modal do %>
2
+ <%= render component("ui/modal").new(title: t(".title")) do |modal| %>
3
+ <%= form_for @store_credit_reason, url: solidus_admin.store_credit_reasons_path, 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
+ <label class="flex gap-2 items-center">
7
+ <%= hidden_field_tag "#{f.object_name}[active]", "0" %>
8
+ <%= render component("ui/forms/checkbox").new(
9
+ name: "#{f.object_name}[active]",
10
+ value: "1",
11
+ checked: f.object.active
12
+ ) %>
13
+ <span class="font-semibold text-xs ml-2"><%= Spree::StoreCreditReason.human_attribute_name :active %></span>
14
+ <%= render component("ui/toggletip").new(text: t(".hints.active")) %>
15
+ </label>
16
+ </div>
17
+ <% modal.with_actions do %>
18
+ <form method="dialog">
19
+ <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
20
+ </form>
21
+ <%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
25
+ <% end %>
26
+
27
+ <%= render component("store_credit_reasons/index").new(page: @page) %>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::StoreCreditReasons::New::Component < SolidusAdmin::BaseComponent
4
+ def initialize(page:, store_credit_reason:)
5
+ @page = page
6
+ @store_credit_reason = store_credit_reason
7
+ end
8
+
9
+ def form_id
10
+ dom_id(@store_credit_reason, "#{stimulus_id}_new_store_credit_reason_form")
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ # Add your component translations here.
2
+ # Use the translation in the example in your template with `t(".hello")`.
3
+ en:
4
+ title: "New Store Credit Reason"
5
+ cancel: "Cancel"
6
+ submit: "Add Store Credit Reason"
7
+ hints:
8
+ active: "When checked, this store credit reason will be available for selection when adding store credit to orders."
@@ -29,7 +29,7 @@ class SolidusAdmin::Stores::Index::Component < SolidusAdmin::UI::Pages::Index::C
29
29
  def batch_actions
30
30
  [
31
31
  {
32
- display_name: t('.batch_actions.delete'),
32
+ label: t('.batch_actions.delete'),
33
33
  action: solidus_admin.stores_path,
34
34
  method: :delete,
35
35
  icon: 'delete-bin-7-line',
@@ -0,0 +1,28 @@
1
+ <%= turbo_frame_tag :edit_tax_category_modal do %>
2
+ <%= render component("ui/modal").new(title: t(".title")) do |modal| %>
3
+ <%= form_for @tax_category, url: solidus_admin.tax_category_path(@tax_category), 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) %>
6
+ <%= render component("ui/forms/field").text_field(f, :tax_code) %>
7
+ <%= render component("ui/forms/field").text_field(f, :description) %>
8
+ <label class="flex gap-2 items-center">
9
+ <%= render component("ui/forms/checkbox").new(
10
+ name: "#{f.object_name}[is_default]",
11
+ value: "1",
12
+ checked: f.object.is_default
13
+ ) %>
14
+ <span class="font-semibold text-xs ml-2"><%= Spree::TaxCategory.human_attribute_name :is_default %></span>
15
+ <%= render component("ui/toggletip").new(text: t(".hints.is_default")) %>
16
+ </label>
17
+ </div>
18
+ <% modal.with_actions do %>
19
+ <form method="dialog">
20
+ <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
21
+ </form>
22
+ <%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
23
+ <% end %>
24
+ <% end %>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <%= render component("tax_categories/index").new(page: @page) %>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::TaxCategories::Edit::Component < SolidusAdmin::TaxCategories::Index::Component
4
+ def initialize(page:, tax_category:)
5
+ @page = page
6
+ @tax_category = tax_category
7
+ end
8
+
9
+ def form_id
10
+ dom_id(@tax_category, "#{stimulus_id}_edit_tax_category_form")
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ # Add your component translations here.
2
+ # Use the translation in the example in your template with `t(".hello")`.
3
+ en:
4
+ title: "Edit Tax Category"
5
+ cancel: "Cancel"
6
+ submit: "Update Tax Category"
7
+ hints:
8
+ is_default: "When checked, this tax category will be selected by default when creating new products or variants."
@@ -2,7 +2,7 @@
2
2
 
3
3
  class SolidusAdmin::TaxCategories::Index::Component < SolidusAdmin::Taxes::Component
4
4
  def row_url(tax_category)
5
- spree.edit_admin_tax_category_path(tax_category)
5
+ spree.edit_admin_tax_category_path(tax_category, _turbo_frame: :edit_tax_category_modal)
6
6
  end
7
7
 
8
8
  def model_class
@@ -13,16 +13,23 @@ class SolidusAdmin::TaxCategories::Index::Component < SolidusAdmin::Taxes::Compo
13
13
  solidus_admin.tax_categories_path
14
14
  end
15
15
 
16
- def actions
16
+ def page_actions
17
17
  render component("ui/button").new(
18
18
  tag: :a,
19
19
  text: t('.add'),
20
- href: spree.new_admin_tax_category_path,
20
+ href: solidus_admin.new_tax_category_path, data: { turbo_frame: :new_tax_category_modal },
21
21
  icon: "add-line",
22
22
  class: "align-self-end w-full",
23
23
  )
24
24
  end
25
25
 
26
+ def turbo_frames
27
+ %w[
28
+ new_tax_category_modal
29
+ edit_tax_category_modal
30
+ ]
31
+ end
32
+
26
33
  def search_key
27
34
  :name_or_description_cont
28
35
  end
@@ -30,7 +37,7 @@ class SolidusAdmin::TaxCategories::Index::Component < SolidusAdmin::Taxes::Compo
30
37
  def batch_actions
31
38
  [
32
39
  {
33
- display_name: t('.batch_actions.delete'),
40
+ label: t('.batch_actions.delete'),
34
41
  action: solidus_admin.tax_categories_path,
35
42
  method: :delete,
36
43
  icon: 'delete-bin-7-line',