solidus_admin 0.0.1 → 0.1.0

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 (285) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.json +7 -0
  3. data/README.md +1 -1
  4. data/Rakefile +26 -0
  5. data/app/assets/builds/.keep +0 -0
  6. data/app/assets/builds/solidus_admin/tailwind.css +2799 -0
  7. data/app/assets/config/solidus_admin_manifest.js +1 -0
  8. data/app/assets/stylesheets/solidus_admin/application.tailwind.css +4 -0
  9. data/app/assets/stylesheets/solidus_admin/dark.css +12 -0
  10. data/app/assets/stylesheets/solidus_admin/dimmed.css +11 -0
  11. data/app/components/solidus_admin/adjustment_reasons/index/component.html.erb +32 -0
  12. data/app/components/solidus_admin/adjustment_reasons/index/component.rb +53 -0
  13. data/app/components/solidus_admin/adjustment_reasons/index/component.yml +4 -0
  14. data/app/components/solidus_admin/layout/feedback/component.html.erb +15 -0
  15. data/app/components/solidus_admin/layout/feedback/component.rb +4 -0
  16. data/app/components/solidus_admin/layout/feedback/component.yml +3 -0
  17. data/app/components/solidus_admin/layout/navigation/account/component.html.erb +74 -0
  18. data/app/components/solidus_admin/layout/navigation/account/component.js +16 -0
  19. data/app/components/solidus_admin/layout/navigation/account/component.rb +36 -0
  20. data/app/components/solidus_admin/{sidebar → layout/navigation}/component.html.erb +9 -9
  21. data/app/components/solidus_admin/layout/navigation/component.rb +26 -0
  22. data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.html.erb +5 -5
  23. data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.rb +2 -2
  24. data/app/components/solidus_admin/layout/page_helpers.rb +55 -0
  25. data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.rb +2 -4
  26. data/app/components/solidus_admin/option_types/index/component.html.erb +30 -0
  27. data/app/components/solidus_admin/option_types/index/component.rb +57 -0
  28. data/app/components/solidus_admin/option_types/index/component.yml +4 -0
  29. data/app/components/solidus_admin/orders/cart/component.html.erb +77 -0
  30. data/app/components/solidus_admin/orders/cart/component.js +37 -0
  31. data/app/components/solidus_admin/orders/cart/component.rb +7 -0
  32. data/app/components/solidus_admin/orders/cart/component.yml +3 -0
  33. data/app/components/solidus_admin/orders/cart/result/component.html.erb +26 -0
  34. data/app/components/solidus_admin/orders/cart/result/component.rb +11 -0
  35. data/app/components/solidus_admin/orders/index/component.html.erb +26 -22
  36. data/app/components/solidus_admin/orders/index/component.rb +80 -16
  37. data/app/components/solidus_admin/orders/index/component.yml +10 -3
  38. data/app/components/solidus_admin/orders/show/address/component.html.erb +67 -0
  39. data/app/components/solidus_admin/orders/show/address/component.js +9 -0
  40. data/app/components/solidus_admin/orders/show/address/component.rb +53 -0
  41. data/app/components/solidus_admin/orders/show/address/component.yml +14 -0
  42. data/app/components/solidus_admin/orders/show/component.html.erb +76 -0
  43. data/app/components/solidus_admin/orders/show/component.js +7 -0
  44. data/app/components/solidus_admin/orders/show/component.rb +40 -0
  45. data/app/components/solidus_admin/orders/show/component.yml +21 -0
  46. data/app/components/solidus_admin/orders/show/customer_search/component.html.erb +14 -0
  47. data/app/components/solidus_admin/orders/show/customer_search/component.js +14 -0
  48. data/app/components/solidus_admin/orders/show/customer_search/component.rb +7 -0
  49. data/app/components/solidus_admin/orders/show/customer_search/component.yml +2 -0
  50. data/app/components/solidus_admin/orders/show/customer_search/result/component.html.erb +17 -0
  51. data/app/components/solidus_admin/orders/show/customer_search/result/component.rb +11 -0
  52. data/app/components/solidus_admin/orders/show/email/component.html.erb +18 -0
  53. data/app/components/solidus_admin/orders/show/email/component.rb +15 -0
  54. data/app/components/solidus_admin/orders/show/email/component.yml +8 -0
  55. data/app/components/solidus_admin/orders/show/summary/component.html.erb +14 -0
  56. data/app/components/solidus_admin/orders/show/summary/component.rb +7 -0
  57. data/app/components/solidus_admin/orders/show/summary/component.yml +8 -0
  58. data/app/components/solidus_admin/payment_methods/index/component.html.erb +38 -0
  59. data/app/components/solidus_admin/payment_methods/index/component.rb +93 -0
  60. data/app/components/solidus_admin/payment_methods/index/component.yml +15 -0
  61. data/app/components/solidus_admin/products/index/component.html.erb +26 -22
  62. data/app/components/solidus_admin/products/index/component.rb +36 -36
  63. data/app/components/solidus_admin/products/index/component.yml +9 -6
  64. data/app/components/solidus_admin/products/show/component.html.erb +32 -38
  65. data/app/components/solidus_admin/products/show/component.rb +2 -0
  66. data/app/components/solidus_admin/products/show/component.yml +5 -5
  67. data/app/components/solidus_admin/products/status/component.rb +20 -18
  68. data/app/components/solidus_admin/products/status/component.yml +1 -0
  69. data/app/components/solidus_admin/products/stock/component.rb +38 -0
  70. data/app/components/solidus_admin/products/stock/component.yml +5 -0
  71. data/app/components/solidus_admin/promotion_categories/index/component.html.erb +26 -0
  72. data/app/components/solidus_admin/promotion_categories/index/component.rb +57 -0
  73. data/app/components/solidus_admin/promotion_categories/index/component.yml +4 -0
  74. data/app/components/solidus_admin/promotions/index/component.html.erb +34 -0
  75. data/app/components/solidus_admin/promotions/index/component.rb +97 -0
  76. data/app/components/solidus_admin/promotions/index/component.yml +14 -0
  77. data/app/components/solidus_admin/properties/index/component.html.erb +34 -0
  78. data/app/components/solidus_admin/properties/index/component.rb +65 -0
  79. data/app/components/solidus_admin/properties/index/component.yml +4 -0
  80. data/app/components/solidus_admin/refund_reasons/index/component.html.erb +31 -0
  81. data/app/components/solidus_admin/refund_reasons/index/component.rb +53 -0
  82. data/app/components/solidus_admin/refund_reasons/index/component.yml +4 -0
  83. data/app/components/solidus_admin/refunds_and_returns/component.html.erb +26 -0
  84. data/app/components/solidus_admin/refunds_and_returns/component.rb +20 -0
  85. data/app/components/solidus_admin/refunds_and_returns/component.yml +3 -0
  86. data/app/components/solidus_admin/reimbursement_types/index/component.html.erb +22 -0
  87. data/app/components/solidus_admin/reimbursement_types/index/component.rb +45 -0
  88. data/app/components/solidus_admin/reimbursement_types/index/component.yml +4 -0
  89. data/app/components/solidus_admin/return_reasons/index/component.html.erb +31 -0
  90. data/app/components/solidus_admin/return_reasons/index/component.rb +52 -0
  91. data/app/components/solidus_admin/return_reasons/index/component.yml +4 -0
  92. data/app/components/solidus_admin/shipping/component.html.erb +30 -0
  93. data/app/components/solidus_admin/shipping/component.rb +18 -0
  94. data/app/components/solidus_admin/shipping/component.yml +3 -0
  95. data/app/components/solidus_admin/shipping_categories/index/component.html.erb +32 -0
  96. data/app/components/solidus_admin/shipping_categories/index/component.rb +46 -0
  97. data/app/components/solidus_admin/shipping_categories/index/component.yml +4 -0
  98. data/app/components/solidus_admin/shipping_methods/index/component.html.erb +32 -0
  99. data/app/components/solidus_admin/shipping_methods/index/component.rb +61 -0
  100. data/app/components/solidus_admin/shipping_methods/index/component.yml +4 -0
  101. data/app/components/solidus_admin/stock_items/edit/component.html.erb +89 -0
  102. data/app/components/solidus_admin/stock_items/edit/component.js +17 -0
  103. data/app/components/solidus_admin/stock_items/edit/component.rb +23 -0
  104. data/app/components/solidus_admin/stock_items/edit/component.yml +10 -0
  105. data/app/components/solidus_admin/stock_items/index/component.html.erb +26 -0
  106. data/app/components/solidus_admin/stock_items/index/component.rb +180 -0
  107. data/app/components/solidus_admin/stock_items/index/component.yml +10 -0
  108. data/app/components/solidus_admin/stock_locations/index/component.html.erb +32 -0
  109. data/app/components/solidus_admin/stock_locations/index/component.rb +81 -0
  110. data/app/components/solidus_admin/stock_locations/index/component.yml +6 -0
  111. data/app/components/solidus_admin/store_credit_reasons/index/component.html.erb +31 -0
  112. data/app/components/solidus_admin/store_credit_reasons/index/component.rb +52 -0
  113. data/app/components/solidus_admin/store_credit_reasons/index/component.yml +4 -0
  114. data/app/components/solidus_admin/stores/index/component.html.erb +34 -0
  115. data/app/components/solidus_admin/stores/index/component.rb +59 -0
  116. data/app/components/solidus_admin/stores/index/component.yml +4 -0
  117. data/app/components/solidus_admin/tax_categories/index/component.html.erb +32 -0
  118. data/app/components/solidus_admin/tax_categories/index/component.rb +58 -0
  119. data/app/components/solidus_admin/tax_categories/index/component.yml +6 -0
  120. data/app/components/solidus_admin/tax_rates/index/component.html.erb +32 -0
  121. data/app/components/solidus_admin/tax_rates/index/component.rb +84 -0
  122. data/app/components/solidus_admin/tax_rates/index/component.yml +4 -0
  123. data/app/components/solidus_admin/taxes/component.html.erb +24 -0
  124. data/app/components/solidus_admin/taxes/component.rb +25 -0
  125. data/app/components/solidus_admin/taxes/component.yml +3 -0
  126. data/app/components/solidus_admin/taxonomies/index/component.html.erb +28 -0
  127. data/app/components/solidus_admin/taxonomies/index/component.rb +47 -0
  128. data/app/components/solidus_admin/taxonomies/index/component.yml +4 -0
  129. data/app/components/solidus_admin/ui/badge/component.rb +18 -8
  130. data/app/components/solidus_admin/ui/badge/component.yml +3 -0
  131. data/app/components/solidus_admin/ui/button/component.rb +32 -32
  132. data/app/components/solidus_admin/ui/details_list/component.html.erb +10 -0
  133. data/app/components/solidus_admin/ui/details_list/component.rb +7 -0
  134. data/app/components/solidus_admin/ui/dropdown/component.html.erb +50 -0
  135. data/app/components/solidus_admin/ui/dropdown/component.js +16 -0
  136. data/app/components/solidus_admin/ui/dropdown/component.rb +28 -0
  137. data/app/components/solidus_admin/ui/dropdown/component.yml +2 -0
  138. data/app/components/solidus_admin/ui/forms/address/component.html.erb +36 -0
  139. data/app/components/solidus_admin/ui/forms/address/component.js +34 -0
  140. data/app/components/solidus_admin/ui/forms/address/component.rb +14 -0
  141. data/app/components/solidus_admin/ui/forms/field/component.html.erb +5 -4
  142. data/app/components/solidus_admin/ui/forms/field/component.rb +53 -15
  143. data/app/components/solidus_admin/ui/forms/input/component.rb +11 -5
  144. data/app/components/solidus_admin/ui/forms/search/component.html.erb +52 -0
  145. data/app/components/solidus_admin/ui/forms/search/component.js +116 -0
  146. data/app/components/solidus_admin/ui/forms/search/component.rb +8 -0
  147. data/app/components/solidus_admin/ui/forms/search/component.yml +4 -0
  148. data/app/components/solidus_admin/ui/forms/search/result/component.rb +12 -0
  149. data/app/components/solidus_admin/ui/forms/search_field/component.html.erb +20 -0
  150. data/app/{javascript/solidus_admin/controllers/hello_controller.js → components/solidus_admin/ui/forms/search_field/component.js} +4 -2
  151. data/app/components/solidus_admin/ui/forms/search_field/component.rb +10 -0
  152. data/app/components/solidus_admin/ui/forms/search_field/component.yml +2 -0
  153. data/app/components/solidus_admin/ui/forms/switch/component.rb +27 -31
  154. data/app/components/solidus_admin/ui/forms/switch_field/component.html.erb +20 -0
  155. data/app/components/solidus_admin/ui/forms/switch_field/component.rb +11 -0
  156. data/app/components/solidus_admin/ui/icon/component.rb +4 -0
  157. data/app/components/solidus_admin/ui/modal/component.html.erb +37 -0
  158. data/app/components/solidus_admin/ui/modal/component.rb +12 -0
  159. data/app/components/solidus_admin/ui/modal/component.yml +2 -0
  160. data/app/components/solidus_admin/ui/panel/component.html.erb +26 -12
  161. data/app/components/solidus_admin/ui/panel/component.rb +17 -0
  162. data/app/components/solidus_admin/ui/panel/component.yml +1 -3
  163. data/app/components/solidus_admin/ui/resource_item/component.html.erb +10 -0
  164. data/app/components/solidus_admin/ui/resource_item/component.rb +9 -0
  165. data/app/components/solidus_admin/ui/tab/component.rb +9 -8
  166. data/app/components/solidus_admin/ui/table/component.html.erb +146 -135
  167. data/app/components/solidus_admin/ui/table/component.js +56 -17
  168. data/app/components/solidus_admin/ui/table/component.rb +94 -70
  169. data/app/components/solidus_admin/ui/table/component.yml +0 -1
  170. data/app/components/solidus_admin/ui/table/ransack_filter/component.html.erb +72 -0
  171. data/app/components/solidus_admin/ui/table/ransack_filter/component.js +73 -0
  172. data/app/components/solidus_admin/ui/table/ransack_filter/component.rb +68 -0
  173. data/app/components/solidus_admin/ui/table/ransack_filter/component.yml +3 -0
  174. data/app/components/solidus_admin/ui/table/toolbar/component.rb +21 -0
  175. data/app/components/solidus_admin/ui/thumbnail/component.rb +46 -0
  176. data/app/components/solidus_admin/ui/toast/component.html.erb +9 -5
  177. data/app/components/solidus_admin/ui/toast/component.js +9 -6
  178. data/app/components/solidus_admin/ui/toast/component.rb +2 -2
  179. data/app/components/solidus_admin/ui/toggletip/component.html.erb +14 -10
  180. data/app/components/solidus_admin/ui/toggletip/component.js +22 -4
  181. data/app/components/solidus_admin/ui/toggletip/component.rb +8 -85
  182. data/app/components/solidus_admin/users/index/component.html.erb +34 -0
  183. data/app/components/solidus_admin/users/index/component.rb +89 -0
  184. data/app/components/solidus_admin/users/index/component.yml +18 -0
  185. data/app/components/solidus_admin/zones/index/component.html.erb +35 -0
  186. data/app/components/solidus_admin/zones/index/component.rb +55 -0
  187. data/app/components/solidus_admin/zones/index/component.yml +4 -0
  188. data/app/controllers/solidus_admin/addresses_controller.rb +92 -0
  189. data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +40 -0
  190. data/app/controllers/solidus_admin/base_controller.rb +1 -0
  191. data/app/controllers/solidus_admin/controller_helpers/authorization.rb +5 -1
  192. data/app/controllers/solidus_admin/controller_helpers/locale.rb +2 -2
  193. data/app/controllers/solidus_admin/controller_helpers/search.rb +48 -0
  194. data/app/controllers/solidus_admin/controller_helpers/theme.rb +30 -0
  195. data/app/controllers/solidus_admin/countries_controller.rb +12 -0
  196. data/app/controllers/solidus_admin/customers_controller.rb +29 -0
  197. data/app/controllers/solidus_admin/line_items_controller.rb +45 -0
  198. data/app/controllers/solidus_admin/option_types_controller.rb +46 -0
  199. data/app/controllers/solidus_admin/orders_controller.rb +104 -7
  200. data/app/controllers/solidus_admin/payment_methods_controller.rb +52 -0
  201. data/app/controllers/solidus_admin/products_controller.rb +26 -17
  202. data/app/controllers/solidus_admin/promotion_categories_controller.rb +38 -0
  203. data/app/controllers/solidus_admin/promotions_controller.rb +46 -0
  204. data/app/controllers/solidus_admin/properties_controller.rb +33 -0
  205. data/app/controllers/solidus_admin/refund_reasons_controller.rb +40 -0
  206. data/app/controllers/solidus_admin/reimbursement_types_controller.rb +31 -0
  207. data/app/controllers/solidus_admin/return_reasons_controller.rb +40 -0
  208. data/app/controllers/solidus_admin/shipping_categories_controller.rb +40 -0
  209. data/app/controllers/solidus_admin/shipping_methods_controller.rb +40 -0
  210. data/app/controllers/solidus_admin/stock_items_controller.rb +67 -0
  211. data/app/controllers/solidus_admin/stock_locations_controller.rb +40 -0
  212. data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +40 -0
  213. data/app/controllers/solidus_admin/stores_controller.rb +40 -0
  214. data/app/controllers/solidus_admin/tax_categories_controller.rb +40 -0
  215. data/app/controllers/solidus_admin/tax_rates_controller.rb +40 -0
  216. data/app/controllers/solidus_admin/taxonomies_controller.rb +46 -0
  217. data/app/controllers/solidus_admin/users_controller.rb +50 -0
  218. data/app/controllers/solidus_admin/zones_controller.rb +40 -0
  219. data/app/javascript/solidus_admin/controllers/components.js +3 -1
  220. data/app/javascript/solidus_admin/controllers/confirm_controller.js +21 -0
  221. data/app/javascript/solidus_admin/controllers/details_click_outside_controller.js +12 -0
  222. data/app/javascript/solidus_admin/controllers/readonly_when_submitting_controller.js +17 -0
  223. data/app/javascript/solidus_admin/controllers/sortable_controller.js +33 -0
  224. data/app/views/layouts/solidus_admin/application.html.erb +16 -10
  225. data/app/views/layouts/solidus_admin/preview.html.erb +0 -1
  226. data/app/views/solidus_admin/base/unauthorized.html.erb +4 -0
  227. data/config/importmap.rb +2 -0
  228. data/config/initializers/view_component.rb +20 -0
  229. data/config/locales/adjustment_reasons.en.yml +6 -0
  230. data/config/locales/customers.en.yml +7 -0
  231. data/config/locales/errors.en.yml +7 -0
  232. data/config/locales/line_items.en.yml +9 -0
  233. data/config/locales/{main_nav.en.yml → menu_item.en.yml} +8 -2
  234. data/config/locales/option_types.en.yml +6 -0
  235. data/config/locales/orders.en.yml +9 -0
  236. data/config/locales/payment_methods.en.yml +6 -0
  237. data/config/locales/promotion_categories.en.yml +6 -0
  238. data/config/locales/promotions.en.yml +6 -0
  239. data/config/locales/properties.en.yml +6 -0
  240. data/config/locales/refund_reasons_.en.yml +6 -0
  241. data/config/locales/reimbursement_types.en.yml +4 -0
  242. data/config/locales/return_reasons.en.yml +6 -0
  243. data/config/locales/shipping_categories.en.yml +6 -0
  244. data/config/locales/shipping_methods.en.yml +6 -0
  245. data/config/locales/stock_items.en.yml +4 -0
  246. data/config/locales/stock_locations.en.yml +6 -0
  247. data/config/locales/store_credit_reasons.en.yml +6 -0
  248. data/config/locales/stores.en.yml +6 -0
  249. data/config/locales/tax_categories.en.yml +6 -0
  250. data/config/locales/tax_rates.en.yml +6 -0
  251. data/config/locales/taxonomies.en.yml +6 -0
  252. data/config/locales/users.en.yml +6 -0
  253. data/config/locales/zones.en.yml +6 -0
  254. data/config/routes.rb +50 -3
  255. data/config/tailwind.config.js +119 -0
  256. data/docs/{customizing_main_navigation.md → customizing_menu_items.md} +2 -2
  257. data/docs/customizing_tailwindcss.md +57 -0
  258. data/docs/customizing_view_components.md +17 -38
  259. data/lib/generators/solidus_admin/install/install_generator.rb +13 -4
  260. data/lib/generators/solidus_admin/install/templates/config/initializers/{solidus_admin.rb → solidus_admin.rb.tt} +10 -14
  261. data/lib/solidus_admin/admin_resources.rb +23 -0
  262. data/lib/solidus_admin/configuration.rb +93 -67
  263. data/lib/solidus_admin/install_tailwindcss.rb +102 -0
  264. data/lib/solidus_admin/{main_nav_item.rb → menu_item.rb} +2 -2
  265. data/lib/solidus_admin/version.rb +1 -1
  266. data/lib/solidus_admin.rb +1 -2
  267. data/lib/tasks/tailwind.rake +10 -0
  268. data/solidus_admin.gemspec +3 -4
  269. metadata +230 -50
  270. data/app/assets/stylesheets/solidus_admin/application.tailwind.css.erb +0 -35
  271. data/app/components/solidus_admin/feedback/component.html.erb +0 -11
  272. data/app/components/solidus_admin/feedback/component.rb +0 -4
  273. data/app/components/solidus_admin/feedback/component.yml +0 -5
  274. data/app/components/solidus_admin/sidebar/account_nav/component.html.erb +0 -67
  275. data/app/components/solidus_admin/sidebar/account_nav/component.rb +0 -15
  276. data/app/components/solidus_admin/sidebar/component.rb +0 -21
  277. data/app/components/solidus_admin/ui/panel/component.js +0 -14
  278. data/config/solidus_admin/tailwind.config.js.erb +0 -95
  279. data/docs/customizing_tailwind.md +0 -78
  280. data/lib/solidus_admin/tailwindcss.rb +0 -58
  281. data/lib/tasks/tailwindcss.rake +0 -55
  282. /data/app/components/solidus_admin/{sidebar/account_nav → layout/navigation/account}/component.yml +0 -0
  283. /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.js +0 -0
  284. /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.yml +0 -0
  285. /data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.yml +0 -0
