solidus_admin 0.4.1 → 0.5.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.
- checksums.yaml +4 -4
- data/LICENSE +23 -4
- data/README.md +6 -1
- data/Rakefile +15 -15
- data/app/assets/builds/solidus_admin/tailwind.css +721 -44
- data/app/assets/images/solidus_admin/remixicon.license.txt +196 -0
- data/app/assets/images/solidus_admin/remixicon.symbol.svg +4 -4
- data/app/blueprints/solidus_admin/state_blueprint.rb +13 -0
- data/app/components/concerns/solidus_admin/slotable_default.rb +42 -0
- data/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb +6 -15
- data/app/components/solidus_admin/adjustment_reasons/edit/component.yml +0 -1
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +13 -13
- data/app/components/solidus_admin/adjustment_reasons/new/component.html.erb +6 -15
- data/app/components/solidus_admin/adjustment_reasons/new/component.yml +0 -1
- data/app/components/solidus_admin/base_component.rb +7 -3
- data/app/components/solidus_admin/layout/confirm/component.html.erb +18 -0
- data/app/components/solidus_admin/layout/confirm/component.js +21 -0
- data/app/components/solidus_admin/layout/confirm/component.rb +26 -0
- data/app/components/solidus_admin/layout/confirm/component.yml +4 -0
- data/app/components/solidus_admin/layout/flashes/alerts/component.html.erb +7 -0
- data/app/components/solidus_admin/layout/flashes/alerts/component.rb +19 -0
- data/app/components/solidus_admin/layout/flashes/component.html.erb +5 -0
- data/app/components/solidus_admin/layout/flashes/component.rb +4 -0
- data/app/components/solidus_admin/layout/flashes/toasts/component.html.erb +5 -0
- data/app/components/solidus_admin/layout/flashes/toasts/component.rb +9 -0
- data/app/components/solidus_admin/layout/navigation/account/component.html.erb +12 -1
- data/app/components/solidus_admin/layout/navigation/account/component.rb +4 -4
- data/app/components/solidus_admin/layout/page_helpers.rb +3 -9
- data/app/components/solidus_admin/layout/skip_link/component.rb +3 -3
- data/app/components/solidus_admin/option_types/edit/component.html.erb +44 -0
- data/app/components/solidus_admin/option_types/edit/component.rb +5 -0
- data/app/components/solidus_admin/option_types/edit/component.yml +10 -0
- data/app/components/solidus_admin/option_types/index/component.rb +22 -22
- data/app/components/solidus_admin/option_types/new/component.html.erb +16 -0
- data/app/components/solidus_admin/option_types/new/component.rb +4 -0
- data/app/components/solidus_admin/option_types/new/component.yml +4 -0
- data/app/components/solidus_admin/option_values/edit/component.html.erb +16 -0
- data/app/components/solidus_admin/option_values/edit/component.rb +4 -0
- data/app/components/solidus_admin/option_values/edit/component.yml +4 -0
- data/app/components/solidus_admin/option_values/new/component.html.erb +16 -0
- data/app/components/solidus_admin/option_values/new/component.rb +7 -0
- data/app/components/solidus_admin/option_values/new/component.yml +4 -0
- data/app/components/solidus_admin/option_values/table/component.rb +53 -0
- data/app/components/solidus_admin/option_values/table/component.yml +3 -0
- data/app/components/solidus_admin/orders/cart/component.html.erb +5 -7
- data/app/components/solidus_admin/orders/cart/result/component.html.erb +2 -2
- data/app/components/solidus_admin/orders/index/component.rb +26 -26
- data/app/components/solidus_admin/orders/show/address/component.html.erb +8 -20
- data/app/components/solidus_admin/orders/show/address/component.rb +7 -7
- data/app/components/solidus_admin/orders/show/address/component.yml +0 -1
- data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/spree_shipment/component.rb +1 -1
- data/app/components/solidus_admin/orders/show/adjustments/index/component.rb +24 -21
- data/app/components/solidus_admin/orders/show/component.html.erb +2 -2
- data/app/components/solidus_admin/orders/show/component.rb +1 -1
- data/app/components/solidus_admin/orders/show/component.yml +0 -3
- data/app/components/solidus_admin/orders/show/customer_search/result/component.html.erb +2 -2
- data/app/components/solidus_admin/orders/show/email/component.html.erb +2 -2
- data/app/components/solidus_admin/payment_methods/edit/component.html.erb +13 -0
- data/app/components/solidus_admin/payment_methods/edit/component.rb +7 -0
- data/app/components/solidus_admin/payment_methods/edit/component.yml +2 -0
- data/app/components/solidus_admin/payment_methods/form/component.html.erb +29 -0
- data/app/components/solidus_admin/payment_methods/form/component.rb +34 -0
- data/app/components/solidus_admin/payment_methods/form/component.yml +15 -0
- data/app/components/solidus_admin/payment_methods/index/component.rb +24 -23
- data/app/components/solidus_admin/payment_methods/new/component.html.erb +12 -0
- data/app/components/solidus_admin/payment_methods/new/component.rb +7 -0
- data/app/components/solidus_admin/payment_methods/new/component.yml +2 -0
- data/app/components/solidus_admin/products/index/component.rb +26 -26
- data/app/components/solidus_admin/products/show/categories/new/component.html.erb +17 -0
- data/app/components/solidus_admin/products/show/categories/new/component.rb +17 -0
- data/app/components/solidus_admin/products/show/categories/new/component.yml +5 -0
- data/app/components/solidus_admin/products/show/component.html.erb +90 -66
- data/app/components/solidus_admin/products/show/component.rb +2 -2
- data/app/components/solidus_admin/products/show/component.yml +23 -11
- data/app/components/solidus_admin/products/status/component.rb +1 -1
- data/app/components/solidus_admin/products/stock/component.rb +7 -7
- data/app/components/solidus_admin/properties/edit/component.html.erb +5 -5
- data/app/components/solidus_admin/properties/index/component.rb +13 -13
- data/app/components/solidus_admin/properties/new/component.html.erb +5 -5
- data/app/components/solidus_admin/refund_reasons/edit/component.html.erb +6 -15
- data/app/components/solidus_admin/refund_reasons/edit/component.yml +0 -1
- data/app/components/solidus_admin/refund_reasons/index/component.rb +13 -13
- data/app/components/solidus_admin/refund_reasons/new/component.html.erb +6 -14
- data/app/components/solidus_admin/refund_reasons/new/component.yml +0 -1
- data/app/components/solidus_admin/refunds_and_returns/component.rb +7 -7
- data/app/components/solidus_admin/reimbursement_types/index/component.rb +2 -2
- data/app/components/solidus_admin/return_reasons/edit/component.html.erb +5 -14
- data/app/components/solidus_admin/return_reasons/index/component.rb +11 -11
- data/app/components/solidus_admin/return_reasons/new/component.html.erb +5 -14
- data/app/components/solidus_admin/roles/edit/component.html.erb +12 -12
- data/app/components/solidus_admin/roles/edit/component.yml +0 -1
- data/app/components/solidus_admin/roles/index/component.rb +12 -12
- data/app/components/solidus_admin/roles/new/component.html.erb +12 -12
- data/app/components/solidus_admin/roles/new/component.yml +0 -1
- data/app/components/solidus_admin/shipping/component.rb +5 -5
- data/app/components/solidus_admin/shipping_categories/edit/component.html.erb +4 -4
- data/app/components/solidus_admin/shipping_categories/edit/component.yml +0 -1
- data/app/components/solidus_admin/shipping_categories/index/component.rb +9 -9
- data/app/components/solidus_admin/shipping_categories/new/component.html.erb +4 -4
- data/app/components/solidus_admin/shipping_categories/new/component.yml +0 -1
- data/app/components/solidus_admin/shipping_methods/index/component.rb +10 -10
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +5 -8
- data/app/components/solidus_admin/stock_items/edit/component.rb +2 -2
- data/app/components/solidus_admin/stock_items/index/component.rb +25 -25
- data/app/components/solidus_admin/stock_locations/edit/component.html.erb +16 -0
- data/app/components/solidus_admin/stock_locations/edit/component.rb +5 -0
- data/app/components/solidus_admin/stock_locations/edit/component.yml +2 -0
- data/app/components/solidus_admin/stock_locations/form/component.html.erb +65 -0
- data/app/components/solidus_admin/stock_locations/form/component.rb +11 -0
- data/app/components/solidus_admin/stock_locations/form/component.yml +19 -0
- data/app/components/solidus_admin/stock_locations/index/component.rb +94 -47
- data/app/components/solidus_admin/stock_locations/new/component.html.erb +16 -0
- data/app/components/solidus_admin/stock_locations/new/component.rb +16 -0
- data/app/components/solidus_admin/stock_locations/new/component.yml +2 -0
- data/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb +5 -14
- data/app/components/solidus_admin/store_credit_reasons/edit/component.yml +0 -1
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +11 -11
- data/app/components/solidus_admin/store_credit_reasons/new/component.html.erb +5 -14
- data/app/components/solidus_admin/store_credit_reasons/new/component.yml +0 -1
- data/app/components/solidus_admin/stores/edit/component.html.erb +27 -0
- data/app/components/solidus_admin/stores/edit/component.rb +5 -0
- data/app/components/solidus_admin/stores/form/component.html.erb +102 -0
- data/app/components/solidus_admin/stores/form/component.rb +27 -0
- data/app/components/solidus_admin/stores/form/component.yml +17 -0
- data/app/components/solidus_admin/stores/index/component.rb +51 -22
- data/app/components/solidus_admin/stores/new/component.html.erb +16 -0
- data/app/components/solidus_admin/stores/new/component.rb +5 -0
- data/app/components/solidus_admin/stores/new/component.yml +2 -0
- data/app/components/solidus_admin/tax_categories/edit/component.html.erb +7 -15
- data/app/components/solidus_admin/tax_categories/edit/component.yml +0 -1
- data/app/components/solidus_admin/tax_categories/index/component.rb +17 -17
- data/app/components/solidus_admin/tax_categories/new/component.html.erb +7 -15
- data/app/components/solidus_admin/tax_categories/new/component.yml +0 -1
- data/app/components/solidus_admin/tax_rates/edit/component.html.erb +12 -0
- data/app/components/solidus_admin/tax_rates/edit/component.rb +5 -0
- data/app/components/solidus_admin/tax_rates/edit/component.yml +4 -0
- data/app/components/solidus_admin/tax_rates/form/component.html.erb +25 -0
- data/app/components/solidus_admin/tax_rates/form/component.rb +29 -0
- data/app/components/solidus_admin/tax_rates/form/component.yml +9 -0
- data/app/components/solidus_admin/tax_rates/index/component.rb +38 -20
- data/app/components/solidus_admin/tax_rates/new/component.html.erb +12 -0
- data/app/components/solidus_admin/tax_rates/new/component.rb +5 -0
- data/app/components/solidus_admin/tax_rates/new/component.yml +4 -0
- data/app/components/solidus_admin/taxes/component.rb +4 -4
- data/app/components/solidus_admin/taxonomies/index/component.rb +7 -7
- data/app/components/solidus_admin/turbo/target_frame/component.html.erb +5 -0
- data/app/components/solidus_admin/turbo/target_frame/component.rb +8 -0
- data/app/components/solidus_admin/ui/alert/component.html.erb +35 -0
- data/app/components/solidus_admin/ui/alert/component.rb +51 -0
- data/app/components/solidus_admin/ui/alert/component.yml +8 -0
- data/app/components/solidus_admin/ui/badge/component.rb +11 -11
- data/app/components/solidus_admin/ui/button/component.rb +84 -27
- data/app/components/solidus_admin/ui/button/component.yml +10 -0
- data/app/components/solidus_admin/ui/checkbox/component.rb +42 -0
- data/app/components/solidus_admin/ui/dropdown/component.rb +3 -3
- data/app/components/solidus_admin/ui/forms/address/component.html.erb +1 -48
- data/app/components/solidus_admin/ui/forms/address/component.rb +29 -6
- data/app/components/solidus_admin/ui/forms/address/fields/city_and_zipcode/component.html.erb +4 -0
- data/app/components/solidus_admin/ui/forms/address/fields/city_and_zipcode/component.rb +8 -0
- data/app/components/solidus_admin/ui/forms/address/fields/country_and_state/component.html.erb +39 -0
- data/app/components/solidus_admin/ui/forms/address/{component.js → fields/country_and_state/component.js} +2 -0
- data/app/components/solidus_admin/ui/forms/address/fields/country_and_state/component.rb +15 -0
- data/app/components/solidus_admin/ui/forms/address/fields/reverse_charge_fields/component.html.erb +7 -0
- data/app/components/solidus_admin/ui/forms/address/fields/reverse_charge_fields/component.rb +12 -0
- data/app/components/solidus_admin/ui/forms/address/fieldsets/base.rb +54 -0
- data/app/components/solidus_admin/ui/forms/address/fieldsets/contact/component.rb +16 -0
- data/app/components/solidus_admin/ui/forms/address/fieldsets/contact_info/component.rb +10 -0
- data/app/components/solidus_admin/ui/forms/address/fieldsets/location/component.rb +14 -0
- data/app/components/solidus_admin/ui/forms/checkbox/component.html.erb +14 -0
- data/app/components/solidus_admin/ui/forms/checkbox/component.rb +24 -31
- data/app/components/solidus_admin/ui/forms/field/component.html.erb +4 -4
- data/app/components/solidus_admin/ui/forms/field/component.rb +14 -18
- data/app/components/solidus_admin/ui/forms/input/component.rb +9 -18
- data/app/components/solidus_admin/ui/forms/search/result/component.rb +2 -2
- data/app/components/solidus_admin/ui/forms/select/component.html.erb +21 -0
- data/app/components/solidus_admin/ui/forms/select/component.rb +157 -0
- data/app/components/solidus_admin/ui/forms/switch/component.rb +4 -4
- data/app/components/solidus_admin/ui/icon/component.rb +4 -4
- data/app/components/solidus_admin/ui/icon/names.txt +973 -238
- data/app/components/solidus_admin/ui/modal/component.html.erb +2 -4
- data/app/components/solidus_admin/ui/modal/component.js +7 -1
- data/app/components/solidus_admin/ui/modal/component.rb +2 -2
- data/app/components/solidus_admin/ui/pages/index/component.rb +50 -19
- data/app/components/solidus_admin/ui/panel/component.rb +5 -9
- data/app/components/solidus_admin/ui/radio/component.rb +29 -0
- data/app/components/solidus_admin/ui/tab/component.rb +4 -4
- data/app/components/solidus_admin/ui/table/component.html.erb +11 -10
- data/app/components/solidus_admin/ui/table/component.js +18 -26
- data/app/components/solidus_admin/ui/table/component.rb +24 -18
- data/app/components/solidus_admin/ui/table/component.yml +1 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.html.erb +1 -1
- data/app/components/solidus_admin/ui/table/ransack_filter/component.rb +7 -7
- data/app/components/solidus_admin/ui/thumbnail/component.rb +5 -5
- data/app/components/solidus_admin/ui/toast/component.html.erb +6 -6
- data/app/components/solidus_admin/ui/toast/component.rb +1 -1
- data/app/components/solidus_admin/ui/toggletip/component.rb +1 -1
- data/app/components/solidus_admin/users/addresses/component.html.erb +3 -5
- data/app/components/solidus_admin/users/addresses/component.rb +0 -30
- data/app/components/solidus_admin/users/addresses/component.yml +0 -7
- data/app/components/solidus_admin/users/edit/api_access/component.html.erb +6 -4
- data/app/components/solidus_admin/users/edit/api_access/component.yml +8 -2
- data/app/components/solidus_admin/users/edit/component.html.erb +15 -12
- data/app/components/solidus_admin/users/edit/component.rb +1 -33
- data/app/components/solidus_admin/users/edit/component.yml +0 -7
- data/app/components/solidus_admin/users/edit/tabs/component.rb +46 -0
- data/app/components/solidus_admin/users/edit/tabs/component.yml +6 -0
- data/app/components/solidus_admin/users/index/component.rb +20 -20
- data/app/components/solidus_admin/users/items/component.html.erb +1 -3
- data/app/components/solidus_admin/users/items/component.rb +17 -47
- data/app/components/solidus_admin/users/items/component.yml +0 -7
- data/app/components/solidus_admin/users/orders/component.html.erb +1 -3
- data/app/components/solidus_admin/users/orders/component.rb +9 -39
- data/app/components/solidus_admin/users/orders/component.yml +0 -6
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.html.erb +7 -8
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.rb +0 -5
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.yml +0 -1
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.html.erb +4 -4
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.yml +0 -1
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.html.erb +6 -7
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.rb +0 -5
- data/app/components/solidus_admin/users/store_credits/index/component.html.erb +4 -6
- data/app/components/solidus_admin/users/store_credits/index/component.rb +10 -40
- data/app/components/solidus_admin/users/store_credits/index/component.yml +0 -6
- data/app/components/solidus_admin/users/store_credits/new/component.html.erb +12 -13
- data/app/components/solidus_admin/users/store_credits/new/component.rb +0 -9
- data/app/components/solidus_admin/users/store_credits/new/component.yml +0 -1
- data/app/components/solidus_admin/users/store_credits/show/component.html.erb +5 -7
- data/app/components/solidus_admin/users/store_credits/show/component.rb +8 -38
- data/app/components/solidus_admin/users/store_credits/show/component.yml +0 -6
- data/app/components/solidus_admin/users_and_roles/component.rb +4 -4
- data/app/components/solidus_admin/zones/edit/component.html.erb +1 -0
- data/app/components/solidus_admin/zones/edit/component.rb +4 -0
- data/app/components/solidus_admin/zones/form/component.html.erb +47 -0
- data/app/components/solidus_admin/zones/form/component.js +32 -0
- data/app/components/solidus_admin/zones/form/component.rb +23 -0
- data/app/components/solidus_admin/zones/form/component.yml +7 -0
- data/app/components/solidus_admin/zones/index/component.rb +57 -18
- data/app/components/solidus_admin/zones/new/component.html.erb +1 -0
- data/app/components/solidus_admin/zones/new/component.rb +4 -0
- data/app/controllers/concerns/solidus_admin/moveable.rb +31 -0
- data/app/controllers/solidus_admin/addresses_controller.rb +9 -11
- data/app/controllers/solidus_admin/adjustments_controller.rb +5 -6
- data/app/controllers/solidus_admin/base_controller.rb +8 -7
- data/app/controllers/solidus_admin/controller_helpers/authorization.rb +1 -1
- data/app/controllers/solidus_admin/controller_helpers/locale.rb +1 -1
- data/app/controllers/solidus_admin/controller_helpers/pagination.rb +37 -0
- data/app/controllers/solidus_admin/controller_helpers/search.rb +5 -5
- data/app/controllers/solidus_admin/controller_helpers/theme.rb +2 -2
- data/app/controllers/solidus_admin/customers_controller.rb +3 -3
- data/app/controllers/solidus_admin/line_items_controller.rb +3 -3
- data/app/controllers/solidus_admin/option_types_controller.rb +11 -32
- data/app/controllers/solidus_admin/option_values_controller.rb +54 -0
- data/app/controllers/solidus_admin/orders_controller.rb +25 -19
- data/app/controllers/solidus_admin/payment_methods_controller.rb +23 -28
- data/app/controllers/solidus_admin/product_option_types_controller.rb +5 -0
- data/app/controllers/solidus_admin/product_taxons_controller.rb +58 -0
- data/app/controllers/solidus_admin/products_controller.rb +24 -28
- data/app/controllers/solidus_admin/reimbursement_types_controller.rb +3 -3
- data/app/controllers/solidus_admin/resources_controller.rb +59 -20
- data/app/controllers/solidus_admin/shipping_methods_controller.rb +4 -4
- data/app/controllers/solidus_admin/states_controller.rb +30 -0
- data/app/controllers/solidus_admin/stock_items_controller.rb +11 -6
- data/app/controllers/solidus_admin/stock_locations_controller.rb +25 -26
- data/app/controllers/solidus_admin/store_credits_controller.rb +9 -9
- data/app/controllers/solidus_admin/stores_controller.rb +43 -9
- data/app/controllers/solidus_admin/tax_rates_controller.rb +9 -22
- data/app/controllers/solidus_admin/taxonomies_controller.rb +5 -21
- data/app/controllers/solidus_admin/users_controller.rb +16 -16
- data/app/controllers/solidus_admin/zones_controller.rb +6 -26
- data/app/helpers/solidus_admin/flash_helper.rb +14 -0
- data/app/helpers/solidus_admin/last_login_helper.rb +2 -2
- data/app/helpers/solidus_admin/permission_sets_helper.rb +3 -3
- data/app/helpers/solidus_admin/solidus_form_helper.rb +9 -0
- data/app/helpers/solidus_admin/stimulus_helper.rb +29 -0
- data/app/helpers/solidus_admin/void_elements_helper.rb +1 -1
- data/app/javascript/solidus_admin/application.js +10 -1
- data/app/javascript/solidus_admin/confirm_modal.js +24 -0
- data/app/javascript/solidus_admin/controllers/custom_validity_controller.js +12 -0
- data/app/javascript/solidus_admin/controllers/sortable_controller.js +9 -2
- data/app/javascript/solidus_admin/tom-select/plugins/patch_scroll.js +19 -0
- data/app/javascript/solidus_admin/tom-select/plugins/remote_with_pagination.js +67 -0
- data/app/javascript/solidus_admin/tom-select/plugins/stash_on_search.js +68 -0
- data/app/javascript/solidus_admin/tom-select/tom-select.js +11 -0
- data/app/javascript/solidus_admin/utils.js +40 -0
- data/app/javascript/solidus_admin/web_components/solidus_select.js +90 -0
- data/app/javascript/vendor/custom_elements.js +3 -0
- data/app/lib/solidus_admin/form_builder.rb +58 -0
- data/app/views/layouts/solidus_admin/application.html.erb +6 -8
- data/app/views/layouts/solidus_admin/preview.html.erb +1 -1
- data/app/views/solidus_admin/option_values/create.turbo_stream.erb +3 -0
- data/app/views/solidus_admin/option_values/destroy.turbo_stream.erb +3 -0
- data/app/views/solidus_admin/option_values/update.turbo_stream.erb +3 -0
- data/config/importmap.rb +9 -0
- data/config/initializers/view_component.rb +1 -1
- data/config/locales/option_types.en.yml +5 -1
- data/config/locales/option_values.en.yml +9 -0
- data/config/locales/payment_methods.en.yml +5 -1
- data/config/locales/product_taxons.en.yml +6 -0
- data/config/locales/products.en.yml +2 -0
- data/config/locales/solidus_select.yml +6 -0
- data/config/locales/stock_locations.en.yml +4 -0
- data/config/locales/stores.en.yml +22 -0
- data/config/locales/tax_rates.en.yml +4 -0
- data/config/locales/zones.en.yml +4 -0
- data/config/routes.rb +21 -9
- data/config/tailwind.config.js +6 -2
- data/docs/components.md +2 -2
- data/docs/index_pages.md +11 -5
- data/docs/stimulusjs.md +1 -1
- data/eslint.config.mjs +25 -0
- data/lib/generators/solidus_admin/component/component_generator.rb +10 -6
- data/lib/generators/solidus_admin/install/install_generator.rb +24 -5
- data/lib/generators/solidus_admin/install/templates/config/initializers/solidus_admin.rb.tt +6 -0
- data/lib/solidus_admin/admin_resources.rb +1 -1
- data/lib/solidus_admin/configuration.rb +14 -14
- data/lib/solidus_admin/engine.rb +3 -2
- data/lib/solidus_admin/importmap.rb +1 -1
- data/lib/solidus_admin/menu_item.rb +1 -1
- data/lib/solidus_admin/preview.rb +1 -0
- data/lib/solidus_admin/testing_support/admin_assets.rb +1 -1
- data/lib/solidus_admin/testing_support/feature_helpers.rb +77 -3
- data/lib/solidus_admin/testing_support/shared_examples/crud_resource_requests.rb +43 -36
- data/lib/solidus_admin/testing_support/shared_examples/moveable.rb +48 -0
- data/lib/solidus_admin/testing_support/shared_examples/promotion_categories_features.rb +5 -11
- data/lib/solidus_admin/version.rb +1 -1
- data/lib/tasks/tailwind.rake +1 -1
- data/solidus_admin.gemspec +24 -21
- metadata +172 -28
- data/.eslintrc.json +0 -7
- data/app/components/solidus_admin/products/show/component.js +0 -9
- data/app/components/solidus_admin/ui/forms/input/component.js +0 -15
- data/app/components/solidus_admin/users/edit/api_access/component.js +0 -9
- data/app/javascript/solidus_admin/controllers/confirm_controller.js +0 -21
- data/lib/solidus_admin/testing_support/shared_examples/bulk_delete_resources.rb +0 -20
- /data/app/{components/solidus_admin/ui/toast/component.js → javascript/solidus_admin/controllers/alert_animation_controller.js} +0 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div class="min-w-[40rem] max-h-screen pointer-events-auto cursor-auto relative transform overflow-auto rounded-lg bg-white text-left shadow-xl max-w-lg divide-y divide-gray-100">
|
|
12
12
|
|
|
13
13
|
<header class="flex items-center justify-between p-4 sticky top-0 bg-inherit">
|
|
14
|
-
<h3 class="text-xl font-semibold text-gray-900">
|
|
14
|
+
<h3 class="text-xl font-semibold text-gray-900 modal-title">
|
|
15
15
|
<%= @title %>
|
|
16
16
|
</h3>
|
|
17
17
|
<form method="dialog">
|
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
</form>
|
|
24
24
|
</header>
|
|
25
25
|
|
|
26
|
-
<div class="p-4
|
|
27
|
-
<%= content %>
|
|
28
|
-
</div>
|
|
26
|
+
<div class="p-4 empty:hidden modal-body"><%= content %></div>
|
|
29
27
|
|
|
30
28
|
<% if actions? %>
|
|
31
29
|
<footer class="p-4 flex gap-2 justify-end sticky bottom-0 bg-inherit">
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
|
2
2
|
|
|
3
3
|
export default class extends Controller {
|
|
4
|
+
static values = {
|
|
5
|
+
openOnConnect: { type: Boolean, default: true }
|
|
6
|
+
};
|
|
7
|
+
|
|
4
8
|
connect() {
|
|
5
|
-
this.
|
|
9
|
+
if (this.openOnConnectValue) {
|
|
10
|
+
this.element.showModal();
|
|
11
|
+
}
|
|
6
12
|
}
|
|
7
13
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
class SolidusAdmin::UI::Modal::Component < SolidusAdmin::BaseComponent
|
|
4
4
|
renders_one :actions
|
|
5
5
|
|
|
6
|
-
def initialize(title:, close_path: nil, open:
|
|
6
|
+
def initialize(title:, close_path: nil, open: true, **attributes)
|
|
7
7
|
@title = title
|
|
8
8
|
@close_path = close_path
|
|
9
9
|
@attributes = attributes
|
|
10
|
-
@attributes
|
|
10
|
+
@attributes.merge! stimulus_value(name: "open-on-connect", value: open)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -6,19 +6,48 @@ class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
|
|
|
6
6
|
Tab = Struct.new(:text, :href, :current, keyword_init: true)
|
|
7
7
|
|
|
8
8
|
# Template methods
|
|
9
|
-
def tabs
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def
|
|
9
|
+
def tabs
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def model_class
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def back_url
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def search_key
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def search_url
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def page_actions
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def sidebar
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def sortable_options
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def row_url(_record)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def batch_actions
|
|
37
|
+
[]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def scopes
|
|
41
|
+
[]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def filters
|
|
45
|
+
[]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def columns
|
|
49
|
+
[]
|
|
50
|
+
end
|
|
22
51
|
|
|
23
52
|
def initialize(page:)
|
|
24
53
|
@page = page
|
|
@@ -51,11 +80,11 @@ class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
|
|
|
51
80
|
end
|
|
52
81
|
|
|
53
82
|
def prev_page_path
|
|
54
|
-
solidus_admin.url_for(**request.params, page: @page.
|
|
83
|
+
solidus_admin.url_for(**request.params, page: @page.current_page - 1, only_path: true) if @page && !@page.first_page?
|
|
55
84
|
end
|
|
56
85
|
|
|
57
86
|
def next_page_path
|
|
58
|
-
solidus_admin.url_for(**request.params, page: @page.
|
|
87
|
+
solidus_admin.url_for(**request.params, page: @page.next_page, only_path: true) if @page&.next_page
|
|
59
88
|
end
|
|
60
89
|
|
|
61
90
|
def search_options
|
|
@@ -67,7 +96,7 @@ class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
|
|
|
67
96
|
url: search_url,
|
|
68
97
|
searchbar_key: search_key,
|
|
69
98
|
filters:,
|
|
70
|
-
scopes
|
|
99
|
+
scopes:
|
|
71
100
|
}
|
|
72
101
|
end
|
|
73
102
|
|
|
@@ -76,12 +105,12 @@ class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
|
|
|
76
105
|
|
|
77
106
|
safe_join [
|
|
78
107
|
(page_header_back back_url if back_url),
|
|
79
|
-
page_header_title(title)
|
|
108
|
+
page_header_title(title)
|
|
80
109
|
]
|
|
81
110
|
end
|
|
82
111
|
|
|
83
112
|
def render_table
|
|
84
|
-
render component(
|
|
113
|
+
render component("ui/table").new(
|
|
85
114
|
id: stimulus_id,
|
|
86
115
|
data: {
|
|
87
116
|
class: model_class,
|
|
@@ -92,9 +121,11 @@ class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
|
|
|
92
121
|
columns:,
|
|
93
122
|
batch_actions:,
|
|
94
123
|
url: -> { row_url(_1) },
|
|
124
|
+
page: @page&.current_page,
|
|
125
|
+
per_page: @page&.limit_value
|
|
95
126
|
},
|
|
96
127
|
search: search_options,
|
|
97
|
-
sortable: sortable_options
|
|
128
|
+
sortable: sortable_options
|
|
98
129
|
)
|
|
99
130
|
end
|
|
100
131
|
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class SolidusAdmin::UI::Panel::Component < SolidusAdmin::BaseComponent
|
|
4
|
-
renders_one :action, ->(name:, href:, icon:
|
|
5
|
-
|
|
6
|
-
icon_tag(icon, class: 'w-[1.4em] h-[1.4em]') + name,
|
|
7
|
-
href,
|
|
8
|
-
**args,
|
|
9
|
-
class: 'flex gap-1 hover:underline'
|
|
10
|
-
)
|
|
4
|
+
renders_one :action, ->(name:, href:, icon: "add-line", size: :m, **args) {
|
|
5
|
+
render component("ui/button").add(text: name, path: href, icon:, size:, **args)
|
|
11
6
|
}
|
|
12
7
|
|
|
13
8
|
renders_many :sections, ->(**args, &block) do
|
|
@@ -32,8 +27,9 @@ class SolidusAdmin::UI::Panel::Component < SolidusAdmin::BaseComponent
|
|
|
32
27
|
def render_section(wide: false, high: false, **args, &block)
|
|
33
28
|
tag.section(**args, class: "
|
|
34
29
|
border-gray-100 border-t w-full first-of-type:border-t-0
|
|
35
|
-
|
|
36
|
-
#{
|
|
30
|
+
flex flex-col gap-6
|
|
31
|
+
#{"px-6" unless wide}
|
|
32
|
+
#{"py-4" unless high}
|
|
37
33
|
#{args[:class]}
|
|
38
34
|
", &block)
|
|
39
35
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class SolidusAdmin::UI::Radio::Component < SolidusAdmin::BaseComponent
|
|
4
|
+
SIZES = {
|
|
5
|
+
s: "size-4 checked:border-[5px]",
|
|
6
|
+
m: "size-5 checked:border-[6px]"
|
|
7
|
+
}.freeze
|
|
8
|
+
|
|
9
|
+
def initialize(size: :m, **attributes)
|
|
10
|
+
@size = size
|
|
11
|
+
@attributes = attributes
|
|
12
|
+
@attributes[:class] = "
|
|
13
|
+
#{SIZES.fetch(@size)}
|
|
14
|
+
appearance-none cursor-pointer outline-none
|
|
15
|
+
rounded-full border-2 border-gray-300 bg-white
|
|
16
|
+
checked:border-gray-700
|
|
17
|
+
hover:border-gray-700 hover:checked:border-gray-500
|
|
18
|
+
focus:ring-2 focus:ring-offset-1 focus:ring-gray-300
|
|
19
|
+
active:ring-2 active:ring-offset-1 active:ring-gray-300
|
|
20
|
+
focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-300
|
|
21
|
+
disabled:border-gray-300/50 disabled:hover:border-gray-300/50 disabled:active:ring-0 disabled:cursor-not-allowed
|
|
22
|
+
transition-all duration-75 ease-linear
|
|
23
|
+
"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def call
|
|
27
|
+
tag.input(type: "radio", **@attributes)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -4,7 +4,7 @@ class SolidusAdmin::UI::Tab::Component < SolidusAdmin::BaseComponent
|
|
|
4
4
|
SIZES = {
|
|
5
5
|
s: %w[h-7 px-1.5 font-semibold text-sm],
|
|
6
6
|
m: %w[h-9 px-3 font-semibold text-sm],
|
|
7
|
-
l: %w[h-12 px-4 font-semibold text-base]
|
|
7
|
+
l: %w[h-12 px-4 font-semibold text-base]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
def initialize(text:, tag: :a, size: :m, current: false, disabled: false, **attributes)
|
|
@@ -13,8 +13,8 @@ class SolidusAdmin::UI::Tab::Component < SolidusAdmin::BaseComponent
|
|
|
13
13
|
@size = size
|
|
14
14
|
@attributes = attributes
|
|
15
15
|
|
|
16
|
-
@attributes[:
|
|
17
|
-
@attributes[:
|
|
16
|
+
@attributes[:"aria-current"] = current
|
|
17
|
+
@attributes[:"aria-disabled"] = disabled
|
|
18
18
|
@attributes[:class] = [
|
|
19
19
|
%w[
|
|
20
20
|
rounded justify-start items-center inline-flex py-1.5 cursor-pointer
|
|
@@ -30,7 +30,7 @@ class SolidusAdmin::UI::Tab::Component < SolidusAdmin::BaseComponent
|
|
|
30
30
|
aria-disabled:bg-gray-75 aria-disabled:text-gray-400
|
|
31
31
|
],
|
|
32
32
|
SIZES.fetch(@size.to_sym),
|
|
33
|
-
@attributes.delete(:class)
|
|
33
|
+
@attributes.delete(:class)
|
|
34
34
|
].join(" ")
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<div
|
|
2
2
|
class="
|
|
3
|
-
rounded-lg
|
|
4
|
-
border
|
|
5
|
-
border-gray-100
|
|
3
|
+
<%= 'rounded-lg border border-gray-100' unless @options[:embedded] %>
|
|
6
4
|
<%= 'overflow-hidden' unless @search %>
|
|
7
5
|
"
|
|
8
6
|
data-controller="<%= stimulus_id %>"
|
|
@@ -88,21 +86,22 @@
|
|
|
88
86
|
<% end %>
|
|
89
87
|
|
|
90
88
|
<%= render component("ui/table/toolbar").new("data-#{stimulus_id}-target": "batchToolbar", role: "toolbar", "aria-label": t(".batch_actions"), hidden: true) do %>
|
|
91
|
-
<%= form_tag '', id: batch_actions_form_id %>
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
<%= form_tag '', id: batch_actions_form_id do %>
|
|
90
|
+
<% @data.batch_actions.each do |batch_action| %>
|
|
91
|
+
<%= render_batch_action_button(batch_action) %>
|
|
92
|
+
<% end %>
|
|
94
93
|
<% end %>
|
|
95
94
|
<% end %>
|
|
96
95
|
|
|
97
96
|
<table class="table-fixed w-full border-collapse">
|
|
98
97
|
<colgroup>
|
|
99
98
|
<% @data.columns.each do |column| %>
|
|
100
|
-
<col <%= tag.attributes(**column.col) if column.col
|
|
99
|
+
<col <%= tag.attributes(**column.col) if column.col %>>
|
|
101
100
|
<% end %>
|
|
102
101
|
</colgroup>
|
|
103
102
|
|
|
104
103
|
<thead
|
|
105
|
-
class="bg-gray-15 text-gray-700 text-left
|
|
104
|
+
class="bg-gray-15 text-gray-700 text-left"
|
|
106
105
|
data-<%= stimulus_id %>-target="defaultHeader"
|
|
107
106
|
>
|
|
108
107
|
<tr>
|
|
@@ -115,7 +114,7 @@
|
|
|
115
114
|
<% if @data.batch_actions && @data.rows.any? %>
|
|
116
115
|
<thead
|
|
117
116
|
data-<%= stimulus_id %>-target="batchHeader"
|
|
118
|
-
class="bg-white color-black
|
|
117
|
+
class="bg-white color-black leading-none text-left"
|
|
119
118
|
hidden
|
|
120
119
|
>
|
|
121
120
|
<tr>
|
|
@@ -135,6 +134,8 @@
|
|
|
135
134
|
<%= "data-sortable-param-value=#{@sortable.param}" if @sortable&.param %>
|
|
136
135
|
<%= "data-sortable-handle-value=#{@sortable.handle}" if @sortable&.handle %>
|
|
137
136
|
<%= "data-sortable-animation-value=#{@sortable.animation}" if @sortable&.animation %>
|
|
137
|
+
<%= "data-sortable-page-value=#{@data.page}" if @data&.page %>
|
|
138
|
+
<%= "data-sortable-per-page-value=#{@data.per_page}" if @data&.per_page %>
|
|
138
139
|
>
|
|
139
140
|
<% @data.rows.each do |row| %>
|
|
140
141
|
<% row_url = @data.url&.call(row) %>
|
|
@@ -143,8 +144,8 @@
|
|
|
143
144
|
<% if row_url %>
|
|
144
145
|
data-action="click-><%= stimulus_id %>#rowClicked"
|
|
145
146
|
data-<%= stimulus_id %>-url-param="<%= row_url %>"
|
|
146
|
-
<%= "data-sortable-url=#{@sortable.url.call(row)}" if @sortable&.url %>
|
|
147
147
|
<% end %>
|
|
148
|
+
<%= "data-sortable-url=#{@sortable.url.call(row)}" if @sortable&.url %>
|
|
148
149
|
>
|
|
149
150
|
<% @data.columns.each do |column| %>
|
|
150
151
|
<%= render_data_cell(column, row) %>
|
|
@@ -15,6 +15,7 @@ export default class extends Controller {
|
|
|
15
15
|
"batchHeader",
|
|
16
16
|
"tableBody",
|
|
17
17
|
"selectedRowsCount",
|
|
18
|
+
"batchActionButton",
|
|
18
19
|
]
|
|
19
20
|
|
|
20
21
|
static classes = ["selectedRow"]
|
|
@@ -32,7 +33,9 @@ export default class extends Controller {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
// Determine if sortable should be enabled
|
|
35
|
-
modeValueChanged() {
|
|
36
|
+
modeValueChanged(_current, previous) {
|
|
37
|
+
this.previousMode = previous;
|
|
38
|
+
|
|
36
39
|
const shouldSetSortable = this.sortableValue && this.modeValue !== "batch" && this.modeValue !== "search"
|
|
37
40
|
|
|
38
41
|
if (shouldSetSortable) {
|
|
@@ -69,13 +72,9 @@ export default class extends Controller {
|
|
|
69
72
|
|
|
70
73
|
selectRow(event) {
|
|
71
74
|
if (this.checkboxTargets.some((checkbox) => checkbox.checked)) {
|
|
72
|
-
this.modeValue = "batch"
|
|
73
|
-
} else if (this.hasSearchFieldTarget && this.searchFieldTarget.value !== "") {
|
|
74
|
-
this.modeValue = "search"
|
|
75
|
-
} else if (this.hasScopesToolbarTarget) {
|
|
76
|
-
this.modeValue = "scopes"
|
|
75
|
+
this.modeValue = "batch";
|
|
77
76
|
} else {
|
|
78
|
-
this.modeValue =
|
|
77
|
+
this.modeValue = this.previousMode;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
this.render()
|
|
@@ -83,13 +82,9 @@ export default class extends Controller {
|
|
|
83
82
|
|
|
84
83
|
selectAllRows(event) {
|
|
85
84
|
if (event.target.checked) {
|
|
86
|
-
this.modeValue = "batch"
|
|
87
|
-
} else if (this.hasSearchFieldTarget && this.searchFieldTarget.value !== "") {
|
|
88
|
-
this.modeValue = "search"
|
|
89
|
-
} else if (this.hasScopesToolbarTarget) {
|
|
90
|
-
this.modeValue = "scopes"
|
|
85
|
+
this.modeValue = "batch";
|
|
91
86
|
} else {
|
|
92
|
-
this.modeValue =
|
|
87
|
+
this.modeValue = this.previousMode;
|
|
93
88
|
}
|
|
94
89
|
|
|
95
90
|
this.checkboxTargets.forEach((checkbox) => (checkbox.checked = event.target.checked))
|
|
@@ -129,19 +124,6 @@ export default class extends Controller {
|
|
|
129
124
|
return this.checkboxTargets.filter((checkbox) => checkbox.checked)
|
|
130
125
|
}
|
|
131
126
|
|
|
132
|
-
confirmAction(event) {
|
|
133
|
-
const message = event.params.message
|
|
134
|
-
.replace("${count}", this.selectedRows().length)
|
|
135
|
-
.replace(
|
|
136
|
-
"${resource}",
|
|
137
|
-
this.selectedRows().length > 1 ? event.params.resourcePlural : event.params.resourceSingular
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
if (!confirm(message)) {
|
|
141
|
-
event.preventDefault()
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
127
|
render() {
|
|
146
128
|
const selectedRows = this.selectedRows()
|
|
147
129
|
|
|
@@ -178,5 +160,15 @@ export default class extends Controller {
|
|
|
178
160
|
checkbox.checked = true
|
|
179
161
|
else if (selectedRows.length > 0) checkbox.indeterminate = true
|
|
180
162
|
})
|
|
163
|
+
|
|
164
|
+
// Update confirmation text
|
|
165
|
+
this.batchActionButtonTargets.forEach((button) => {
|
|
166
|
+
button.dataset.confirmDetails = button.dataset.confirmationTemplate
|
|
167
|
+
.replace("${count}", selectedRows.length)
|
|
168
|
+
.replace(
|
|
169
|
+
"${resource}",
|
|
170
|
+
this.selectedRows().length > 1 ? button.dataset.resourcePlural : button.dataset.resourceSingular,
|
|
171
|
+
);
|
|
172
|
+
});
|
|
181
173
|
}
|
|
182
174
|
}
|
|
@@ -8,7 +8,7 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
8
8
|
BatchAction = Struct.new(:label, :icon, :action, :require_confirmation, :method, keyword_init: true) # rubocop:disable Lint/StructNewOverride
|
|
9
9
|
private_constant :BatchAction, :Column, :Filter, :Scope, :Sortable
|
|
10
10
|
|
|
11
|
-
class Data < Struct.new(:rows, :class, :url, :prev, :next, :columns, :fade, :batch_actions, keyword_init: true) # rubocop:disable Lint/StructNewOverride,Style/StructInheritance
|
|
11
|
+
class Data < Struct.new(:rows, :class, :url, :prev, :next, :columns, :fade, :batch_actions, :page, :per_page, keyword_init: true) # rubocop:disable Lint/StructNewOverride,Style/StructInheritance
|
|
12
12
|
def initialize(**args)
|
|
13
13
|
super
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def singular_name
|
|
22
|
-
self[:class]
|
|
22
|
+
self[:class]&.model_name&.human
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def plural_name
|
|
@@ -60,35 +60,37 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
# @option options [Boolean] :embedded if true, does not add border around table
|
|
64
|
+
def initialize(id:, data:, search: nil, sortable: nil, **options)
|
|
64
65
|
@id = id
|
|
65
66
|
@data = Data.new(**data)
|
|
66
67
|
@data.columns.unshift selectable_column if @data.batch_actions.present? && @data.rows.present?
|
|
67
68
|
@search = Search.new(**search) if search
|
|
68
69
|
@sortable = Sortable.new(**sortable) if sortable
|
|
70
|
+
@options = options
|
|
69
71
|
end
|
|
70
72
|
|
|
71
73
|
def selectable_column
|
|
72
74
|
@selectable_column ||= Column.new(
|
|
73
75
|
header: -> {
|
|
74
|
-
component("ui/
|
|
76
|
+
component("ui/checkbox").new(
|
|
75
77
|
form: batch_actions_form_id,
|
|
76
78
|
"data-action": "#{stimulus_id}#selectAllRows",
|
|
77
79
|
"data-#{stimulus_id}-target": "headerCheckbox",
|
|
78
|
-
"aria-label": t(
|
|
80
|
+
"aria-label": t(".select_all")
|
|
79
81
|
)
|
|
80
82
|
},
|
|
81
83
|
data: ->(data) {
|
|
82
|
-
component("ui/
|
|
84
|
+
component("ui/checkbox").new(
|
|
83
85
|
name: "id[]",
|
|
84
86
|
form: batch_actions_form_id,
|
|
85
87
|
value: data.id,
|
|
86
88
|
"data-action": "#{stimulus_id}#selectRow",
|
|
87
89
|
"data-#{stimulus_id}-target": "checkbox",
|
|
88
|
-
"aria-label": t(
|
|
90
|
+
"aria-label": t(".select_row")
|
|
89
91
|
)
|
|
90
92
|
},
|
|
91
|
-
col: {
|
|
93
|
+
col: {class: "w-[52px]"}
|
|
92
94
|
)
|
|
93
95
|
end
|
|
94
96
|
|
|
@@ -105,7 +107,7 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
105
107
|
name: request_forgery_protection_token,
|
|
106
108
|
value: form_authenticity_token(form_options: {
|
|
107
109
|
action: batch_action.action,
|
|
108
|
-
method: batch_action.method
|
|
110
|
+
method: batch_action.method
|
|
109
111
|
}),
|
|
110
112
|
formaction: batch_action.action,
|
|
111
113
|
formmethod: batch_action.method,
|
|
@@ -113,17 +115,19 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
113
115
|
type: :submit,
|
|
114
116
|
icon: batch_action.icon,
|
|
115
117
|
text: batch_action.label,
|
|
116
|
-
scheme: :secondary
|
|
118
|
+
scheme: :secondary
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
if batch_action.require_confirmation
|
|
120
|
-
params["data-
|
|
121
|
-
params["data
|
|
122
|
+
params["data-turbo-confirm"] = t(".are_you_sure")
|
|
123
|
+
params["data-confirmation-template"] = t(
|
|
122
124
|
".action_confirmation",
|
|
123
125
|
action: batch_action.label.downcase
|
|
124
126
|
)
|
|
125
|
-
params["data
|
|
126
|
-
params["data
|
|
127
|
+
params["data-confirm-button"] = batch_action.label
|
|
128
|
+
params["data-resource-singular"] = @data.singular_name.downcase
|
|
129
|
+
params["data-resource-plural"] = @data.plural_name.downcase
|
|
130
|
+
params.merge! stimulus_target("batchActionButton")
|
|
127
131
|
end
|
|
128
132
|
|
|
129
133
|
render component("ui/button").new(**params)
|
|
@@ -138,7 +142,7 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
138
142
|
predicate: filter.predicate,
|
|
139
143
|
options: filter.options,
|
|
140
144
|
form: search_form_id,
|
|
141
|
-
index
|
|
145
|
+
index:
|
|
142
146
|
)
|
|
143
147
|
end
|
|
144
148
|
|
|
@@ -147,7 +151,7 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
147
151
|
cell = @data[:class].human_attribute_name(cell) if cell.is_a?(Symbol)
|
|
148
152
|
cell = cell.render_in(self) if cell.respond_to?(:render_in)
|
|
149
153
|
|
|
150
|
-
content_tag(:th, cell, class: %
|
|
154
|
+
content_tag(:th, cell, class: %(
|
|
151
155
|
border-b
|
|
152
156
|
border-gray-100
|
|
153
157
|
px-4
|
|
@@ -155,7 +159,7 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
155
159
|
font-semibold
|
|
156
160
|
vertical-align-middle
|
|
157
161
|
leading-none
|
|
158
|
-
|
|
162
|
+
), **attrs)
|
|
159
163
|
end
|
|
160
164
|
|
|
161
165
|
def render_data_cell(column, data)
|
|
@@ -185,6 +189,8 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
|
|
|
185
189
|
end
|
|
186
190
|
|
|
187
191
|
def should_enable_sortable?
|
|
188
|
-
|
|
192
|
+
return false if @sortable.nil?
|
|
193
|
+
return true if @search.nil?
|
|
194
|
+
@search.on_default_scope?
|
|
189
195
|
end
|
|
190
196
|
end
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
name="<%= selection.predicate.name %>"
|
|
47
47
|
value="<%= selection.predicate.value %>">
|
|
48
48
|
|
|
49
|
-
<%= render component('ui/
|
|
49
|
+
<%= render component('ui/checkbox').new(
|
|
50
50
|
id: selection.id,
|
|
51
51
|
name: selection.option.name,
|
|
52
52
|
value: selection.option.value,
|
|
@@ -12,7 +12,7 @@ class SolidusAdmin::UI::Table::RansackFilter::Component < SolidusAdmin::BaseComp
|
|
|
12
12
|
def initialize(
|
|
13
13
|
presentation:,
|
|
14
14
|
combinator:, attribute:, predicate:, options:, form:, index:, search_param: :q
|
|
15
|
-
)
|
|
15
|
+
)
|
|
16
16
|
@presentation = presentation
|
|
17
17
|
@group = "#{search_param}[g][#{index}]"
|
|
18
18
|
@combinator = build(:combinator, combinator)
|
|
@@ -43,7 +43,7 @@ class SolidusAdmin::UI::Table::RansackFilter::Component < SolidusAdmin::BaseComp
|
|
|
43
43
|
# @param opt_index [Integer] The index of the option, if applicable.
|
|
44
44
|
# @return [FormAttribute] The built form attribute.
|
|
45
45
|
def build(type, value, opt_index = nil)
|
|
46
|
-
suffix = SUFFIXES[type] % {
|
|
46
|
+
suffix = SUFFIXES[type] % {index: opt_index || @index}
|
|
47
47
|
Attribute.new("#{@group}#{suffix}", value)
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -53,14 +53,14 @@ class SolidusAdmin::UI::Table::RansackFilter::Component < SolidusAdmin::BaseComp
|
|
|
53
53
|
# @return [Boolean] Returns true if the checkbox should be checked, false otherwise.
|
|
54
54
|
def checked?(value)
|
|
55
55
|
conditions = params.dig(:q, :g, @index.to_s, :c)
|
|
56
|
-
conditions
|
|
56
|
+
conditions&.values&.any? { |c| c[:v]&.include?(value.to_s) }
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
SUFFIXES = {
|
|
60
|
-
combinator:
|
|
61
|
-
attribute:
|
|
62
|
-
predicate:
|
|
63
|
-
option:
|
|
60
|
+
combinator: "[m]",
|
|
61
|
+
attribute: "[c][%<index>s][a][]",
|
|
62
|
+
predicate: "[c][%<index>s][p]",
|
|
63
|
+
option: "[c][%<index>s][v][]"
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
Selection = Struct.new(:id, :presentation, :attribute, :predicate, :option, :checked)
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
class SolidusAdmin::UI::Thumbnail::Component < SolidusAdmin::BaseComponent
|
|
4
4
|
SIZES = {
|
|
5
|
-
s:
|
|
6
|
-
m:
|
|
7
|
-
l:
|
|
5
|
+
s: "h-6 w-6",
|
|
6
|
+
m: "h-10 w-10",
|
|
7
|
+
l: "h-20 w-20"
|
|
8
8
|
}.freeze
|
|
9
9
|
|
|
10
10
|
def initialize(icon: nil, size: :m, **attributes)
|
|
@@ -35,8 +35,8 @@ class SolidusAdmin::UI::Thumbnail::Component < SolidusAdmin::BaseComponent
|
|
|
35
35
|
when Spree::UnitCancel then new(icon: "close-circle-line", **attrs)
|
|
36
36
|
when Spree::TaxRate then new(icon: "percent-line", **attrs)
|
|
37
37
|
when Spree::LineItem then self.for(record.variant, **attrs)
|
|
38
|
-
when Spree::Product then self.for(
|
|
39
|
-
when Spree::Variant then self.for(
|
|
38
|
+
when Spree::Product then self.for(record.images.first || record.master.images.first, **attrs)
|
|
39
|
+
when Spree::Variant then self.for(record.images.first || record.product, **attrs)
|
|
40
40
|
when Spree::Image then new(src: record.attachment&.url(:small), alt: record.alt, **attrs)
|
|
41
41
|
when Spree::Order then new(icon: "shopping-bag-line", **attrs)
|
|
42
42
|
when Spree::Shipment then new(icon: "truck-line", **attrs)
|
|
@@ -6,24 +6,24 @@
|
|
|
6
6
|
pointer-events-auto
|
|
7
7
|
<%= SCHEMES.fetch(@scheme.to_sym).join(' ') %>
|
|
8
8
|
"
|
|
9
|
-
data-controller="
|
|
10
|
-
data
|
|
11
|
-
data
|
|
9
|
+
data-controller="alert-animation"
|
|
10
|
+
data-alert-animation-animation-class="translate-y-full opacity-0"
|
|
11
|
+
data-alert-animation-transition-value="<%= Rails.env.test? ? 1000 : 500 %>"
|
|
12
12
|
role="dialog"
|
|
13
13
|
aria-label="<%= t(".#{@scheme}_label") %>"
|
|
14
14
|
aria-live="polite"
|
|
15
15
|
>
|
|
16
16
|
<%= icon_tag(@icon, class: 'w-[1.125rem] h-[1.125rem] mr-2 fill-current') if @icon %>
|
|
17
17
|
|
|
18
|
-
<p class="font-semibold
|
|
18
|
+
<p class="font-semibold leading-none"><%= @text %></p>
|
|
19
19
|
|
|
20
20
|
<button
|
|
21
21
|
type="button"
|
|
22
22
|
class="ml-2 align-text-bottom"
|
|
23
23
|
title="<%= t('.close_text') %>"
|
|
24
|
-
data-action="
|
|
24
|
+
data-action="alert-animation#close"
|
|
25
25
|
aria-label="<%= t('.close_text') %>"
|
|
26
|
-
data
|
|
26
|
+
data-alert-animation-target="closeButton"
|
|
27
27
|
>
|
|
28
28
|
<%= icon_tag('close-line', class: "w-[1.125rem] h-[1.125rem] fill-current") %>
|
|
29
29
|
</button>
|
|
@@ -9,7 +9,7 @@ class SolidusAdmin::UI::Toggletip::Component < SolidusAdmin::BaseComponent
|
|
|
9
9
|
above: {
|
|
10
10
|
arrow: "before:bottom-0 before:left-1/2 before:translate-y-[50%] before:translate-x-[-50%]",
|
|
11
11
|
bubble: "translate-x-[calc(-50%+(1rem/2))] translate-y-[calc(-100%-1rem-(0.375rem/2))]"
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
}.freeze
|
|
14
14
|
|
|
15
15
|
def initialize(text:, position: :above, **attributes)
|