Class: Spotlight::AdminUsers::ExhibitRolesComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/spotlight/admin_users/exhibit_roles_component.rb

Overview

Display all exhibit roles for a user

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#userObject (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_rolesObject



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