@@ -1,4 +1,5 @@
1
1
  //= link_tree ../images
2
+ //= link_tree ../builds
2
3
  //= link_tree ../stylesheets .css
3
4
  //= link_tree ../../javascript .js
4
5
  //= link_tree ../../components .js
@@ -0,0 +1,4 @@
1
+ @import url("https://rsms.me/inter/inter.css");
2
+ @tailwind base;
3
+ @tailwind components;
4
+ @tailwind utilities;
@@ -0,0 +1,12 @@
1
+ /*
2
+ * = require solidus_admin/tailwind.css
3
+ */
4
+
5
+ html {
6
+ -webkit-filter: invert(100%);
7
+ filter: invert(100%) hue-rotate(180deg);
8
+ }
9
+
10
+ main img {
11
+ filter: invert(100%) hue-rotate(-180deg);
12
+ }
@@ -0,0 +1,11 @@
1
+ /*
2
+ * = require solidus_admin/tailwind.css
3
+ */
4
+
5
+ html {
6
+ filter: invert(91%) hue-rotate(180deg);
7
+ }
8
+
9
+ main img {
10
+ filter: invert(91%) brightness(1.5) contrast(1.5) hue-rotate(-180deg);
11
+ }
@@ -0,0 +1,32 @@
1
+ <%= render component('refunds_and_returns').new(current_class: Spree::AdjustmentReason) 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_adjustment_reason_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::AdjustmentReason,
16
+ rows: @page.records,
17
+ url: ->(adjustment_reason) { spree.edit_admin_adjustment_reason_path(adjustment_reason) },
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.adjustment_reasons_path,
27
+ searchbar_key: :name_or_code_cont,
28
+ scopes: scopes,
29
+ filters: filters,
30
+ },
31
+ ) %>
32
+ <% end %>
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::AdjustmentReasons::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::AdjustmentReason.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.adjustment_reasons_path,
27
+ method: :delete,
28
+ icon: 'delete-bin-7-line',
29
+ },
30
+ ]
31
+ end
32
+
33
+ def scopes
34
+ []
35
+ end
36
+
37
+ def filters
38
+ []
39
+ end
40
+
41
+ def columns
42
+ [
43
+ :name,
44
+ :code,
45
+ {
46
+ header: :active,
47
+ data: ->(adjustment_reason) do
48
+ adjustment_reason.active? ? component('ui/badge').yes : component('ui/badge').no
49
+ end
50
+ },
51
+ ]
52
+ end
53
+ end
@@ -0,0 +1,4 @@
1
+ en:
2
+ add: 'Add new'
3
+ batch_actions:
4
+ delete: 'Delete'
@@ -0,0 +1,15 @@
1
+ <%= link_to(
2
+ "https://solidus.io/feedback?category=solidus-admin",
3
+ class: 'whitespace-nowrap flex flex-col items-center gap-2 text-gray-500 text-small hover:text-black',
4
+ target: '_blank',
5
+ ) do %>
6
+
7
+ <span>
8
+ <%= render component("ui/badge").new(name: "beta", size: :s, color: :blue) %>
9
+ <span class="underline"><%= t(".give_feedback") %></span>
10
+ </span>
11
+
12
+ <span class="font-normal text-sm text-center">
13
+ <%= t(".feedback_description_html") %>
14
+ </span>
15
+ <% end %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::Layout::Feedback::Component < SolidusAdmin::BaseComponent
4
+ end
@@ -0,0 +1,3 @@
1
+ en:
2
+ give_feedback: 'Give feedback'
3
+ feedback_description_html: 'We are constantly trying to improve. <br>Please let us know what you think about this admin page.'
@@ -0,0 +1,74 @@
1
+ <details
2
+ data-controller="<%= stimulus_id %>"
3
+ class="relative w-full"
4
+ aria-label="<%= t('.account') %>"
5
+ data-action="keydown.escape-><%= stimulus_id %>#close"
6
+ <%= :open if params[:account_menu_open] %>
7
+ >
8
+ <summary
9
+ class="
10
+ flex gap-1.5
11
+ p-3 mt-2 rounded
12
+ font-semibold text-sm text-gray-500
13
+ hover:bg-gray-25 [[open]_>_&]:bg-gray-25
14
+ cursor-pointer
15
+ ">
16
+ <%= icon_tag("user-smile-fill", class: "inline-block align-text-bottom shrink-0 w-6 h-6 rounded-[4.81rem] font-normal text-sm fill-yellow bg-black") %>
17
+ <span class="overflow-hidden whitespace-nowrap text-ellipsis leading-6">
18
+ <%= @user_label %>
19
+ </span>
20
+ </summary>
21
+
22
+ <ul
23
+ class="
24
+ p-2 mb-1 absolute bottom-full left-0 w-full
25
+ font-normal text-sm text-black bg-white
26
+ border border-gray-100 rounded-lg
27
+ shadow-base
28
+ ">
29
+
30
+ <% if (available_locales = Spree.i18n_available_locales).any? %>
31
+ <li class="h-8 flex items-center hover:bg-gray-25 rounded">
32
+ <%= autosubmit_select_tag(
33
+ "switch_to_locale",
34
+ options_for_select(locale_options_for_select(available_locales), selected: I18n.locale),
35
+ icon: 'global-line',
36
+ ) %>
37
+ </li>
38
+ <% end %>
39
+
40
+ <li class="h-8 items-center hover:bg-gray-25 rounded dark:hidden flex">
41
+ <%= autosubmit_select_tag(
42
+ "switch_to_theme",
43
+ options_for_select(theme_options_for_select, session[:admin_light_theme]),
44
+ icon: 'sun-line',
45
+ ) do %>
46
+ <%= hidden_field_tag(:system_theme, :light) %>
47
+ <% end %>
48
+ </li>
49
+
50
+ <li class="h-8 items-center hover:bg-gray-25 rounded hidden dark:flex">
51
+ <%= autosubmit_select_tag(
52
+ "switch_to_theme",
53
+ options_for_select(theme_options_for_select, session[:admin_dark_theme]),
54
+ icon: 'moon-line',
55
+ ) do %>
56
+ <%= hidden_field_tag(:system_theme, :dark) %>
57
+ <% end %>
58
+ </li>
59
+
60
+ <li class="h-8 flex items-center hover:bg-gray-25 rounded">
61
+ <%= link_to @account_path, class: 'flex gap-2 items-center px-2' do %>
62
+ <%= icon_tag("user-3-line", class: "w-5 h-5 fill-current shrink") %>
63
+ <span><%= t('.account') %></span>
64
+ <% end %>
65
+ </li>
66
+
67
+ <li class="h-8 flex items-center hover:bg-gray-25 rounded">
68
+ <%= button_to @logout_path, method: @logout_method, class: 'flex gap-2 items-center px-2' do %>
69
+ <%= icon_tag("logout-box-line", class: "w-5 h-5 fill-current shrink") %>
70
+ <span><%= t('.logout') %></span>
71
+ <% end %>
72
+ </li>
73
+ </ul>
74
+ </details>
@@ -0,0 +1,16 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import { useClickOutside } from "stimulus-use"
3
+
4
+ export default class extends Controller {
5
+ connect() {
6
+ useClickOutside(this)
7
+ }
8
+
9
+ clickOutside() {
10
+ this.close()
11
+ }
12
+
13
+ close() {
14
+ this.element.removeAttribute("open")
15
+ }
16
+ }
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::Layout::Navigation::Account::Component < SolidusAdmin::BaseComponent
4
+ def initialize(user_label:, account_path:, logout_path:, logout_method:)
5
+ @user_label = user_label
6
+ @account_path = account_path
7
+ @logout_path = logout_path
8
+ @logout_method = logout_method
9
+ end
10
+
11
+ def locale_options_for_select(available_locales)
12
+ available_locales.map do |locale|
13
+ [
14
+ t("spree.i18n.this_file_language", locale: locale, default: locale.to_s, fallback: false),
15
+ locale,
16
+ ]
17
+ end.sort
18
+ end
19
+
20
+ def theme_options_for_select
21
+ SolidusAdmin::Config.themes.keys.map { |theme| [theme.to_s.humanize, theme] }.sort
22
+ end
23
+
24
+ def autosubmit_select_tag(name, options, icon:, &block)
25
+ form_tag(request.fullpath, method: :get, 'data-turbo': false, class: "w-full") do
26
+ safe_join([
27
+ block_given? ? capture(&block) : nil,
28
+ tag.label(safe_join([
29
+ icon_tag(icon, class: "w-full max-w-[20px] h-5 fill-current shrink"),
30
+ tag.select(options, name: name, onchange: "this.form.requestSubmit()", class: "w-full appearance-none grow bg-transparent outline-none"),
31
+ icon_tag("expand-up-down-line", class: "w-full max-w-[20px] h-5 fill-current shrink"),
32
+ ]), class: "flex gap-2 items-center px-2"),
33
+ ])
34
+ end
35
+ end
36
+ end
@@ -4,32 +4,32 @@
4
4
  p-4
