Class: Spotlight::AdminUsers::ExhibitRolesComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Spotlight::AdminUsers::ExhibitRolesComponent
- Defined in:
- app/components/spotlight/admin_users/exhibit_roles_component.rb
Overview
Display all exhibit roles for a user
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user:) ⇒ ExhibitRolesComponent
constructor
A new instance of ExhibitRolesComponent.
- #sorted_exhibit_roles ⇒ Object
Constructor Details
#initialize(user:) ⇒ ExhibitRolesComponent
Returns a new instance of ExhibitRolesComponent.
9 10 11 12 |
# File 'app/components/spotlight/admin_users/exhibit_roles_component.rb', line 9 def initialize(user:) super() @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
7 8 9 |
# File 'app/components/spotlight/admin_users/exhibit_roles_component.rb', line 7 def user @user end |
Instance Method Details
#sorted_exhibit_roles ⇒ Object
14 15 16 |
# File 'app/components/spotlight/admin_users/exhibit_roles_component.rb', line 14 def sorted_exhibit_roles @sorted_exhibit_roles ||= user.all_exhibit_roles.sort_by { |r| [r.role, r.resource.title] } end |