solidus_admin 0.0.2 → 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 +228 -48
  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
@@ -0,0 +1,6 @@
1
+ en:
2
+ solidus_admin:
3
+ stores:
4
+ title: "Stores"
5
+ destroy:
6
+ success: "Stores were successfully removed."
@@ -0,0 +1,6 @@
1
+ en:
2
+ solidus_admin:
3
+ tax_categories:
4
+ title: "Tax Categories"
5
+ destroy:
6
+ success: "Tax categories were successfully removed."
@@ -0,0 +1,6 @@
1
+ en:
2
+ solidus_admin:
3
+ tax_rates:
4
+ title: "Tax Rates"
5
+ destroy:
6
+ success: "Tax rates were successfully removed."
@@ -0,0 +1,6 @@
1
+ en:
2
+ solidus_admin:
3
+ taxonomies:
4
+ title: "Taxonomies"
5
+ destroy:
6
+ success: "Taxonomies were successfully removed."
@@ -0,0 +1,6 @@
1
+ en:
2
+ solidus_admin:
3
+ users:
4
+ title: "Users"
5
+ destroy:
6
+ success: "Users were successfully removed."
@@ -0,0 +1,6 @@
1
+ en:
2
+ solidus_admin:
3
+ zones:
4
+ title: "Zones"
5
+ destroy:
6
+ success: "Zones were successfully removed."
data/config/routes.rb CHANGED
@@ -1,13 +1,60 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  SolidusAdmin::Engine.routes.draw do
4
+ require "solidus_admin/admin_resources"
5
+ extend SolidusAdmin::AdminResources
6
+
4
7
  resource :account, only: :show
5
- resources :products, only: [:index, :show, :edit, :update] do
8
+ resources :countries, only: [] do
9
+ get 'states', to: 'countries#states'
10
+ end
11
+
12
+ admin_resources :products, only: [:index, :update, :destroy] do
6
13
  collection do
7
- delete :destroy
8
14
  put :discontinue
9
15
  put :activate
10
16
  end
11
17
  end
12
- resources :orders, only: :index
18
+
19
+ # Needs a constraint to avoid interpreting "new" as a product's slug
20
+ admin_resources :products, only: [
21
+ :show, :edit
22
+ ], constraints: ->{ SolidusAdmin::Config.enable_alpha_features? && _1.path != "/admin/products/new" }
23
+
24
+ admin_resources :orders, only: [:index]
25
+
26
+ admin_resources :orders, except: [
27
+ :destroy, :index
28
+ ], constraints: ->{ SolidusAdmin::Config.enable_alpha_features? } do
29
+ resources :line_items, only: [:destroy, :create, :update]
30
+ resource :customer
31
+ resource :ship_address, only: [:show, :edit, :update], controller: "addresses", type: "ship"
32
+ resource :bill_address, only: [:show, :edit, :update], controller: "addresses", type: "bill"
33
+
34
+ member do
35
+ get :variants_for
36
+ get :customers_for
37
+ end
38
+ end
39
+
40
+ admin_resources :users, only: [:index, :destroy]
41
+ admin_resources :promotions, only: [:index, :destroy]
42
+ admin_resources :properties, only: [:index, :destroy]
43
+ admin_resources :option_types, only: [:index, :destroy], sortable: true
44
+ admin_resources :taxonomies, only: [:index, :destroy], sortable: true
45
+ admin_resources :promotion_categories, only: [:index, :destroy]
46
+ admin_resources :tax_categories, only: [:index, :destroy]
47
+ admin_resources :tax_rates, only: [:index, :destroy]
48
+ admin_resources :payment_methods, only: [:index, :destroy], sortable: true
49
+ admin_resources :stock_items, only: [:index, :edit, :update]
50
+ admin_resources :shipping_methods, only: [:index, :destroy]
51
+ admin_resources :shipping_categories, only: [:index, :destroy]
52
+ admin_resources :stock_locations, only: [:index, :destroy]
53
+ admin_resources :stores, only: [:index, :destroy]
54
+ admin_resources :zones, only: [:index, :destroy]
55
+ admin_resources :refund_reasons, only: [:index, :destroy]
56
+ admin_resources :reimbursement_types, only: [:index]
57
+ admin_resources :return_reasons, only: [:index, :destroy]
58
+ admin_resources :adjustment_reasons, only: [:index, :destroy]
59
+ admin_resources :store_credit_reasons, only: [:index, :destroy]
13
60
  end