5
5
  w-full
6
6
  " data-controller="<%= stimulus_id %>" data-<%= stimulus_id %>-cookie-value="solidus_admin">
7
- <%= link_to @store.url, class: "py-3 px-2 text-left flex mb-4" do %>
7
+ <%= link_to spree.admin_path, class: "py-3 px-2 text-left flex mb-4" do %>
8
8
  <%= image_tag @logo_path, alt: t('.visit_store'), class: "max-h-7" %>
9
9
  <% end %>
10
10
 
11
- <%= link_to @store.url, target: :_blank, class: "flex mb-4 px-2 py-1.5 border border-gray-100 rounded-sm shadow-sm" do %>
12
- <div class="flex-grow">
13
- <p class="body-small-bold text-black"><%= @store.name %></p>
14
- <p class="body-tiny text-gray-500"><%= @store.url %></p>
11
+ <%= link_to @store_url, target: :_blank, class: "flex mb-4 px-2 py-1.5 border border-gray-100 rounded-sm shadow-sm" do %>
12
+ <div class="flex-grow flex flex-col gap-0.5">
13
+ <p class="font-semibold text-sm text-black"><%= @store.name %></p>
14
+ <p class="font-normal text-xs text-gray-500"><%= @store.url %></p>
15
15
  </div>
