solidus_admin 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.json +7 -0
- data/README.md +1 -1
- data/Rakefile +26 -0
- data/app/assets/builds/.keep +0 -0
- data/app/assets/builds/solidus_admin/tailwind.css +2799 -0
- data/app/assets/config/solidus_admin_manifest.js +1 -0
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css +4 -0
- data/app/assets/stylesheets/solidus_admin/dark.css +12 -0
- data/app/assets/stylesheets/solidus_admin/dimmed.css +11 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.html.erb +32 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +53 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/layout/feedback/component.html.erb +15 -0
- data/app/components/solidus_admin/layout/feedback/component.rb +4 -0
- data/app/components/solidus_admin/layout/feedback/component.yml +3 -0
- data/app/components/solidus_admin/layout/navigation/account/component.html.erb +74 -0
- data/app/components/solidus_admin/layout/navigation/account/component.js +16 -0
- data/app/components/solidus_admin/layout/navigation/account/component.rb +36 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/component.html.erb +9 -9
- data/app/components/solidus_admin/layout/navigation/component.rb +26 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.html.erb +5 -5
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.rb +2 -2
- data/app/components/solidus_admin/layout/page_helpers.rb +55 -0
- data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.rb +2 -4
- data/app/components/solidus_admin/option_types/index/component.html.erb +30 -0
- data/app/components/solidus_admin/option_types/index/component.rb +57 -0
- data/app/components/solidus_admin/option_types/index/component.yml +4 -0
- data/app/components/solidus_admin/orders/cart/component.html.erb +77 -0
- data/app/components/solidus_admin/orders/cart/component.js +37 -0
- data/app/components/solidus_admin/orders/cart/component.rb +7 -0
- data/app/components/solidus_admin/orders/cart/component.yml +3 -0
- data/app/components/solidus_admin/orders/cart/result/component.html.erb +26 -0
- data/app/components/solidus_admin/orders/cart/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/index/component.html.erb +26 -22
- data/app/components/solidus_admin/orders/index/component.rb +80 -16
- data/app/components/solidus_admin/orders/index/component.yml +10 -3
- data/app/components/solidus_admin/orders/show/address/component.html.erb +67 -0
- data/app/components/solidus_admin/orders/show/address/component.js +9 -0
- data/app/components/solidus_admin/orders/show/address/component.rb +53 -0
- data/app/components/solidus_admin/orders/show/address/component.yml +14 -0
- data/app/components/solidus_admin/orders/show/component.html.erb +76 -0
- data/app/components/solidus_admin/orders/show/component.js +7 -0
- data/app/components/solidus_admin/orders/show/component.rb +40 -0
- data/app/components/solidus_admin/orders/show/component.yml +21 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.js +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.yml +2 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.html.erb +17 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/show/email/component.html.erb +18 -0
- data/app/components/solidus_admin/orders/show/email/component.rb +15 -0
- data/app/components/solidus_admin/orders/show/email/component.yml +8 -0
- data/app/components/solidus_admin/orders/show/summary/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/summary/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/summary/component.yml +8 -0
- data/app/components/solidus_admin/payment_methods/index/component.html.erb +38 -0
- data/app/components/solidus_admin/payment_methods/index/component.rb +93 -0
- data/app/components/solidus_admin/payment_methods/index/component.yml +15 -0
- data/app/components/solidus_admin/products/index/component.html.erb +26 -22
- data/app/components/solidus_admin/products/index/component.rb +36 -36
- data/app/components/solidus_admin/products/index/component.yml +9 -6
- data/app/components/solidus_admin/products/show/component.html.erb +32 -38
- data/app/components/solidus_admin/products/show/component.rb +2 -0
- data/app/components/solidus_admin/products/show/component.yml +5 -5
- data/app/components/solidus_admin/products/status/component.rb +20 -18
- data/app/components/solidus_admin/products/status/component.yml +1 -0
- data/app/components/solidus_admin/products/stock/component.rb +38 -0
- data/app/components/solidus_admin/products/stock/component.yml +5 -0
- data/app/components/solidus_admin/promotion_categories/index/component.html.erb +26 -0
- data/app/components/solidus_admin/promotion_categories/index/component.rb +57 -0
- data/app/components/solidus_admin/promotion_categories/index/component.yml +4 -0
- data/app/components/solidus_admin/promotions/index/component.html.erb +34 -0
- data/app/components/solidus_admin/promotions/index/component.rb +97 -0
- data/app/components/solidus_admin/promotions/index/component.yml +14 -0
- data/app/components/solidus_admin/properties/index/component.html.erb +34 -0
- data/app/components/solidus_admin/properties/index/component.rb +65 -0
- data/app/components/solidus_admin/properties/index/component.yml +4 -0
- data/app/components/solidus_admin/refund_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/refund_reasons/index/component.rb +53 -0
- data/app/components/solidus_admin/refund_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/refunds_and_returns/component.html.erb +26 -0
- data/app/components/solidus_admin/refunds_and_returns/component.rb +20 -0
- data/app/components/solidus_admin/refunds_and_returns/component.yml +3 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.html.erb +22 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.rb +45 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.yml +4 -0
- data/app/components/solidus_admin/return_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/return_reasons/index/component.rb +52 -0
- data/app/components/solidus_admin/return_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/shipping/component.html.erb +30 -0
- data/app/components/solidus_admin/shipping/component.rb +18 -0
- data/app/components/solidus_admin/shipping/component.yml +3 -0
- data/app/components/solidus_admin/shipping_categories/index/component.html.erb +32 -0
- data/app/components/solidus_admin/shipping_categories/index/component.rb +46 -0
- data/app/components/solidus_admin/shipping_categories/index/component.yml +4 -0
- data/app/components/solidus_admin/shipping_methods/index/component.html.erb +32 -0
- data/app/components/solidus_admin/shipping_methods/index/component.rb +61 -0
- data/app/components/solidus_admin/shipping_methods/index/component.yml +4 -0
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +89 -0
- data/app/components/solidus_admin/stock_items/edit/component.js +17 -0
- data/app/components/solidus_admin/stock_items/edit/component.rb +23 -0
- data/app/components/solidus_admin/stock_items/edit/component.yml +10 -0
- data/app/components/solidus_admin/stock_items/index/component.html.erb +26 -0
- data/app/components/solidus_admin/stock_items/index/component.rb +180 -0
- data/app/components/solidus_admin/stock_items/index/component.yml +10 -0
- data/app/components/solidus_admin/stock_locations/index/component.html.erb +32 -0
- data/app/components/solidus_admin/stock_locations/index/component.rb +81 -0
- data/app/components/solidus_admin/stock_locations/index/component.yml +6 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +52 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/stores/index/component.html.erb +34 -0
- data/app/components/solidus_admin/stores/index/component.rb +59 -0
- data/app/components/solidus_admin/stores/index/component.yml +4 -0
- data/app/components/solidus_admin/tax_categories/index/component.html.erb +32 -0
- data/app/components/solidus_admin/tax_categories/index/component.rb +58 -0
- data/app/components/solidus_admin/tax_categories/index/component.yml +6 -0
- data/app/components/solidus_admin/tax_rates/index/component.html.erb +32 -0
- data/app/components/solidus_admin/tax_rates/index/component.rb +84 -0
- data/app/components/solidus_admin/tax_rates/index/component.yml +4 -0
- data/app/components/solidus_admin/taxes/component.html.erb +24 -0
- data/app/components/solidus_admin/taxes/component.rb +25 -0
- data/app/components/solidus_admin/taxes/component.yml +3 -0
- data/app/components/solidus_admin/taxonomies/index/component.html.erb +28 -0
- data/app/components/solidus_admin/taxonomies/index/component.rb +47 -0
- data/app/components/solidus_admin/taxonomies/index/component.yml +4 -0
- data/app/components/solidus_admin/ui/badge/component.rb +18 -8
- data/app/components/solidus_admin/ui/badge/component.yml +3 -0
- data/app/components/solidus_admin/ui/button/component.rb +32 -32
- data/app/components/solidus_admin/ui/details_list/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/details_list/component.rb +7 -0
- data/app/components/solidus_admin/ui/dropdown/component.html.erb +50 -0
- data/app/components/solidus_admin/ui/dropdown/component.js +16 -0
- data/app/components/solidus_admin/ui/dropdown/component.rb +28 -0
- data/app/components/solidus_admin/ui/dropdown/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/address/component.html.erb +36 -0
- data/app/components/solidus_admin/ui/forms/address/component.js +34 -0
- data/app/components/solidus_admin/ui/forms/address/component.rb +14 -0
- data/app/components/solidus_admin/ui/forms/field/component.html.erb +5 -4
- data/app/components/solidus_admin/ui/forms/field/component.rb +53 -15
- data/app/components/solidus_admin/ui/forms/input/component.rb +11 -5
- data/app/components/solidus_admin/ui/forms/search/component.html.erb +52 -0
- data/app/components/solidus_admin/ui/forms/search/component.js +116 -0
- data/app/components/solidus_admin/ui/forms/search/component.rb +8 -0
- data/app/components/solidus_admin/ui/forms/search/component.yml +4 -0
- data/app/components/solidus_admin/ui/forms/search/result/component.rb +12 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.html.erb +20 -0
- data/app/{javascript/solidus_admin/controllers/hello_controller.js → components/solidus_admin/ui/forms/search_field/component.js} +4 -2
- data/app/components/solidus_admin/ui/forms/search_field/component.rb +10 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/switch/component.rb +27 -31
- data/app/components/solidus_admin/ui/forms/switch_field/component.html.erb +20 -0
- data/app/components/solidus_admin/ui/forms/switch_field/component.rb +11 -0
- data/app/components/solidus_admin/ui/icon/component.rb +4 -0
- data/app/components/solidus_admin/ui/modal/component.html.erb +37 -0
- data/app/components/solidus_admin/ui/modal/component.rb +12 -0
- data/app/components/solidus_admin/ui/modal/component.yml +2 -0
- data/app/components/solidus_admin/ui/panel/component.html.erb +26 -12
- data/app/components/solidus_admin/ui/panel/component.rb +17 -0
- data/app/components/solidus_admin/ui/panel/component.yml +1 -3
- data/app/components/solidus_admin/ui/resource_item/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/resource_item/component.rb +9 -0
- data/app/components/solidus_admin/ui/tab/component.rb +9 -8
- data/app/components/solidus_admin/ui/table/component.html.erb +146 -135
- data/app/components/solidus_admin/ui/table/component.js +56 -17
- data/app/components/solidus_admin/ui/table/component.rb +94 -70
- data/app/components/solidus_admin/ui/table/component.yml +0 -1
- data/app/components/solidus_admin/ui/table/ransack_filter/component.html.erb +72 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.js +73 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.rb +68 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.yml +3 -0
- data/app/components/solidus_admin/ui/table/toolbar/component.rb +21 -0
- data/app/components/solidus_admin/ui/thumbnail/component.rb +46 -0
- data/app/components/solidus_admin/ui/toast/component.html.erb +9 -5
- data/app/components/solidus_admin/ui/toast/component.js +9 -6
- data/app/components/solidus_admin/ui/toast/component.rb +2 -2
- data/app/components/solidus_admin/ui/toggletip/component.html.erb +14 -10
- data/app/components/solidus_admin/ui/toggletip/component.js +22 -4
- data/app/components/solidus_admin/ui/toggletip/component.rb +8 -85
- data/app/components/solidus_admin/users/index/component.html.erb +34 -0
- data/app/components/solidus_admin/users/index/component.rb +89 -0
- data/app/components/solidus_admin/users/index/component.yml +18 -0
- data/app/components/solidus_admin/zones/index/component.html.erb +35 -0
- data/app/components/solidus_admin/zones/index/component.rb +55 -0
- data/app/components/solidus_admin/zones/index/component.yml +4 -0
- data/app/controllers/solidus_admin/addresses_controller.rb +92 -0
- data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/base_controller.rb +1 -0
- data/app/controllers/solidus_admin/controller_helpers/authorization.rb +5 -1
- data/app/controllers/solidus_admin/controller_helpers/locale.rb +2 -2
- data/app/controllers/solidus_admin/controller_helpers/search.rb +48 -0
- data/app/controllers/solidus_admin/controller_helpers/theme.rb +30 -0
- data/app/controllers/solidus_admin/countries_controller.rb +12 -0
- data/app/controllers/solidus_admin/customers_controller.rb +29 -0
- data/app/controllers/solidus_admin/line_items_controller.rb +45 -0
- data/app/controllers/solidus_admin/option_types_controller.rb +46 -0
- data/app/controllers/solidus_admin/orders_controller.rb +104 -7
- data/app/controllers/solidus_admin/payment_methods_controller.rb +52 -0
- data/app/controllers/solidus_admin/products_controller.rb +26 -17
- data/app/controllers/solidus_admin/promotion_categories_controller.rb +38 -0
- data/app/controllers/solidus_admin/promotions_controller.rb +46 -0
- data/app/controllers/solidus_admin/properties_controller.rb +33 -0
- data/app/controllers/solidus_admin/refund_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/reimbursement_types_controller.rb +31 -0
- data/app/controllers/solidus_admin/return_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_methods_controller.rb +40 -0
- data/app/controllers/solidus_admin/stock_items_controller.rb +67 -0
- data/app/controllers/solidus_admin/stock_locations_controller.rb +40 -0
- data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/stores_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_rates_controller.rb +40 -0
- data/app/controllers/solidus_admin/taxonomies_controller.rb +46 -0
- data/app/controllers/solidus_admin/users_controller.rb +50 -0
- data/app/controllers/solidus_admin/zones_controller.rb +40 -0
- data/app/javascript/solidus_admin/controllers/components.js +3 -1
- data/app/javascript/solidus_admin/controllers/confirm_controller.js +21 -0
- data/app/javascript/solidus_admin/controllers/details_click_outside_controller.js +12 -0
- data/app/javascript/solidus_admin/controllers/readonly_when_submitting_controller.js +17 -0
- data/app/javascript/solidus_admin/controllers/sortable_controller.js +33 -0
- data/app/views/layouts/solidus_admin/application.html.erb +16 -10
- data/app/views/layouts/solidus_admin/preview.html.erb +0 -1
- data/app/views/solidus_admin/base/unauthorized.html.erb +4 -0
- data/config/importmap.rb +2 -0
- data/config/initializers/view_component.rb +20 -0
- data/config/locales/adjustment_reasons.en.yml +6 -0
- data/config/locales/customers.en.yml +7 -0
- data/config/locales/errors.en.yml +7 -0
- data/config/locales/line_items.en.yml +9 -0
- data/config/locales/{main_nav.en.yml → menu_item.en.yml} +8 -2
- data/config/locales/option_types.en.yml +6 -0
- data/config/locales/orders.en.yml +9 -0
- data/config/locales/payment_methods.en.yml +6 -0
- data/config/locales/promotion_categories.en.yml +6 -0
- data/config/locales/promotions.en.yml +6 -0
- data/config/locales/properties.en.yml +6 -0
- data/config/locales/refund_reasons_.en.yml +6 -0
- data/config/locales/reimbursement_types.en.yml +4 -0
- data/config/locales/return_reasons.en.yml +6 -0
- data/config/locales/shipping_categories.en.yml +6 -0
- data/config/locales/shipping_methods.en.yml +6 -0
- data/config/locales/stock_items.en.yml +4 -0
- data/config/locales/stock_locations.en.yml +6 -0
- data/config/locales/store_credit_reasons.en.yml +6 -0
- data/config/locales/stores.en.yml +6 -0
- data/config/locales/tax_categories.en.yml +6 -0
- data/config/locales/tax_rates.en.yml +6 -0
- data/config/locales/taxonomies.en.yml +6 -0
- data/config/locales/users.en.yml +6 -0
- data/config/locales/zones.en.yml +6 -0
- data/config/routes.rb +50 -3
- data/config/tailwind.config.js +119 -0
- data/docs/{customizing_main_navigation.md → customizing_menu_items.md} +2 -2
- data/docs/customizing_tailwindcss.md +57 -0
- data/docs/customizing_view_components.md +17 -38
- data/lib/generators/solidus_admin/install/install_generator.rb +13 -4
- data/lib/generators/solidus_admin/install/templates/config/initializers/{solidus_admin.rb → solidus_admin.rb.tt} +10 -14
- data/lib/solidus_admin/admin_resources.rb +23 -0
- data/lib/solidus_admin/configuration.rb +93 -67
- data/lib/solidus_admin/install_tailwindcss.rb +102 -0
- data/lib/solidus_admin/{main_nav_item.rb → menu_item.rb} +2 -2
- data/lib/solidus_admin/version.rb +1 -1
- data/lib/solidus_admin.rb +1 -2
- data/lib/tasks/tailwind.rake +10 -0
- data/solidus_admin.gemspec +3 -4
- metadata +228 -48
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css.erb +0 -35
- data/app/components/solidus_admin/feedback/component.html.erb +0 -11
- data/app/components/solidus_admin/feedback/component.rb +0 -4
- data/app/components/solidus_admin/feedback/component.yml +0 -5
- data/app/components/solidus_admin/sidebar/account_nav/component.html.erb +0 -67
- data/app/components/solidus_admin/sidebar/account_nav/component.rb +0 -15
- data/app/components/solidus_admin/sidebar/component.rb +0 -21
- data/app/components/solidus_admin/ui/panel/component.js +0 -14
- data/config/solidus_admin/tailwind.config.js.erb +0 -95
- data/docs/customizing_tailwind.md +0 -78
- data/lib/solidus_admin/tailwindcss.rb +0 -58
- data/lib/tasks/tailwindcss.rake +0 -55
- /data/app/components/solidus_admin/{sidebar/account_nav → layout/navigation/account}/component.yml +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.js +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.yml +0 -0
- /data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.yml +0 -0
@@ -17,38 +17,6 @@ module SolidusAdmin
|
|
17
17
|
# The default value is the Solidus logo that lives in the solidus_core gem.
|
18
18
|
preference :logo_path, :string, default: "logo/solidus.svg"
|
19
19
|
|
20
|
-
# The list of paths were Tailwind CSS classes are used.
|
21
|
-
#
|
22
|
-
# You can modify this list to include your own paths:
|
23
|
-
#
|
24
|
-
# SolidusAdmin::Config.tailwind_content << Rails.root.join("app/my/custom/path")
|
25
|
-
#
|
26
|
-
# Recompile with `bin/rails solidus_admin:tailwindcss:build` after changing this list.
|
27
|
-
#
|
28
|
-
# @see https://tailwindcss.com/docs/configuration#content
|
29
|
-
preference :tailwind_content, :array, default: [
|
30
|
-
"#{ENGINE_ROOT}/app/helpers/**/*.rb",
|
31
|
-
"#{ENGINE_ROOT}/app/assets/javascripts/**/*.js",
|
32
|
-
"#{ENGINE_ROOT}/app/views/**/*.erb",
|
33
|
-
"#{ENGINE_ROOT}/app/components/**/*.{rb,erb,js}",
|
34
|
-
"#{ENGINE_ROOT}/spec/components/previews/**/*.{erb,rb}",
|
35
|
-
|
36
|
-
Rails.root&.join("public/solidus_admin/*.html"),
|
37
|
-
Rails.root&.join("app/helpers/solidus_admin/**/*.rb"),
|
38
|
-
Rails.root&.join("app/assets/javascripts/solidus_admin/**/*.js"),
|
39
|
-
Rails.root&.join("app/views/solidus_admin/**/*.{erb,haml,html,slim}"),
|
40
|
-
Rails.root&.join("app/components/solidus_admin/**/*.{rb,erb,haml,html,slim,js}")
|
41
|
-
].compact
|
42
|
-
|
43
|
-
# List of Tailwind CSS files to be combined into the final stylesheet.
|
44
|
-
#
|
45
|
-
# You can modify this list to include your own files:
|
46
|
-
#
|
47
|
-
# SolidusAdmin::Config.tailwind_stylesheets << Rails.root.join("app/assets/stylesheets/solidus_admin/application.tailwind.css")
|
48
|
-
#
|
49
|
-
# Recompile with `bin/rails solidus_admin:tailwindcss:build` after changing this list.
|
50
|
-
preference :tailwind_stylesheets, :array, default: []
|
51
|
-
|
52
20
|
# List of paths to watch for changes to trigger a cache sweep forcing a regeneration of the importmap.
|
53
21
|
#
|
54
22
|
# @see https://github.com/rails/importmap-rails#sweeping-the-cache-in-development-and-test
|
@@ -65,33 +33,18 @@ module SolidusAdmin
|
|
65
33
|
"#{ENGINE_ROOT}/config/importmap.rb",
|
66
34
|
]
|
67
35
|
|
68
|
-
# @!attribute [rw]
|
69
|
-
# @return [Integer] The
|
70
|
-
#
|
71
|
-
#
|
72
|
-
preference :
|
73
|
-
|
74
|
-
# @!attribute [rw]
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
|
80
|
-
# @return [String] The search key used to determine order attributes for search.
|
81
|
-
preference :order_search_key, :string, default: :number_or_shipments_number_or_bill_address_name_or_email_or_order_promotions_promotion_code_value_cont
|
82
|
-
|
83
|
-
# @!attribute [rw] products_per_page
|
84
|
-
# @return [Integer] The number of products to display per page in the admin interface.
|
85
|
-
# This preference determines the pagination limit for the product listing.
|
86
|
-
# The default value is fetched from the Spree core configuration and currently set to 10.
|
87
|
-
preference :products_per_page, :integer, default: Spree::Config[:admin_products_per_page]
|
88
|
-
|
89
|
-
# @!attribute [rw] product_search_key
|
90
|
-
# @return [String] The key to use when searching for products in the admin interface.
|
91
|
-
# This preference determines the product attribute to use for search.
|
92
|
-
# By default, it is set to 'name_or_variants_including_master_sku_cont',
|
93
|
-
# meaning it will search by product name or product variants sku.
|
94
|
-
preference :product_search_key, :string, default: :name_or_variants_including_master_sku_cont
|
36
|
+
# @!attribute [rw] low_stock_value
|
37
|
+
# @return [Integer] The low stock value determines the threshold at which products are considered low in stock.
|
38
|
+
# Products with a count_on_hand less than or equal to this value will be considered low in stock.
|
39
|
+
# Default: 10
|
40
|
+
preference :low_stock_value, :integer, default: 10
|
41
|
+
|
42
|
+
# @!attribute [rw] enable_alpha_features?
|
43
|
+
# @return [Boolean] Determines whether alpha features are enabled or disabled in the application.
|
44
|
+
# Setting this to `true` enables access to alpha stage features that might still be in testing or development.
|
45
|
+
# Use with caution, as these features may not be fully stable or complete.
|
46
|
+
# Default: false
|
47
|
+
preference :enable_alpha_features?, :boolean, default: false
|
95
48
|
|
96
49
|
preference :storefront_product_path_proc, :proc, default: ->(_version) {
|
97
50
|
->(product) { "/products/#{product.slug}" }
|
@@ -186,16 +139,69 @@ module SolidusAdmin
|
|
186
139
|
]
|
187
140
|
end
|
188
141
|
|
142
|
+
def import_menu_items_from_backend!
|
143
|
+
menu_item_to_hash = ->(item, index) do
|
144
|
+
route =
|
145
|
+
if item.url.is_a?(Symbol)
|
146
|
+
-> { solidus_admin.public_send(item.url) }
|
147
|
+
elsif item.url.is_a?(String)
|
148
|
+
-> { item.url }
|
149
|
+
elsif item.url.is_a?(Proc)
|
150
|
+
item.url
|
151
|
+
elsif item.url.nil?
|
152
|
+
-> { spree.public_send(:"admin_#{item.label}_path") }
|
153
|
+
else
|
154
|
+
raise ArgumentError, "Unknown url type #{item.url.class}"
|
155
|
+
end
|
156
|
+
|
157
|
+
match_path =
|
158
|
+
case item.match_path
|
159
|
+
when Regexp then -> { _1 =~ item.match_path }
|
160
|
+
when Proc then item.match_path
|
161
|
+
when String then -> { _1.start_with?("/admin#{item.match_path}") }
|
162
|
+
when nil then -> { _1.start_with?(route.call) }
|
163
|
+
else raise ArgumentError, "Unknown match_path type #{item.match_path.class}"
|
164
|
+
end
|
165
|
+
|
166
|
+
icon =
|
167
|
+
case item.icon
|
168
|
+
when /^ri-/
|
169
|
+
item.icon.delete_prefix("ri-")
|
170
|
+
when String
|
171
|
+
'record-circle-line' # fallback on a generic icon
|
172
|
+
end
|
173
|
+
|
174
|
+
{
|
175
|
+
position: index,
|
176
|
+
key: item.label,
|
177
|
+
icon: icon,
|
178
|
+
route: route,
|
179
|
+
children: item.children.map.with_index(&menu_item_to_hash),
|
180
|
+
match_path: match_path,
|
181
|
+
}
|
182
|
+
end
|
183
|
+
|
184
|
+
@menu_items = Spree::Backend::Config.menu_items.map.with_index(&menu_item_to_hash)
|
185
|
+
end
|
186
|
+
|
189
187
|
def components
|
190
188
|
@components ||= Hash.new do |_h, k|
|
191
|
-
"solidus_admin/#{k}/component".classify
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
189
|
+
const_name = "solidus_admin/#{k}/component".classify
|
190
|
+
|
191
|
+
unless Object.const_defined?(const_name)
|
192
|
+
prefix = "#{ENGINE_ROOT}/app/components/solidus_admin/"
|
193
|
+
suffix = "/component.rb"
|
194
|
+
dictionary = Dir["#{prefix}**#{suffix}"].map { _1.delete_prefix(prefix).delete_suffix(suffix) }
|
195
|
+
corrections = DidYouMean::SpellChecker.new(dictionary: dictionary).correct(k.to_s)
|
196
|
+
|
197
|
+
raise ComponentNotFoundError.new(
|
198
|
+
"Unknown component #{k}#{DidYouMean.formatter.message_for(corrections)}",
|
199
|
+
k.classify,
|
200
|
+
receiver: ::SolidusAdmin
|
201
|
+
)
|
202
|
+
end
|
203
|
+
|
204
|
+
const_name.constantize
|
199
205
|
end
|
200
206
|
end
|
201
207
|
|
@@ -211,6 +217,26 @@ module SolidusAdmin
|
|
211
217
|
|
212
218
|
# The HTTP method used to logout the user in the admin interface.
|
213
219
|
preference :logout_link_method, :string, default: :delete
|
220
|
+
|
221
|
+
# @!attribute [rw] themes
|
222
|
+
# @return [Hash] A hash containing the themes that are available for the admin panel
|
223
|
+
preference :themes, :hash, default: {
|
224
|
+
solidus: 'solidus_admin/application',
|
225
|
+
solidus_dark: 'solidus_admin/dark',
|
226
|
+
solidus_dimmed: 'solidus_admin/dimmed',
|
227
|
+
}
|
228
|
+
|
229
|
+
# @!attribute [rw] theme
|
230
|
+
# @return [String] Default admin theme name
|
231
|
+
preference :theme, :string, default: 'solidus'
|
232
|
+
|
233
|
+
# @!attribute [rw] dark_theme
|
234
|
+
# @return [String] Default admin theme name
|
235
|
+
preference :dark_theme, :string, default: 'solidus_dark'
|
236
|
+
|
237
|
+
def theme_path(user_theme)
|
238
|
+
themes.fetch(user_theme&.to_sym, themes[theme.to_sym])
|
239
|
+
end
|
214
240
|
end
|
215
241
|
end
|
216
242
|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is a Rails app template and should be loaded with `bin/rails `.
|
4
|
+
|
5
|
+
engine_root = File.expand_path("#{__dir__}/../..")
|
6
|
+
config_path = "config/solidus_admin/tailwind.config.js"
|
7
|
+
input_path = "app/assets/stylesheets/solidus_admin/application.tailwind.css"
|
8
|
+
output_path = "app/assets/builds/solidus_admin/tailwind.css"
|
9
|
+
|
10
|
+
unless bundle_command "show tailwindcss-rails"
|
11
|
+
bundle_command "add tailwindcss-rails"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Copy the Tailwind CSS main file.
|
15
|
+
create_file input_path, File.read("#{engine_root}/app/assets/stylesheets/solidus_admin/application.tailwind.css")
|
16
|
+
|
17
|
+
create_file config_path, <<~JS
|
18
|
+
const { execSync } = require('child_process')
|
19
|
+
const adminRoot = execSync('bundle show solidus_admin').toString().trim()
|
20
|
+
const solidusAdmin = require(`${adminRoot}/config/tailwind.config.js`)
|
21
|
+
|
22
|
+
module.exports = {
|
23
|
+
// Read how to use TailwindCSS presets: https://tailwindcss.com/docs/presets.
|
24
|
+
presets: [solidusAdmin],
|
25
|
+
|
26
|
+
content: [
|
27
|
+
// Include paths coming from SolidusAdmin.
|
28
|
+
...solidusAdmin.content,
|
29
|
+
|
30
|
+
// Include paths to your own components.
|
31
|
+
`${__dirname}/../../app/components/admin/**/*`,
|
32
|
+
],
|
33
|
+
}
|
34
|
+
JS
|
35
|
+
|
36
|
+
create_file "lib/tasks/solidus_admin/tailwind.rake", <<~RUBY
|
37
|
+
# frozen_string_literal: true
|
38
|
+
|
39
|
+
namespace :solidus_admin do
|
40
|
+
namespace :tailwindcss do
|
41
|
+
root = Rails.root
|
42
|
+
tailwindcss = Tailwindcss::Commands.executable
|
43
|
+
|
44
|
+
tailwindcss_command = [
|
45
|
+
tailwindcss,
|
46
|
+
"--config", root.join(#{config_path.to_s.inspect}),
|
47
|
+
"--input", root.join(#{input_path.to_s.inspect}),
|
48
|
+
"--output", root.join(#{output_path.to_s.inspect}),
|
49
|
+
]
|
50
|
+
|
51
|
+
desc 'Build Tailwind CSS'
|
52
|
+
task :build do
|
53
|
+
sh tailwindcss_command.shelljoin
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Watch Tailwind CSS'
|
57
|
+
task :watch do
|
58
|
+
sh (tailwindcss_command + ['--watch']).shelljoin
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Attach Tailwind CSS build to other tasks.
|
64
|
+
%w[
|
65
|
+
assets:precompile
|
66
|
+
test:prepare
|
67
|
+
spec:prepare
|
68
|
+
db:test:prepare
|
69
|
+
].each do |task_name|
|
70
|
+
next unless Rake::Task.task_defined?(task_name)
|
71
|
+
|
72
|
+
Rake::Task[task_name].enhance(['solidus_admin:tailwindcss:build'])
|
73
|
+
end
|
74
|
+
RUBY
|
75
|
+
|
76
|
+
append_file ".gitignore", "app/assets/builds/solidus_admin/"
|
77
|
+
|
78
|
+
unless Rails.root.join("Procfile.dev").exist?
|
79
|
+
create_file "Procfile.dev", <<~YAML
|
80
|
+
web: bin/rails server
|
81
|
+
YAML
|
82
|
+
end
|
83
|
+
|
84
|
+
unless Rails.root.join("bin/dev").exist?
|
85
|
+
create_file "bin/dev", <<~SH
|
86
|
+
#!/usr/bin/env sh
|
87
|
+
|
88
|
+
if ! gem list foreman -i --silent; then
|
89
|
+
echo "Installing foreman..."
|
90
|
+
gem install foreman
|
91
|
+
fi
|
92
|
+
|
93
|
+
# Default to port 3000 if not specified
|
94
|
+
export PORT="${PORT:-3000}"
|
95
|
+
|
96
|
+
exec foreman start -f Procfile.dev "$@"
|
97
|
+
SH
|
98
|
+
|
99
|
+
run "chmod +x bin/dev"
|
100
|
+
end
|
101
|
+
|
102
|
+
append_to_file "Procfile.dev", "admin_css: bin/rails solidus_admin:tailwindcss:watch\n"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module SolidusAdmin
|
4
4
|
# Encapsulates the data for a main navigation item.
|
5
|
-
class
|
5
|
+
class MenuItem
|
6
6
|
# @!attribute [r] key
|
7
7
|
# @return [String] a unique identifier for this item
|
8
8
|
attr_reader :key
|
@@ -45,7 +45,7 @@ module SolidusAdmin
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def name
|
48
|
-
I18n.t("solidus_admin.
|
48
|
+
I18n.t("solidus_admin.menu_item.#{key}", default: key.to_s.humanize)
|
49
49
|
end
|
50
50
|
|
51
51
|
# @return [Boolean] whether this item has any children
|
data/lib/solidus_admin.rb
CHANGED
@@ -6,9 +6,8 @@ require "solidus_backend"
|
|
6
6
|
module SolidusAdmin
|
7
7
|
require "solidus_admin/version"
|
8
8
|
require "solidus_admin/importmap"
|
9
|
-
require "solidus_admin/
|
9
|
+
require "solidus_admin/menu_item"
|
10
10
|
require "solidus_admin/preview"
|
11
|
-
require "solidus_admin/tailwindcss"
|
12
11
|
|
13
12
|
require "solidus_admin/configuration"
|
14
13
|
require "solidus_admin/engine"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :solidus_admin do
|
4
|
+
namespace :tailwindcss do
|
5
|
+
desc 'Install Tailwind CSS on the host application'
|
6
|
+
task :install do
|
7
|
+
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION='#{__dir__}/../solidus_admin/install_tailwindcss.rb'"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/solidus_admin.gemspec
CHANGED
@@ -19,17 +19,16 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
21
|
f.match(%r{^(spec|script)/})
|
22
|
-
end
|
22
|
+
end + ["app/assets/builds/solidus_admin/tailwind.css"]
|
23
23
|
|
24
24
|
s.required_ruby_version = '>= 3.0.0'
|
25
25
|
s.required_rubygems_version = '>= 1.8.23'
|
26
26
|
|
27
27
|
s.add_dependency 'geared_pagination', '~> 1.1'
|
28
28
|
s.add_dependency 'importmap-rails', '~> 1.2', '>= 1.2.1'
|
29
|
-
s.add_dependency 'solidus_backend'
|
30
|
-
s.add_dependency 'solidus_core',
|
29
|
+
s.add_dependency 'solidus_backend'
|
30
|
+
s.add_dependency 'solidus_core', '> 4.2'
|
31
31
|
s.add_dependency 'stimulus-rails', '~> 1.2'
|
32
|
-
s.add_dependency 'tailwindcss-rails', '~> 2.0'
|
33
32
|
s.add_dependency 'turbo-rails', '~> 1.4'
|
34
33
|
s.add_dependency 'view_component', '~> 3.3'
|
35
34
|
end
|