solidus_admin 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -7
  3. data/Rakefile +1 -0
  4. data/app/assets/builds/solidus_admin/tailwind.css +197 -162
  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 +26 -19
  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 +4 -1
  15. data/app/components/solidus_admin/option_types/index/component.rb +21 -7
  16. data/app/components/solidus_admin/orders/index/component.rb +28 -23
  17. data/app/components/solidus_admin/orders/index/component.yml +1 -1
  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 +29 -19
  34. data/app/components/solidus_admin/payment_methods/index/component.yml +0 -5
  35. data/app/components/solidus_admin/products/index/component.rb +25 -15
  36. data/app/components/solidus_admin/products/index/component.yml +0 -2
  37. data/app/components/solidus_admin/products/show/component.html.erb +14 -3
  38. data/app/components/solidus_admin/products/status/component.rb +4 -1
  39. data/app/components/solidus_admin/products/status/component.yml +1 -0
  40. data/app/components/solidus_admin/properties/index/component.rb +18 -19
  41. data/app/components/solidus_admin/refund_reasons/edit/component.html.erb +27 -0
  42. data/app/components/solidus_admin/refund_reasons/edit/component.rb +12 -0
  43. data/app/components/solidus_admin/refund_reasons/edit/component.yml +8 -0
  44. data/app/components/solidus_admin/refund_reasons/index/component.rb +26 -19
  45. data/app/components/solidus_admin/refund_reasons/new/component.html.erb +27 -0
  46. data/app/components/solidus_admin/refund_reasons/new/component.rb +12 -0
  47. data/app/components/solidus_admin/refund_reasons/new/component.yml +6 -0
  48. data/app/components/solidus_admin/refunds_and_returns/component.rb +33 -13
  49. data/app/components/solidus_admin/reimbursement_types/index/component.rb +7 -25
  50. data/app/components/solidus_admin/return_reasons/edit/component.html.erb +26 -0
  51. data/app/components/solidus_admin/return_reasons/edit/component.rb +12 -0
  52. data/app/components/solidus_admin/return_reasons/edit/component.yml +8 -0
  53. data/app/components/solidus_admin/return_reasons/index/component.rb +27 -19
  54. data/app/components/solidus_admin/return_reasons/new/component.html.erb +27 -0
  55. data/app/components/solidus_admin/return_reasons/new/component.rb +12 -0
  56. data/app/components/solidus_admin/return_reasons/new/component.yml +8 -0
  57. data/app/components/solidus_admin/roles/edit/component.html.erb +33 -0
  58. data/app/components/solidus_admin/roles/edit/component.rb +20 -0
  59. data/app/components/solidus_admin/roles/edit/component.yml +19 -0
  60. data/app/components/solidus_admin/roles/index/component.rb +70 -0
  61. data/app/components/solidus_admin/roles/index/component.yml +6 -0
  62. data/app/components/solidus_admin/roles/new/component.html.erb +33 -0
  63. data/app/components/solidus_admin/roles/new/component.rb +20 -0
  64. data/app/components/solidus_admin/roles/new/component.yml +19 -0
  65. data/app/components/solidus_admin/shipping/component.rb +23 -11
  66. data/app/components/solidus_admin/shipping_categories/edit/component.html.erb +16 -0
  67. data/app/components/solidus_admin/shipping_categories/edit/component.rb +12 -0
  68. data/app/components/solidus_admin/shipping_categories/edit/component.yml +6 -0
  69. data/app/components/solidus_admin/shipping_categories/index/component.rb +37 -20
  70. data/app/components/solidus_admin/shipping_categories/new/component.html.erb +17 -0
  71. data/app/components/solidus_admin/shipping_categories/new/component.rb +12 -0
  72. data/app/components/solidus_admin/shipping_categories/new/component.yml +6 -0
  73. data/app/components/solidus_admin/shipping_methods/index/component.rb +19 -19
  74. data/app/components/solidus_admin/stock_items/edit/component.html.erb +66 -72
  75. data/app/components/solidus_admin/stock_items/edit/component.rb +0 -5
  76. data/app/components/solidus_admin/stock_items/index/component.rb +13 -20
  77. data/app/components/solidus_admin/stock_locations/index/component.rb +19 -11
  78. data/app/components/solidus_admin/stock_locations/index/component.yml +0 -3
  79. data/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb +26 -0
  80. data/app/components/solidus_admin/store_credit_reasons/edit/component.rb +12 -0
  81. data/app/components/solidus_admin/store_credit_reasons/edit/component.yml +8 -0
  82. data/app/components/solidus_admin/store_credit_reasons/index/component.rb +26 -19
  83. data/app/components/solidus_admin/store_credit_reasons/new/component.html.erb +27 -0
  84. data/app/components/solidus_admin/store_credit_reasons/new/component.rb +12 -0
  85. data/app/components/solidus_admin/store_credit_reasons/new/component.yml +8 -0
  86. data/app/components/solidus_admin/stores/index/component.rb +18 -19
  87. data/app/components/solidus_admin/tax_categories/edit/component.html.erb +28 -0
  88. data/app/components/solidus_admin/tax_categories/edit/component.rb +12 -0
  89. data/app/components/solidus_admin/tax_categories/edit/component.yml +8 -0
  90. data/app/components/solidus_admin/tax_categories/index/component.rb +28 -21
  91. data/app/components/solidus_admin/tax_categories/new/component.html.erb +28 -0
  92. data/app/components/solidus_admin/tax_categories/new/component.rb +12 -0
  93. data/app/components/solidus_admin/tax_categories/new/component.yml +8 -0
  94. data/app/components/solidus_admin/tax_rates/index/component.rb +21 -17
  95. data/app/components/solidus_admin/taxes/component.rb +8 -8
  96. data/app/components/solidus_admin/taxonomies/index/component.rb +18 -12
  97. data/app/components/solidus_admin/ui/button/component.rb +1 -1
  98. data/app/components/solidus_admin/ui/checkbox_row/component.html.erb +29 -0
  99. data/app/components/solidus_admin/ui/checkbox_row/component.rb +11 -0
  100. data/app/components/solidus_admin/ui/forms/address/component.html.erb +27 -9
  101. data/app/components/solidus_admin/ui/forms/address/component.js +38 -13
  102. data/app/components/solidus_admin/ui/forms/search/component.html.erb +2 -3
  103. data/app/components/solidus_admin/ui/forms/search/component.js +3 -3
  104. data/app/components/solidus_admin/ui/modal/component.html.erb +7 -7
  105. data/app/components/solidus_admin/ui/modal/component.js +7 -0
  106. data/app/components/solidus_admin/ui/modal/component.rb +1 -1
  107. data/app/components/solidus_admin/ui/pages/index/component.html.erb +44 -0
  108. data/app/components/solidus_admin/ui/pages/index/component.rb +105 -0
  109. data/app/components/solidus_admin/ui/panel/component.html.erb +5 -16
  110. data/app/components/solidus_admin/ui/panel/component.rb +11 -7
  111. data/app/components/solidus_admin/ui/table/component.html.erb +2 -1
  112. data/app/components/solidus_admin/ui/table/component.js +31 -2
  113. data/app/components/solidus_admin/ui/table/component.rb +24 -8
  114. data/app/components/solidus_admin/ui/table/component.yml +1 -0
  115. data/app/components/solidus_admin/ui/thumbnail/component.rb +1 -1
  116. data/app/components/solidus_admin/ui/thumbnail_with_caption/component.html.erb +17 -0
  117. data/app/components/solidus_admin/ui/thumbnail_with_caption/component.rb +15 -0
  118. data/app/components/solidus_admin/users/addresses/component.html.erb +46 -0
  119. data/app/components/solidus_admin/users/addresses/component.rb +61 -0
  120. data/app/components/solidus_admin/users/addresses/component.yml +14 -0
  121. data/app/components/solidus_admin/users/edit/api_access/component.html.erb +49 -0
  122. data/app/components/solidus_admin/users/edit/api_access/component.js +9 -0
  123. data/app/components/solidus_admin/users/edit/api_access/component.rb +7 -0
  124. data/app/components/solidus_admin/users/edit/api_access/component.yml +10 -0
  125. data/app/components/solidus_admin/users/edit/component.html.erb +52 -0
  126. data/app/components/solidus_admin/users/edit/component.rb +51 -0
  127. data/app/components/solidus_admin/users/edit/component.yml +12 -0
  128. data/app/components/solidus_admin/users/index/component.rb +25 -16
  129. data/app/components/solidus_admin/users/index/component.yml +0 -3
  130. data/app/components/solidus_admin/users/items/component.html.erb +41 -0
  131. data/app/components/solidus_admin/users/items/component.rb +170 -0
  132. data/app/components/solidus_admin/users/items/component.yml +16 -0
  133. data/app/components/solidus_admin/users/orders/component.html.erb +42 -0
  134. data/app/components/solidus_admin/users/orders/component.rb +131 -0
  135. data/app/components/solidus_admin/users/orders/component.yml +12 -0
  136. data/app/components/solidus_admin/users/stats/component.html.erb +11 -0
  137. data/app/components/solidus_admin/users/stats/component.rb +9 -0
  138. data/app/components/solidus_admin/users/stats/component.yml +2 -0
  139. data/app/components/solidus_admin/users_and_roles/component.rb +24 -0
  140. data/app/components/solidus_admin/users_and_roles/component.yml +2 -0
  141. data/app/components/solidus_admin/zones/index/component.rb +19 -11
  142. data/app/controllers/solidus_admin/addresses_controller.rb +6 -1
  143. data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +85 -10
  144. data/app/controllers/solidus_admin/adjustments_controller.rb +57 -0
  145. data/app/controllers/solidus_admin/customers_controller.rb +5 -1
  146. data/app/controllers/solidus_admin/orders_controller.rb +5 -1
  147. data/app/controllers/solidus_admin/products_controller.rb +11 -0
  148. data/app/controllers/solidus_admin/properties_controller.rb +1 -1
  149. data/app/controllers/solidus_admin/refund_reasons_controller.rb +85 -10
  150. data/app/controllers/solidus_admin/reimbursement_types_controller.rb +0 -5
  151. data/app/controllers/solidus_admin/return_reasons_controller.rb +85 -10
  152. data/app/controllers/solidus_admin/roles_controller.rb +118 -0
  153. data/app/controllers/solidus_admin/shipping_categories_controller.rb +87 -10
  154. data/app/controllers/solidus_admin/shipping_methods_controller.rb +0 -5
  155. data/app/controllers/solidus_admin/stock_items_controller.rb +6 -6
  156. data/app/controllers/solidus_admin/stock_locations_controller.rb +0 -5
  157. data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +85 -10
  158. data/app/controllers/solidus_admin/stores_controller.rb +0 -5
  159. data/app/controllers/solidus_admin/tax_categories_controller.rb +89 -10
  160. data/app/controllers/solidus_admin/tax_rates_controller.rb +0 -5
  161. data/app/controllers/solidus_admin/users_controller.rb +85 -6
  162. data/app/controllers/solidus_admin/zones_controller.rb +0 -5
  163. data/app/helpers/solidus_admin/last_login_helper.rb +16 -0
  164. data/app/helpers/solidus_admin/permission_sets_helper.rb +32 -0
  165. data/app/views/layouts/solidus_admin/application.html.erb +2 -1
  166. data/app/views/layouts/solidus_admin/preview.html.erb +2 -0
  167. data/config/initializers/view_component.rb +1 -1
  168. data/config/locales/adjustment_reasons.en.yml +5 -1
  169. data/config/locales/adjustments.en.yml +10 -0
  170. data/config/locales/refund_reasons.en.yml +10 -0
  171. data/config/locales/return_reasons.en.yml +5 -1
  172. data/config/locales/roles.en.yml +10 -0
  173. data/config/locales/shipping_categories.en.yml +4 -0
  174. data/config/locales/store_credit_reasons.en.yml +5 -1
  175. data/config/locales/tax_categories.en.yml +4 -0
  176. data/config/locales/users.en.yml +10 -0
  177. data/config/routes.rb +24 -7
  178. data/docs/components.md +109 -0
  179. data/docs/{customizing_view_components.md → customizing_components.md} +2 -7
  180. data/docs/index_pages.md +146 -0
  181. data/docs/{customizing_menu_items.md → menu_items.md} +1 -1
  182. data/docs/stimulusjs.md +85 -0
  183. data/docs/{customizing_tailwindcss.md → tailwindcss.md} +27 -8
  184. data/lib/solidus_admin/component_registry.rb +40 -0
  185. data/lib/solidus_admin/configuration.rb +5 -27
  186. data/lib/solidus_admin/install_tailwindcss.rb +3 -1
  187. data/lib/solidus_admin/testing_support/admin_assets.rb +10 -0
  188. data/lib/solidus_admin/testing_support/component_helpers.rb +27 -0
  189. data/lib/solidus_admin/testing_support/dummy_app/rake_tasks.rb +60 -0
  190. data/lib/solidus_admin/testing_support/feature_helpers.rb +34 -0
  191. data/lib/solidus_admin/version.rb +1 -1
  192. data/solidus_admin.gemspec +7 -3
  193. metadata +111 -59
  194. data/app/components/solidus_admin/adjustment_reasons/index/component.html.erb +0 -32
  195. data/app/components/solidus_admin/adjustment_reasons/index/component.yml +0 -4
  196. data/app/components/solidus_admin/option_types/index/component.html.erb +0 -30
  197. data/app/components/solidus_admin/orders/index/component.html.erb +0 -35
  198. data/app/components/solidus_admin/payment_methods/index/component.html.erb +0 -38
  199. data/app/components/solidus_admin/products/index/component.html.erb +0 -34
  200. data/app/components/solidus_admin/promotion_categories/index/component.html.erb +0 -26
  201. data/app/components/solidus_admin/promotion_categories/index/component.rb +0 -57
  202. data/app/components/solidus_admin/promotion_categories/index/component.yml +0 -4
  203. data/app/components/solidus_admin/promotions/index/component.html.erb +0 -34
  204. data/app/components/solidus_admin/promotions/index/component.rb +0 -97
  205. data/app/components/solidus_admin/promotions/index/component.yml +0 -14
  206. data/app/components/solidus_admin/properties/index/component.html.erb +0 -34
  207. data/app/components/solidus_admin/properties/index/component.yml +0 -4
  208. data/app/components/solidus_admin/refund_reasons/index/component.html.erb +0 -31
  209. data/app/components/solidus_admin/refund_reasons/index/component.yml +0 -4
  210. data/app/components/solidus_admin/refunds_and_returns/component.html.erb +0 -26
  211. data/app/components/solidus_admin/reimbursement_types/index/component.html.erb +0 -22
  212. data/app/components/solidus_admin/reimbursement_types/index/component.yml +0 -4
  213. data/app/components/solidus_admin/return_reasons/index/component.html.erb +0 -31
  214. data/app/components/solidus_admin/return_reasons/index/component.yml +0 -4
  215. data/app/components/solidus_admin/shipping/component.html.erb +0 -30
  216. data/app/components/solidus_admin/shipping_categories/index/component.html.erb +0 -32
  217. data/app/components/solidus_admin/shipping_categories/index/component.yml +0 -4
  218. data/app/components/solidus_admin/shipping_methods/index/component.html.erb +0 -32
  219. data/app/components/solidus_admin/shipping_methods/index/component.yml +0 -4
  220. data/app/components/solidus_admin/stock_items/index/component.html.erb +0 -26
  221. data/app/components/solidus_admin/stock_locations/index/component.html.erb +0 -32
  222. data/app/components/solidus_admin/store_credit_reasons/index/component.html.erb +0 -31
  223. data/app/components/solidus_admin/store_credit_reasons/index/component.yml +0 -4
  224. data/app/components/solidus_admin/stores/index/component.html.erb +0 -34
  225. data/app/components/solidus_admin/stores/index/component.yml +0 -4
  226. data/app/components/solidus_admin/tax_categories/index/component.html.erb +0 -32
  227. data/app/components/solidus_admin/tax_categories/index/component.yml +0 -6
  228. data/app/components/solidus_admin/tax_rates/index/component.html.erb +0 -32
  229. data/app/components/solidus_admin/tax_rates/index/component.yml +0 -4
  230. data/app/components/solidus_admin/taxes/component.html.erb +0 -24
  231. data/app/components/solidus_admin/taxonomies/index/component.html.erb +0 -28
  232. data/app/components/solidus_admin/taxonomies/index/component.yml +0 -4
  233. data/app/components/solidus_admin/users/index/component.html.erb +0 -34
  234. data/app/components/solidus_admin/zones/index/component.html.erb +0 -35
  235. data/app/components/solidus_admin/zones/index/component.yml +0 -4
  236. data/app/controllers/solidus_admin/promotion_categories_controller.rb +0 -38
  237. data/app/controllers/solidus_admin/promotions_controller.rb +0 -46
  238. data/config/locales/promotion_categories.en.yml +0 -6
  239. data/config/locales/promotions.en.yml +0 -6
  240. data/config/locales/refund_reasons_.en.yml +0 -6
  241. /data/app/components/solidus_admin/{option_types → ui/pages}/index/component.yml +0 -0