@@ -0,0 +1,119 @@
1
+ const defaultTheme = require('tailwindcss/defaultTheme')
2
+ const plugin = require('tailwindcss/plugin')
3
+ const adminRoot = __dirname.replace(/\/config$/, '')
4
+
5
+ module.exports = {
6
+ content: [
7
+ `${adminRoot}/{app/helpers,app/views,app/components,app/assets/javascripts,spec/components/previews}/**/*`,
8
+ ],
9
+ theme: {
10
+ extend: {
11
+ aria: {
12
+ current: 'current="true"',
13
+ },
14
+ fontFamily: {
15
+ sans: ["Inter var", ...defaultTheme.fontFamily.sans],
16
+ },
17
+ colors: {
18
+ transparent: "transparent",
19
+ current: "currentColor",
20
+
21
+ // Primary palette
22
+ "solidus-red": "#ef3023",
23
+ black: "#222222",
24
+ graphite: "#c7ccc7",
25
+ "graphite-light": "#d8dad8",
26
+ sand: "#f5f3f0",
27
+ white: "#ffffff",
28
+
29
+ // Secondary palette
30
+ yellow: "#fdc071",
31
+ orange: "#f68050",
32
+ blue: "#2554b1",
33
+ moss: "#2d3925",
34
+ forest: "#096756",
35
+ midnight: "#163449",
36
+ pink: "#f6d7e2",
37
+ plum: "#3a0e31",
38
+ sky: "#cbdff1",
39
+ seafoam: "#c1e0de",
40
+ dune: "#e6bf9b",
41
+ "full-black": "#000000",
42
+
43
+ // Extra colors (not part of the original palette)
44
+ "papaya-whip": "#f9e3d9",
45
+
46
+ // UI Red
47
+ red: {
48
+ 100: "#f8d6d3",
49
+ 200: "#f1ada7",
50
+ 300: "#ea8980",
51
+ 400: "#e36054",
52
+ 500: "#dc3728",
53
+ 600: "#b12c20",
54
+ 700: "#862219",
55
+ 800: "#561610",
56
+ 900: "#2b0b08",
57
+ },
58
+
59
+ // Grayscale
60
+ gray: {
61
+ 15: "#fafafa",
62
+ 25: "#f5f5f5",
63
+ 50: "#f0f0f0",
64
+ 100: "#dedede",
65
+ 200: "#cfcfcf",
66
+ 300: "#bababa",
67
+ 400: "#a3a3a3",
68
+ 500: "#737373",
69
+ 600: "#616161",
70
+ 700: "#4a4a4a",
71
+ 800: "#333333",
72
+ },
73
+ },
74
+ borderRadius: {
75
+ sm: "4px",
76
+ },
77
+ backgroundImage: {
78
+ "arrow-right-up-line": "url('solidus_admin/arrow_right_up_line.svg')",
79
+ "arrow-down-s-fill-gray-700": "url('solidus_admin/arrow_down_s_fill_gray_700.svg')",
80
+ "arrow-down-s-fill-red-400": "url('solidus_admin/arrow_down_s_fill_red_400.svg')",
81
+ },
82
+ boxShadow: {
83
+ sm: "0px 1px 2px 0px rgba(0, 0, 0, 0.04)",
84
+ base: "0px 4px 8px 0px rgba(0, 0, 0, 0.08), 0px 2px 4px -1px rgba(0, 0, 0, 0.04)",
85
+ },
86
+ },
87
+ },
88
+ plugins: [
89
+ require("@tailwindcss/forms")({ strategy: "class" }),
90
+ require("@tailwindcss/aspect-ratio"),
91
+ require("@tailwindcss/typography"),
92
+ require("@tailwindcss/container-queries"),
93
+ plugin(({ addVariant, addBase, addComponents, theme }) => {
94
+ // Support the "hidden" attribute
95
+ addVariant("hidden", "&([hidden])")
96
+ addVariant("visible", "&:not([hidden])")
97
+
98
+ // Support the "search-cancel" pseudo-element
99
+ addVariant("search-cancel", "&::-webkit-search-cancel-button")
100
+
101
+ // Reset the <summary> marker
102
+ addBase({
103
+ "summary::-webkit-details-marker": { display: "none" },
104
+ "summary::marker": { display: "none" },
105
+ summary: { listStyle: "none" },
106
+ })
107
+
108
+ // Add a text style for links
109
+ addComponents({
110
+ ".body-link": {
111
+ color: theme("colors.blue"),
112
+ "&:hover": {
113
+ textDecoration: "underline",
114
+ },
115
+ },
116
+ })
117
+ }),
118
+ ],
119
+ }
@@ -1,6 +1,6 @@
1
1
  # Customizing the main navigation
2
2
 
