Class: Hyrax::CollectionOptionsPresenter
- Inherits:
-
Object
- Object
- Hyrax::CollectionOptionsPresenter
- Defined in:
- app/presenters/hyrax/collection_options_presenter.rb
Overview
Presents the options for the Collection widget on the create/edit form
Instance Method Summary collapse
-
#initialize(service) ⇒ CollectionOptionsPresenter
constructor
A new instance of CollectionOptionsPresenter.
-
#select_options(access = :edit) ⇒ Object
Return Collection selectbox options based on access type.
Constructor Details
#initialize(service) ⇒ CollectionOptionsPresenter
Returns a new instance of CollectionOptionsPresenter.
5 6 7 |
# File 'app/presenters/hyrax/collection_options_presenter.rb', line 5 def initialize(service) @service = service end |
Instance Method Details
#select_options(access = :edit) ⇒ Object
Return Collection selectbox options based on access type
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/presenters/hyrax/collection_options_presenter.rb', line 11 def (access = :edit) option_values = results(access).map do |solr_doc| [solr_doc.to_s, solr_doc.id] end option_values.sort do |a, b| if a.first && b.first a.first <=> b.first else a.first ? -1 : 1 end end end |