16
16
  <%= render component("ui/icon").new(name: 'arrow-right-up-line', class: 'w-4 h-4 fill-gray-400') %>
17
17
  <% end %>
18
18
 
19
- <ul>
20
- <%= render component("sidebar/item").with_collection(items, fullpath: request.fullpath) %>
19
+ <ul class="flex flex-col gap-0.5">
20
+ <%= render component("layout/navigation/item").with_collection(items, fullpath: request.fullpath) %>
21
21
  </ul>
22
22
 
23
23
  <div class="mt-auto">
24
24
  <div class="group mb-3">
25
- <label class="flex gap-3 items-center py-0.5 px-3 pb-0.5 rounded hover:text-red-500 hover:bg-gray-50 body-small-bold text-black cursor-pointer">
25
+ <label class="flex gap-3 items-center py-0.5 px-3 pb-0.5 rounded hover:text-red-500 hover:bg-gray-50 font-semibold text-sm text-black cursor-pointer">
26
26
  <%= t('spree.navigation.switch_to_legacy') %>
27
27
  <div class="flex items-center">
28
28
  <%= render component("ui/forms/switch").new(size: :s, checked: false, 'data-action': "#{stimulus_id}#setCookie:prevent") %>
29
29
  </div>
30
30
  </label>
31
31
  </div>