3
- You are allowed to add your custom links to the main navigation. To do so, you can access `SolidusAdmin::Config.main_nav` in an initializer:
3
+ You are allowed to add your custom links to the main navigation. To do so, you can access `SolidusAdmin::Config.menu_items` in an initializer:
4
4
 
5
5
  ```ruby
6
6
  # config/initializers/solidus_admin.rb
@@ -13,7 +13,7 @@ SolidusAdmin::Config.menu_items << {
13
13
  ```
14
14
 
15
15
  - The key you provide will be used to translate the link's label under the
16
- `solidus_admin.main_nav.#{key}` key.
16
+ `solidus_admin.menu_item.#{key}` key.
17
17
  - Icon needs to be an icon name from [Remixicon](https://remixicon.com/).
18
18
  - Position tells Solidus where to place the link in the main navigation. The
19
19
  default items are placed with 10 points of difference between them.
@@ -0,0 +1,57 @@
1
+ # Customizing TailwindCSS
2
+
3
+ Solidus Admin uses [Tailwind CSS](https://tailwindcss.com/) for styling. The
4
+ benefit of using Tailwind is that it allows you to customize the look and feel
5
+ of the admin without having to write any CSS. By leveraging utility classes,
6
+ you can easily change the colors, fonts, and spacing in use.
7
+
8
+ Solidus Admin provides a precompiled CSS file that includes all the necessary
9
+ Tailwind classes for the admin to work out of the box.
10
+
11
+ In case you need to customize the admin's look and feel, or create custom
12
+ components, you can do so by running Tailwind's build process in your host
13
+ application.
14
+
15
+ This process presumes that you have a working knowledge of Tailwind CSS. If you
16
+ are not familiar with Tailwind, please refer to the [Tailwind
17
+ documentation](https://tailwindcss.com/docs) for more information.
18
+
19
+ ## Setting up a local TailwindCSS build for Solidus Admin
20
+
21
+ In order to customize the admin's look and feel, you'll need to set up a local
22
+ Tailwind build. This is a two-step process:
23
+
24
+ Add Tailwind configuration files to your application:
25
+
26
+ ```shell
27
+ bin/rails solidus_admin:tailwindcss:install
28
+ ```
29
+
30
+ This will create all the necessary files for you to customize TailwindCSS,
31
+ including:
32
+ - A `config/solidus_admin/tailwind.config.js` configuration file
33
+ that will automatically import the Solidus Admin's default configuration.
34
+ - An `app/assets/stylesheets/solidus_admin/application.tailwind.css` file
35
+ in which you can add your own customizations.
36
+ - Tasks to build the CSS file once or watch for changes and automatically
37
+ rebuild the target `app/assets/builds/solidus_admin/application.css` file.
38
+
39
+ In order to manually build the CSS file, run:
40
+
41
+ ```shell
42
+ bin/rails solidus_admin:tailwindcss:build
43
+ ```
44
+
45
+ Or, to watch for changes and automatically rebuild the CSS file, run:
46
+
47
+ ```shell
48
+ bin/rails solidus_admin:tailwindcss:watch
49
+ ```
50
+
51
+ ## Caveats
52
+
53
+ ### Conflict with sassc-rails
54
+
55
+ Tailwind uses modern CSS features that are not recognized by the sassc-rails extension that was included by default in the Gemfile for Rails 6. In order to avoid any errors like SassC::SyntaxError, you must remove that gem from your Gemfile.
56
+
57
+ *See https://github.com/rails/tailwindcss-rails#conflict-with-sassc-rails.*
@@ -11,18 +11,12 @@ All the components Solidus Admin uses are located in the [`app/components`](../a
11
11
  - They are grouped in sidecar directories, where the main component file and
12
12
  all its related files (assets, i18n files, etc.) live together.
13
13
 
14
- For instance, the component for the main navigation is located in
15
- [`app/components/solidus_admin/main_nav/component.rb`](../app/components/solidus_admin/main_nav/component.rb).
16
-
17
14
  Solidus Admin components are designed to be easily customizable by the host
18
15
  application. Because of that, if you look at how they are designed, you'll find
19
16
  a series of patterns are followed consistently:
20
17
 
21
18
  - Components are always resolved from a global registry in
22
- `SolidusAdmin::Config.components` instead of being referenced by their constant. For
23
- example, we call `component('main_nav')` instead of referencing
24
- `SolidusAdmin::MainNav::Component` directly. As you'll see later, this makes
25
- it easy to replace or tweak a component.
19
+ `SolidusAdmin::Config.components` instead of being referenced by their constant.
26
20
  - It's possible to override the registry locally inside a component by redefining
27
21
  the `#component` method. This is useful when you need to use a component that
28
22
  is not registered in the global registry or need to address some edge case.
@@ -50,37 +44,22 @@ end
50
44
  # render component('foo').new
51
45
  ```
52
46
 
53
- ## Customizing components
54
-
55
- Some of the customizations detailed below require you to match Solidus Admin's
56
- component paths in your application. For instance, if we talk about the
57
- component in `solidus_admin` gem's
58
- `app/components/solidus_admin/main_nav/component.rb`, the matching path in your
59
- application would be
60
- `app/components/my_application/solidus_admin/main_nav/component.rb`, where
61
- `my_application` is the underscored name of your application (you can get it by
62
- running `Rails.application.class.module_parent_name`).
63
-
64
47
  ### Replacing a component's template
65
48
 
66
49
  In the most typical case, you'll only need to replace the template used by a
67
50
  component. You can do that by creating a new component with a maching path in
68
51
  your application, inheriting from the default one. Then, you can create a new
69
- template for it. For example, to replace the main nav template:
52
+ template for it. For example, to replace the menu item template:
70
53
 
71
- ```erb
72
- # app/components/my_application/solidus_admin/main_nav/component.rb %>
73
- class MyApplication::SolidusAdmin::MainNav::Component < ::SolidusAdmin::MainNav::Component
54
+ ```rb
55
+ # app/components/my_admin/navigation/item/component.rb
56
+ class MyAdmin::Navigation::Item::Component < SolidusAdmin::Layout::Navigation::Item::Component
74
57
  end
58
+ ```
75
59
 
76
- <%# app/components/my_application/solidus_admin/main_nav/component.html.erb %>
77
- <nav class="my_own_classes">
78
- <%=
79
- render main_nav_item_component.with_collection(
80
- sorted_items
81
- )
82
- %>
83
- </nav>
60
+ ```erb
61
+ <%# app/components/my_admin/navigation/item/component.html.erb %>
62
+ <li><%= link_to @item.name, path %></li>
84
63
  ```
85
64
 
86
65
  ### Prepending or appending to a component's template
@@ -90,9 +69,9 @@ component. You can easily do that by rendering the Solidus Admin component and
90
69
  adding your markup before or after it.
91
70
 
92
71
  ```erb
93
- <%# app/components/my_application/solidus_admin/main_nav/component.html.erb %>
72
+ <%# app/components/my_admin/menu_item/component.html.erb %>
94
73
  <h1>MY STORE ADMINISTRATION</h1>
95
- <%= render SolidusAdmin::MainNav::Component.new %>
74
+ <%= render SolidusAdmin::MenuItem::Component.new %>
96
75
  ```
97
76
 
98
77
  ### Replacing a component
@@ -109,12 +88,12 @@ There are two considerations to keep in mind:
109
88
  [SolidusAdmin::BaseComponent](../app/components/solidus_admin/base_component.rb).
110
89
  You can consider doing the same if you need to use one of its helpers.
111
90
 
112
- For example, the following replaces the main nav component:
91
+ For example, the following replaces the menu item component:
113
92
 
114
93
  ```ruby
115
- # app/components/my_application/solidus_admin/main_nav/component.rb
116
- class MyApplication::SolidusAdmin::MainNav::Component < SolidusAdmin::BaseComponent
117
- # do your thing
94
+ # app/components/my_admin/menu_item/component.rb
95
+ class MyAdmin::MenuItem::Component < SolidusAdmin::BaseComponent
96
+ # Here goes your code
118
97
  end
119
98
  ```
120
99
 
@@ -138,8 +117,8 @@ matching path from within your application (or manually add it to the
138
117
  registry) and override the methods you need to change:
139
118
 
140
119
  ```ruby
141
- # app/components/my_application/solidus_admin/main_nav/component.rb
142
- class MyApplication::SolidusAdmin::MainNav::Component < ::SolidusAdmin::MainNav::Component
120
+ # app/components/my_admin/menu_item/component.rb
121
+ class MyAdmin::MenuItem::Component < SolidusAdmin::MenuItem::Component
143
122
  def sorted_items
144
123
  super.reverse
145
124
  end
@@ -4,12 +4,13 @@ module SolidusAdmin
4
4
  module Generators
5
5
  class InstallGenerator < Rails::Generators::Base
6
6
  class_option :lookbook, type: :boolean, default: !!ENV['SOLIDUS_ADMIN_LOOKBOOK'], desc: 'Install Lookbook for component previews'
7
+ class_option :tailwind, type: :boolean, default: false, desc: 'Install TailwindCSS for custom components'
7
8
 
8
9
  source_root "#{__dir__}/templates"
9
10
 
10
11
  def install_solidus_core_support
11
12
  route <<~RUBY
12
- mount SolidusAdmin::Engine, at: '/admin', constraints: ->(req) {
13
+ mount SolidusAdmin::Engine, at: '#{solidus_mount_point}admin', constraints: ->(req) {
13
14
  req.cookies['solidus_admin'] != 'false' &&
14
15
  req.params['solidus_admin'] != 'false'
15
16
  }
@@ -17,7 +18,7 @@ module SolidusAdmin
17
18
  end
18
19
 
19
20
  def copy_initializer
20
- copy_file "config/initializers/solidus_admin.rb"
21
+ template 'config/initializers/solidus_admin.rb.tt', 'config/initializers/solidus_admin.rb'
21
22
  end
22
23
 
23
24
  def ignore_tailwind_build_files
@@ -25,7 +26,7 @@ module SolidusAdmin
25
26
  end
26
27
 
27
28
  def build_tailwind
28
- rake "solidus_admin:tailwindcss:build"
29
+ rake "solidus_admin:tailwindcss:install" if options[:tailwind]
29
30
  end
30
31
 
31
32
  def install_lookbook
@@ -37,7 +38,15 @@ module SolidusAdmin
37
38
  gem "actioncable"
38
39
  end
39
40
 
40
- route "mount Lookbook::Engine, at: '/lookbook' if Rails.env.development?"
41
+ route "mount Lookbook::Engine, at: '#{solidus_mount_point}lookbook' if Rails.env.development?"
42
+ end
43
+
44
+ private
45
+
46
+ def solidus_mount_point
47
+ mount_point = Spree::Core::Engine.routes.find_script_name({})
48
+ mount_point += "/" unless mount_point.end_with?("/")
49
+ mount_point
41
50
  end
42
51
  end
43
52
  end
@@ -6,28 +6,24 @@ SolidusAdmin::Config.configure do |config|
6
6
  # It needs to be a path to an image file accessible by Sprockets.
7
7
  # config.logo_path = "my_own_logo.svg"
8
8
 
9
- # Add custom paths for TailwindCSS to scan for styles. By default, it already
10
- # includes the following paths:
11
- # - public/solidus_admin/*.html
12
- # - app/helpers/solidus_admin/**/*.rb
13
- # - app/assets/javascripts/solidus_admin/**/*.js
14
- # - app/views/solidus_admin/**/*.{erb,haml,html,slim}
15
- # - app/components/solidus_admin/**/*.{rb,erb,haml,html,slim,js}
16
- #
17
- # config.tailwind_content << Rails.root.join("app/my/custom/path/**.rb")
18
-
19
- # Append custom stylesheets to be compiled by TailwindCSS.
20
- # config.tailwind_stylesheets << Rails.root.join("app/my/custom/path/style.css")
21
-
22
9
  # Add custom folder paths to watch for changes to trigger a cache sweep forcing a
23
10
  # regeneration of the importmap.
24
11
  # config.importmap_cache_sweepers << Rails.root.join("app/javascript/my_admin_components")
25
12
 
13
+ # If you want to avoid defining menu_item customizations twice while migrating to SolidusAdmin
14
+ # you can import menu_items from the backend by uncommenting the following line,
15
+ # but you will need to
16
+ <%- if defined? Spree::Backend -%>
17
+ config.import_menu_items_from_backend!
18
+ <%- else -%>
19
+ # config.import_menu_items_from_backend!
20
+ <%- end -%>
21
+
26
22
  # Add custom paths to importmap files to be loaded.
27
23
  # config.importmap_paths << Rails.root.join("config/solidus_admin_importmap.rb")
28
24
  #
29
25
  # Configure the main navigation.
30
- # See SolidusAdmin::MainNavItem for more details.
26
+ # See SolidusAdmin::MenuItem for more details.
31
27
  # config.menu_items << {
32
28
  # key: :my_custom_link,
33
29
  # route: :my_custom_link_path,
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusAdmin::AdminResources
4
+ def admin_resources(resource, **options)
5
+ batch_actions = %i[destroy]
6
+ batch_actions &= options[:only] if options[:only]
7
+ batch_actions -= options[:except] if options[:except]
8
+
9
+ resources(resource, options) do
10
+ yield if block_given?
11
+
12
+ collection do
13
+ delete :destroy if batch_actions.include?(:destroy)
14
+ end
15
+
16
+ member do
17
+ patch :move if options[:sortable]
18
+ end
19
+
20
+ yield if block_given?
21
+ end
22
+ end
23
+ end