Class: SolidusAdmin::Users::Edit::Component
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- SolidusAdmin::Users::Edit::Component
- Includes:
- Layout::PageHelpers
- Defined in:
- app/components/solidus_admin/users/edit/component.rb
Instance Method Summary collapse
- #form_id ⇒ Object
-
#initialize(user:) ⇒ Component
constructor
A new instance of Component.
- #role_options ⇒ Object
- #tabs ⇒ Object
Constructor Details
#initialize(user:) ⇒ Component
Returns a new instance of Component.
6 7 8 |
# File 'app/components/solidus_admin/users/edit/component.rb', line 6 def initialize(user:) @user = user end |
Instance Method Details
#form_id ⇒ Object
10 11 12 |
# File 'app/components/solidus_admin/users/edit/component.rb', line 10 def form_id @form_id ||= "#{stimulus_id}--form-#{@user.id}" end |
#role_options ⇒ Object
46 47 48 49 50 |
# File 'app/components/solidus_admin/users/edit/component.rb', line 46 def Spree::Role.all.map do |role| { label: role.name, id: role.id } end end |
#tabs ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/solidus_admin/users/edit/component.rb', line 14 def tabs [ { text: t('.account'), href: solidus_admin.user_path(@user), current: action_name == "edit", }, { text: t('.addresses'), href: solidus_admin.addresses_user_path(@user), current: action_name == "addresses", }, { text: t('.order_history'), href: solidus_admin.orders_user_path(@user), current: action_name == "orders", }, { text: t('.items'), href: spree.items_admin_user_path(@user), # @todo: update this "current" logic once folded into new admin current: action_name != "edit", }, { text: t('.store_credit'), href: spree.admin_user_store_credits_path(@user), # @todo: update this "current" logic once folded into new admin current: action_name != "edit", }, ] end |