@@ -1,35 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title title %>
4
- <%= page_header_actions do %>
5
- <%= render component("ui/button").new(
6
- tag: :a,
7
- text: t('.create_order'),
8
- href: spree.new_admin_order_path,
9
- icon: "add-line",
10
- ) %>
11
- <% end %>
12
- <% end %>
13
-
14
- <%= render component('ui/table').new(
15
- id: stimulus_id,
16
- data: {
17
- class: Spree::Order,
18
- rows: @page.records,
19
- fade: row_fade,
20
- url: ->(order) { spree.edit_admin_order_path(order) },
21
- batch_actions: batch_actions,
22
- columns: columns,
23
- prev: prev_page_path,
24
- next: next_page_path,
25
- },
26
- search: {
27
- name: :q,
28
- value: params[:q],
29
- searchbar_key: :number_or_shipments_number_or_bill_address_name_or_email_cont,
30
- url: solidus_admin.orders_path(scope: params[:scope]),
31
- scopes: scopes,
32
- filters: filters,
33
- },
34
- ) %>
35
- <% end %>
@@ -1,38 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title title %>
4
- <%= page_header_actions do %>
5
- <%= render component("ui/button").new(
6
- tag: :a,
7
- text: t('.add'),
8
- href: spree.new_admin_payment_method_path,
9
- icon: "add-line",
10
- ) %>
11
- <% end %>
12
- <% end %>
13
-
14
- <%= render component('ui/table').new(
15
- id: stimulus_id,
16
- data: {
17
- class: Spree::PaymentMethod,
18
- rows: @page.records,
19
- prev: prev_page_path,
20
- next: next_page_path,
21
- url: ->(payment_method) { spree.edit_admin_payment_method_path(payment_method) },
22
- columns: columns,
23
- batch_actions: batch_actions,
24
- },
25
- search: {
26
- name: :q,
27
- value: params[:q],
28
- url: solidus_admin.payment_methods_path,
29
- searchbar_key: :name_or_description_cont,
30
- scopes: scopes,
31
- filters: filters,
32
- },
33
- sortable: {
34
- url: ->(payment_method) { solidus_admin.move_payment_method_path(payment_method) },
35
- param: 'position',
36
- },
37
- ) %>
38
- <% end %>
@@ -1,34 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title title %>
4
- <%= page_header_actions do %>
5
- <%= render component("ui/button").new(
6
- tag: :a,
7
- text: t('.add'),
8
- href: spree.new_admin_product_path,
9
- icon: "add-line",
10
- ) %>
11
- <% end %>
12
- <% end %>
13
-
14
- <%= render component('ui/table').new(
15
- id: stimulus_id,
16
- data: {
17
- class: Spree::Product,
18
- rows: @page.records,
19
- url: ->(product) { solidus_admin.product_path(product) },
20
- prev: prev_page_path,
21
- next: next_page_path,
22
- columns: columns,
23
- batch_actions: batch_actions,
24
- },
25
- search: {
26
- name: :q,
27
- value: params[:q],
28
- url: solidus_admin.products_path,
29
- searchbar_key: :name_or_variants_including_master_sku_cont,
30
- scopes: scopes,
31
- filters: filters,
32
- },
33
- ) %>
34
- <% end %>
@@ -1,26 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title title %>
4
- <%= page_header_actions do %>
5
- <%= render component("ui/button").new(
6
- tag: :a,
7
- text: t('.add'),
8
- href: spree.new_admin_promotion_category_path,
9
- icon: "add-line",
10
- ) %>
11
- <% end %>
12
- <% end %>
13
-
14
- <%= render component('ui/table').new(
15
- id: stimulus_id,
16
- data: {
17
- class: Spree::PromotionCategory,
18
- rows: @page.records,
19
- url: ->(promotion_category) { spree.edit_admin_promotion_category_path(promotion_category) },
20
- prev: prev_page_path,
21
- next: next_page_path,
22
- columns: columns,
23
- batch_actions: batch_actions,
24
- },
25
- ) %>
26
- <% end %>
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class SolidusAdmin::PromotionCategories::Index::Component < SolidusAdmin::BaseComponent
4
- include SolidusAdmin::Layout::PageHelpers
5
-
6
- def initialize(page:)
7
- @page = page
8
- end
9
-
10
- def title
11
- Spree::PromotionCategory.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
- [
24
- {
25
- display_name: t('.batch_actions.delete'),
26
- action: solidus_admin.promotion_categories_path,
27
- method: :delete,
28
- icon: 'delete-bin-7-line',
29
- },
30
- ]
31
- end
32
-
33
- def columns
34
- [
35
- name_column,
36
- code_column,
37
- ]
38
- end
39
-
40
- def name_column
41
- {
42
- header: :name,
43
- data: ->(promotion_category) do
44
- content_tag :div, promotion_category.name
45
- end
46
- }
47
- end
48
-
49
- def code_column
50
- {
51
- header: :code,
52
- data: ->(promotion_category) do
53
- content_tag :div, promotion_category.code
54
- end
55
- }
56
- end
57
- end
@@ -1,4 +0,0 @@
1
- en:
2
- batch_actions:
3
- delete: 'Delete'
4
- add: 'Add new'
@@ -1,34 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title title %>
4
- <%= page_header_actions do %>
5
- <%= render component("ui/button").new(
6
- tag: :a,
7
- text: t('.add'),
8
- href: spree.new_admin_promotion_path,
9
- icon: "add-line",
10
- ) %>
11
- <% end %>
12
- <% end %>
13
-
14
- <%= render component('ui/table').new(
15
- id: stimulus_id,
16
- data: {
17
- class: Spree::Promotion,
18
- rows: @page.records,
19
- url: ->(promotion) { spree.admin_promotion_path(promotion) },
20
- prev: prev_page_path,
21
- next: next_page_path,
22
- columns: columns,
23
- batch_actions: batch_actions,
24
- },
25
- search: {
26
- name: :q,
27
- value: params[:q],
28
- url: solidus_admin.promotions_path,
29
- searchbar_key: :name_or_codes_value_or_path_or_description_cont,
30
- scopes: scopes,
31
- filters: filters,
32
- },
33
- ) %>
34
- <% end %>
@@ -1,97 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class SolidusAdmin::Promotions::Index::Component < SolidusAdmin::BaseComponent
4
- include SolidusAdmin::Layout::PageHelpers
5
-
6
- def initialize(page:)
7
- @page = page
8
- end
9
-
10
- def title
11
- Spree::Promotion.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
- [
24
- {
25
- display_name: t('.batch_actions.delete'),
26
- action: solidus_admin.promotions_path,
27
- method: :delete,
28
- icon: 'delete-bin-7-line',
29
- },
30
- ]
31
- end
32
-
33
- def scopes
34
- [
35
- { name: :active, label: t('.scopes.active'), default: true },
36
- { name: :draft, label: t('.scopes.draft') },
37
- { name: :future, label: t('.scopes.future') },
38
- { name: :expired, label: t('.scopes.expired') },
39
- { name: :all, label: t('.scopes.all') },
40
- ]
41
- end
42
-
43
- def filters
44
- [
45
- {
46
- presentation: Spree::PromotionCategory.model_name.human.pluralize,
47
- attribute: "promotion_category_id",
48
- predicate: "in",
49
- options: Spree::PromotionCategory.pluck(:name, :id)
50
- }
51
- ]
52
- end
53
-
54
- def columns
55
- [
56
- {
57
- header: :name,
58
- data: ->(promotion) do
59
- content_tag :div, promotion.name
60
- end
61
- },
62
- {
63
- header: :code,
64
- data: ->(promotion) do
65
- count = promotion.codes.count
66
- (count == 1) ? promotion.codes.pick(:value) : t('spree.number_of_codes', count: count)
67
- end
68
- },
69
- {
70
- header: :status,
71
- data: ->(promotion) do
72
- if promotion.active?
73
- render component('ui/badge').new(name: t('.status.active'), color: :green)
74
- else
75
- render component('ui/badge').new(name: t('.status.inactive'), color: :graphite_light)
76
- end
77
- end
78
- },
79
- {
80
- header: :usage_limit,
81
- data: ->(promotion) { promotion.usage_limit || icon_tag('infinity-line') }
82
- },
83
- {
84
- header: :uses,
85
- data: ->(promotion) { promotion.usage_count }
86
- },
87
- {
88
- header: :starts_at,
89
- data: ->(promotion) { promotion.starts_at ? l(promotion.starts_at, format: :long) : icon_tag('infinity-line') }
90
- },
91
- {
92
- header: :expires_at,
93
- data: ->(promotion) { promotion.expires_at ? l(promotion.expires_at, format: :long) : icon_tag('infinity-line') }
94
- },
95
- ]
96
- end
97
- end
@@ -1,14 +0,0 @@
1
- en:
2
- promotion_image: 'Image'
3
- add: 'Add new'
4
- batch_actions:
5
- delete: 'Delete'
6
- scopes:
7
- active: Active
8
- draft: Draft
9
- future: Future
10
- expired: Expired
11
- all: All
12
- status:
13
- active: Active
14
- inactive: Inactive
@@ -1,34 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title title %>
4
- <%= page_header_actions do %>
5
- <%= render component("ui/button").new(
6
- tag: :a,
7
- text: t('.add'),
8
- href: spree.new_admin_property_path,
9
- icon: "add-line",
10
- ) %>
11
- <% end %>
12
- <% end %>
13
-
14
- <%= render component('ui/table').new(
15
- id: stimulus_id,
16
- data: {
17
- class: Spree::Property,
18
- rows: @page.records,
19
- url: ->(property) { solidus_admin.properties_path(property) },
20
- prev: prev_page_path,
21
- next: next_page_path,
22
- columns: columns,
23
- batch_actions: batch_actions,
24
- },
25
- search: {
26
- name: :q,
27
- value: params[:q],
28
- url: solidus_admin.properties_path,
29
- searchbar_key: :name_cont,
30
- scopes: scopes,
31
- filters: filters,
32
- },
33
- ) %>
34
- <% end %>
@@ -1,4 +0,0 @@
1
- en:
2
- add: 'Add new'
3
- batch_actions:
4
- delete: 'Delete'
@@ -1,31 +0,0 @@
1
- <%= render component('refunds_and_returns').new(current_class: Spree::RefundReason) do |layout| %>
2
- <% layout.with_actions do %>
3
- <%= render component("ui/button").new(
4
- tag: :a,
5
- text: t('.add'),
6
- href: spree.new_admin_refund_reason_path,
7
- icon: "add-line",
8
- class: "align-self-end w-full",
9
- ) %>
10
- <% end %>
11
- <%= render component('ui/table').new(
12
- id: stimulus_id,
13
- data: {
14
- class: Spree::RefundReason,
15
- rows: @page.records,
16
- url: ->(refund_reason) { spree.edit_admin_refund_reason_path(refund_reason) },
17
- prev: prev_page_path,
18
- next: next_page_path,
19
- columns: columns,
20
- batch_actions: batch_actions,
21
- },
22
- search: {
23
- name: :q,
24
- value: params[:q],
25
- url: solidus_admin.refund_reasons_path,
26
- searchbar_key: :name_or_code_cont,
27
- scopes: scopes,
28
- filters: filters,
29
- },
30
- ) %>
31
- <% end %>
@@ -1,4 +0,0 @@
1
- en:
2
- add: 'Add new'
3
- batch_actions:
4
- delete: 'Delete'
@@ -1,26 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title safe_join([
4
- tag.div(t(".title")),
5
- tag.div(t(".subtitle"), class: "font-normal text-sm text-gray-500"),
6
- ]) %>
7
- <% end %>
8
- <%= page_header do %>
9
- <% title = capture do %>
10
- <% tabs.each do |tab_class, href|%>
11
- <%= render component('ui/button').new(
12
- tag: :a,
13
- scheme: :ghost,
14
- href: href,
15
- text: tab_class.model_name.human.pluralize,
16
- "aria-current" => tab_class == @current_class,
17
- ) %>
18
- <% end %>
19
- <% end %>
20
- <%= page_header_title title %>
21
- <%= page_header_actions do %>
22
- <%= actions %>
23
- <% end %>
24
- <% end %>
25
- <%= content %>
26
- <% end %>
@@ -1,22 +0,0 @@
1
- <%= render component('refunds_and_returns').new(current_class: Spree::ReimbursementType) do |layout| %>
2
- <%= render component('ui/table').new(
3
- id: stimulus_id,
4
- data: {
5
- class: Spree::ReimbursementType,
6
- rows: @page.records,
7
- url: nil,
8
- prev: prev_page_path,
9
- next: next_page_path,
10
- columns: columns,
11
- batch_actions: batch_actions,
12
- },
13
- search: {
14
- name: :q,
15
- value: params[:q],
16
- url: solidus_admin.reimbursement_types_path,
17
- searchbar_key: :name_cont,
18
- scopes: scopes,
19
- filters: filters,
20
- },
21
- ) %>
22
- <% end %>
@@ -1,4 +0,0 @@
1
- en:
2
- add: 'Add new'
3
- batch_actions:
4
- delete: 'Delete'
@@ -1,31 +0,0 @@
1
- <%= render component('refunds_and_returns').new(current_class: Spree::ReturnReason) do |layout| %>
2
- <% layout.with_actions do %>
3
- <%= render component("ui/button").new(
4
- tag: :a,
5
- text: t('.add'),
6
- href: spree.new_admin_return_reason_path,
7
- icon: "add-line",
8
- class: "align-self-end w-full",
9
- ) %>
10
- <% end %>
11
- <%= render component('ui/table').new(
12
- id: stimulus_id,
13
- data: {
14
- class: Spree::ReturnReason,
15
- rows: @page.records,
16
- url: ->(return_reason) { spree.edit_admin_return_reason_path(return_reason) },
17
- prev: prev_page_path,
18
- next: next_page_path,
19
- columns: columns,
20
- batch_actions: batch_actions,
21
- },
22
- search: {
23
- name: :q,
24
- value: params[:q],
25
- url: solidus_admin.return_reasons_path,
26
- searchbar_key: :name_cont,
27
- scopes: scopes,
28
- filters: filters,
29
- },
30
- ) %>
31
- <% end %>
@@ -1,4 +0,0 @@
1
- en:
2
- add: 'Add new'
3
- batch_actions:
4
- delete: 'Delete'
@@ -1,30 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title safe_join([
4
- tag.div(t(".title")),
5
- tag.div(t(".subtitle"), class: "font-normal text-sm text-gray-500"),
6
- ]) %>
7
- <% end %>
8
-
9
- <%= page_header do %>
10
- <% title = capture do %>
11
- <% tabs.each do |tab_class, href|%>
12
- <%= render component('ui/button').new(
13
- tag: :a,
14
- scheme: :ghost,
15
- href: href,
16
- text: tab_class.model_name.human.pluralize,
17
- "aria-current" => tab_class == @current_class,
18
- ) %>
19
- <% end %>
20
- <% end %>
21
-
22
- <%= page_header_title title %>
23
-
24
- <%= page_header_actions do %>
25
- <%= actions %>
26
- <% end %>
27
- <% end %>
28
-
29
- <%= content %>
30
- <% end %>
@@ -1,32 +0,0 @@
1
- <%= render component('shipping').new(current_class: Spree::ShippingCategory) do |layout| %>
2
- <% layout.with_actions do %>
3
- <%= render component("ui/button").new(
4
- tag: :a,
5
- text: t('.add'),
6
- href: spree.new_admin_shipping_category_path,
7
- icon: "add-line",
8
- class: "align-self-end w-full",
9
- ) %>
10
- <% end %>
11
-
12
- <%= render component('ui/table').new(
13
- id: stimulus_id,
14
- data: {
15
- class: Spree::ShippingCategory,
16
- rows: @page.records,
17
- url: ->(shipping_category) { spree.edit_admin_shipping_category_path(shipping_category) },
18
- prev: prev_page_path,
19
- next: next_page_path,
20
- columns: columns,
21
- batch_actions: batch_actions,
22
- },
23
- search: {
24
- name: :q,
25
- value: params[:q],
26
- url: solidus_admin.shipping_categories_path,
27
- searchbar_key: :name_or_description_cont,
28
- scopes: scopes,
29
- filters: filters,
30
- },
31
- ) %>
32
- <% end %>
@@ -1,4 +0,0 @@
1
- en:
2
- add: 'Add new'
3
- batch_actions:
4
- delete: 'Delete'
@@ -1,32 +0,0 @@
1
- <%= render component('shipping').new(current_class: Spree::ShippingMethod) do |layout| %>
2
- <% layout.with_actions do %>
3
- <%= render component("ui/button").new(
4
- tag: :a,
5
- text: t('.add'),
6
- href: spree.new_admin_shipping_method_path,
7
- icon: "add-line",
8
- class: "align-self-end w-full",
9
- ) %>
10
- <% end %>
11
-
12
- <%= render component('ui/table').new(
13
- id: stimulus_id,
14
- data: {
15
- class: Spree::ShippingMethod,
16
- rows: @page.records,
17
- url: ->(shipping_method) { spree.edit_admin_shipping_method_path(shipping_method) },
18
- prev: prev_page_path,
19
- next: next_page_path,
20
- columns: columns,
21
- batch_actions: batch_actions,
22
- },
23
- search: {
24
- name: :q,
25
- value: params[:q],
26
- url: solidus_admin.shipping_methods_path,
27
- searchbar_key: :name_or_description_cont,
28
- scopes: scopes,
29
- filters: filters,
30
- },
31
- ) %>
32
- <% end %>
@@ -1,4 +0,0 @@
1
- en:
2
- add: 'Add new'
3
- batch_actions:
4
- delete: 'Delete'
@@ -1,26 +0,0 @@
1
- <%= page do %>
2
- <%= page_header do %>
3
- <%= page_header_title title %>
4
- <% end %>
5
-
6
- <%= render component('ui/table').new(
7
- id: stimulus_id,
8
- data: {
9
- class: Spree::StockItem,
10
- rows: @page.records,
11
- prev: prev_page_path,
12
- next: next_page_path,
13
- columns: columns,
14
- batch_actions: batch_actions,
15
- url: -> { solidus_admin.edit_stock_item_path(_1, page: params[:page], q: permitted_query_params) },
16
- },
17
- search: {
18
- name: :q,
19
- value: permitted_query_params,
20
- url: solidus_admin.stock_items_path,
21
- searchbar_key: :variant_product_name_or_variant_sku_or_variant_option_values_name_or_variant_option_values_presentation_cont,
22
- scopes: scopes,
23
- filters: filters,
24
- },
25
- ) %>
26
- <% end %>