Class: SolidusAdmin::Layout::Navigation::Account::Component
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- SolidusAdmin::Layout::Navigation::Account::Component
- Defined in:
- app/components/solidus_admin/layout/navigation/account/component.rb
Instance Method Summary collapse
- #autosubmit_select_tag(name, options, icon:, &block) ⇒ Object
-
#initialize(user_label:, account_path:, logout_path:, logout_method:) ⇒ Component
constructor
A new instance of Component.
- #locale_options_for_select(available_locales) ⇒ Object
- #theme_options_for_select ⇒ Object
Constructor Details
#initialize(user_label:, account_path:, logout_path:, logout_method:) ⇒ Component
Returns a new instance of Component.
4 5 6 7 8 9 |
# File 'app/components/solidus_admin/layout/navigation/account/component.rb', line 4 def initialize(user_label:, account_path:, logout_path:, logout_method:) @user_label = user_label @account_path = account_path @logout_path = logout_path @logout_method = logout_method end |
Instance Method Details
#autosubmit_select_tag(name, options, icon:, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/components/solidus_admin/layout/navigation/account/component.rb', line 24 def autosubmit_select_tag(name, , icon:, &block) form_tag(request.fullpath, method: :get, 'data-turbo': false, class: "w-full") do safe_join([ block_given? ? capture(&block) : nil, tag.label(safe_join([ icon_tag(icon, class: "w-full max-w-[20px] h-5 fill-current shrink"), tag.select(, name:, onchange: "this.form.requestSubmit()", class: "w-full appearance-none grow bg-transparent outline-none"), icon_tag("expand-up-down-line", class: "w-full max-w-[20px] h-5 fill-current shrink"), ]), class: "flex gap-2 items-center px-2"), ]) end end |
#locale_options_for_select(available_locales) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/components/solidus_admin/layout/navigation/account/component.rb', line 11 def (available_locales) available_locales.map do |locale| [ t("spree.i18n.this_file_language", locale:, default: locale.to_s, fallback: false), locale, ] end.sort end |
#theme_options_for_select ⇒ Object
20 21 22 |
# File 'app/components/solidus_admin/layout/navigation/account/component.rb', line 20 def SolidusAdmin::Config.themes.keys.map { |theme| [theme.to_s.humanize, theme] }.sort end |