Class: Hyrax::AdminSetOptionsPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/hyrax/admin_set_options_presenter.rb

Overview

Presents the options for the AdminSet widget on the create/edit form

Instance Method Summary collapse

Constructor Details

#initialize(service, current_ability: service.context.current_ability) ⇒ AdminSetOptionsPresenter

Returns a new instance of AdminSetOptionsPresenter.

Parameters:



7
8
9
10
# File 'app/presenters/hyrax/admin_set_options_presenter.rb', line 7

def initialize(service, current_ability: service.context.current_ability)
  @service = service
  @current_ability = current_ability
end

Instance Method Details

#select_options(access = :deposit) ⇒ Object

TODO:

this hits the Solr from the view. it would be better to avoid this.

Return AdminSet selectbox options based on access type

Parameters:

  • access (Symbol) (defaults to: :deposit)

    :deposit, :read, or :edit



17
18
19
20
21
# File 'app/presenters/hyrax/admin_set_options_presenter.rb', line 17

def select_options(access = :deposit)
  @service.search_results(access).map do |admin_set|
    [admin_set.to_s, admin_set.id, data_attributes(admin_set)]
  end
end