32
- <%= render component("sidebar/account_nav").new(
32
+ <%= render component("layout/navigation/account").new(
33
33
  user_label: helpers.current_solidus_admin_user.email,
34
34
  account_path: solidus_admin.account_path,
35
35
  logout_path: helpers.solidus_admin_logout_path,
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::Layout::Navigation::Component < SolidusAdmin::BaseComponent
4
+ def initialize(
5
+ store:,
6
+ logo_path: SolidusAdmin::Config.logo_path,
7
+ items: SolidusAdmin::Config.menu_items
8
+ )
9
+ @logo_path = logo_path
10
+ @items = items.map do |attrs|
11
+ children = attrs[:children].to_a.map { SolidusAdmin::MenuItem.new(**_1, top_level: false) }
12
+ SolidusAdmin::MenuItem.new(**attrs, children: children, top_level: true)
13
+ end
14
+ @store = store
15
+ end
16
+
17
+ def before_render
18
+ url = @store.url
19
+ url = "https://#{url}" unless url.start_with?("http")
20
+ @store_url = url
21
+ end
22
+
23
+ def items
24
+ @items.sort_by(&:position)
25
+ end
26
+ end
@@ -4,13 +4,13 @@
4
4
  aria-current="<%= @item.current?(@url_helpers, @fullpath) ? "page" : "false" %>"
5
5
  class="
6
6
  flex gap-3 items-center
7
- py-0.5 px-3 mb-0.5 rounded
7
+ py-1 px-3 rounded
8
8
  hover:text-red-500 hover:bg-gray-50
9
- <%= "text-red-500 bg-gray-50" if active? %>
10
- <%= @item.top_level ? "body-small-bold text-black" : "body-small text-gray-600" %>
9
+ <%= "text-red-600 bg-gray-50" if active? %>
10
+ <%= @item.top_level ? "font-semibold text-sm text-black" : "font-normal text-sm text-gray-600" %>
11
11
  "
12
12
  >
13
- <i class="w-[1.125rem] h-[1.125rem] body-small flex">
13
+ <i class="w-[1.125rem] h-[1.125rem] font-normal text-sm flex">
14
14
  <% if @item.icon %>
15
15
  <%= icon_tag(@item.icon, class: "inline-block w-full h-full fill-current") %>
16
16
  <% end %>
@@ -19,7 +19,7 @@
19
19
  </a>
20
20
 
21
21
  <% if @item.children? %>
22
- <ul class="<%= "hidden" unless active? %>">
22
+ <ul class="flex flex-col gap-0.5 pt-0.5 <%= "hidden" unless active? %>">
23
23
  <%= render self.class.with_collection(@item.children, url_helpers: @url_helpers, fullpath: @fullpath) %>
24
24
  </ul>
25
25
  <% end %>
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Menu item within a {Sidebar}
4
- class SolidusAdmin::Sidebar::Item::Component < SolidusAdmin::BaseComponent
4
+ class SolidusAdmin::Layout::Navigation::Item::Component < SolidusAdmin::BaseComponent
5
5
  with_collection_parameter :item
6
6
 
7
- # @param item [SolidusAdmin::MainNavItem
7
+ # @param item [SolidusAdmin::MenuItem]
8
8
  # @param fullpath [String] the current path
9
9
  # @param url_helpers [#solidus_admin, #spree] context for generating paths
10
10
  def initialize(
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusAdmin::Layout::PageHelpers
4
+ def page(**attrs, &block)
5
+ tag.div(capture(&block), class: "px-4 relative", "data-controller": stimulus_id, **attrs) +
6
+ tag.div(render(component("layout/feedback").new), class: "flex justify-center py-10")
7
+ end
8
+
9
+ def page_header_actions(&block)
10
+ tag.div(safe_join([
11
+ capture(&block),
12
+ ]), class: "flex gap-2 items-center")
13
+ end
14
+
15
+ def page_header_back(back_path)
16
+ render component("ui/button").new(
17
+ tag: :a,
18
+ title: t(".back"),
19
+ icon: "arrow-left-line",
20
+ scheme: :secondary,
21
+ href: back_path
22
+ )
23
+ end
24
+
25
+ def page_header_title(title, &block)
26
+ tag.h1(safe_join([
27
+ tag.span(title, class: "font-semibold text-xl"),
28
+ (capture(&block) if block_given?) || "",
29
+ ]), class: "flex-1 text-2xl font-bold")
30
+ end
31
+
32
+ def page_header(&block)
33
+ tag.header(capture(&block), class: "py-6 flex items-center gap-4")
34
+ end
35
+
36
+ def page_with_sidebar(&block)
37
+ tag.div(capture(&block), class: "flex gap-4 items-start pb-4")
38
+ end
39
+
40
+ def page_with_sidebar_main(&block)
41
+ tag.div(capture(&block), class: "justify-center items-start gap-4 flex flex-col w-full")
42
+ end
43
+
44
+ def page_with_sidebar_aside(&block)
45
+ tag.aside(capture(&block), class: "justify-center items-start gap-4 flex flex-col w-full max-w-sm")
46
+ end
47
+
48
+ def page_footer(&block)
49
+ tag.div(capture(&block), class: "mt-4 py-4 px-2 pb-8 border-t border-gray-100 flex")
50
+ end
51
+
52
+ def page_footer_actions(&block)
53
+ tag.div(capture(&block), class: "flex gap-2 grow")
54
+ end
55
+ end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Skip to content link
4
- class SolidusAdmin::SkipLink::Component < SolidusAdmin::BaseComponent
5
- # @param href [String] the href attribute for the skip link
3
+ class SolidusAdmin::Layout::SkipLink::Component < SolidusAdmin::BaseComponent
6
4
  def initialize(href:)
7
5
  @href = href
8
6
  end
@@ -16,7 +14,7 @@ class SolidusAdmin::SkipLink::Component < SolidusAdmin::BaseComponent
16
14
  inline-block
17
15
  focus:p-2
18
16
  focus:absolute
19
- body-small
17
+ font-normal text-sm
20
18
  text-white
21
19
  bg-black
22
20
  }
@@ -0,0 +1,30 @@
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_option_type_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::OptionType,
18
+ rows: @page.records,
19
+ url: ->(option_type) { spree.edit_admin_option_type_path(option_type) },
20
+ prev: prev_page_path,
21
+ next: next_page_path,
22
+ columns: columns,
23
+ batch_actions: batch_actions,
24
+ },
25
+ sortable: {
26
+ url: ->(option_type) { solidus_admin.move_option_type_path(option_type) },
27
+ param: 'position',
28
+ },
29
+ ) %>
30
+ <% end %>
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::OptionTypes::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::OptionType.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.option_types_path,
27
+ method: :delete,
28
+ icon: 'delete-bin-7-line',
29
+ },
30
+ ]
31
+ end
32
+
33
+ def columns
34
+ [
35
+ name_column,
36
+ presentation_column,
37
+ ]
38
+ end
39
+
40
+ def name_column
41
+ {
42
+ header: :name,
43
+ data: ->(option_type) do
44
+ content_tag :div, option_type.name
45
+ end
46
+ }
47
+ end
48
+
49
+ def presentation_column
50
+ {
51
+ header: :presentation,
52
+ data: ->(option_type) do
53
+ content_tag :div, option_type.presentation
54
+ end
55
+ }
56
+ end
57
+ end
@@ -0,0 +1,4 @@
1
+ en:
2
+ batch_actions:
3
+ delete: 'Delete'
4
+ add: 'Add new'
@@ -0,0 +1,77 @@
1
+ <div
2
+ class="w-full relative overflow-visible"
3
+ data-controller="<%= stimulus_id %>"
4
+ data-<%= stimulus_id %>-products-url-value="<%= solidus_admin.variants_for_order_path(@order) %>"
5
+ data-action="
6
+ <%= component('ui/forms/search').stimulus_id %>:search-><%= stimulus_id %>#search
7
+ <%= component('ui/forms/search').stimulus_id %>:submit-><%= stimulus_id %>#selectResult
8
+ "
9
+ >
10
+ <%= render component('ui/panel').new(title: t('.title')) do |panel| %>
11
+ <% panel.with_section do %>
12
+ <%= render component('ui/forms/search').new(
13
+ placeholder: t('.search_placeholder'),
14
+ id: :order_cart,
15
+ ) %>
16
+ <% end %>
17
+
18
+ <% panel.with_section(wide: true, high: true) do %>
19
+ <div class="rounded-b-lg overflow-hidden">
20
+ <table class="table-auto w-full" <%= :hidden if @order.line_items.empty? %>>
21
+ <thead>
22
+ <tr>
23
+ <th class="text-left font-semibold text-sm text-gray-800 bg-gray-15 px-6 py-3 leading-none">Product</th>
24
+ <th class="text-left font-semibold text-sm text-gray-800 bg-gray-15 px-6 py-3 leading-none w-16">Quantity</th>
25
+ <th class="text-left font-semibold text-sm text-gray-800 bg-gray-15 px-6 py-3 leading-none w-16">Price</th>
26
+ <th class="text-left font-semibold text-sm text-gray-800 bg-gray-15 px-6 py-3 leading-none w-16"><span class="sr-only">Actions</span></th>
27
+ </tr>
28
+ </thead>
29
+ <tbody>
30
+ <% @order.line_items.each do |line_item| %>
31
+ <tr class="border-gray-100 border-t">
32
+ <td class="px-6 py-4">
33
+ <%= render component("ui/resource_item").new(
34
+ thumbnail: (line_item.variant.images.first || line_item.variant.product.gallery.images.first)&.url(:small),
35
+ title: line_item.variant.name,
36
+ subtitle: "#{line_item.variant.sku}#{line_item.variant.options_text.presence&.prepend("- ")}",
37
+ ) %>
38
+ </td>
39
+ <td class="px-6 py-4">
40
+ <%= form_for(line_item, url: solidus_admin.order_line_item_path(@order, line_item), html: {
41
+ "data-controller": "readonly-when-submitting"
42
+ }) do |f| %>
43
+ <%= render component("ui/forms/input").new(
44
+ name: "#{f.object_name}[quantity]",
45
+ type: :number,
46
+ value: line_item.quantity,
47
+ "aria-label": "Quantity",
48
+ min: 0,
49
+ class: "!w-16 inline-block",
50
+ "data-action": "input->#{stimulus_id}#updateLineItem",
51
+ ) %>
52
+ <% render component("ui/button").new(type: :submit, text: "Update", class: "inline-block") %>
53
+ <% end %>
54
+ </td>
55
+ <td class="px-6 py-4">
56
+ <span class="text-gray-500 font-normal text-sm"><%= line_item.single_money.to_html %></span>
57
+ </td>
58
+ <td class="px-6 py-4 text-right">
59
+ <%= form_for(line_item, url: solidus_admin.order_line_item_path(@order, line_item), method: :delete) do |f| %>
60
+ <%= render component('ui/button').new(
61
+ scheme: :ghost,
62
+ size: :s,
63
+ title: t("spree.delete"),
64
+ icon: 'close-line',
65
+ "data-controller": "confirm",
66
+ "data-confirm-text-value": t("spree.are_you_sure"),
67
+ ) %>
68
+ <% end %>
69
+ </td>
70
+ </tr>
71
+ <% end %>
72
+ </tbody>
73
+ </table>
74
+ </div>
75
+ <% end %>
76
+ <% end %>
77
+ </div>