Class: Hyrax::Forms::CollectionForm
- Inherits:
-
Object
- Object
- Hyrax::Forms::CollectionForm
- Includes:
- HydraEditor::Form, HydraEditor::Form::Permissions
- Defined in:
- app/forms/hyrax/forms/collection_form.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current_ability ⇒ Object
Used by the search builder.
-
#repository ⇒ Object
Used by the search builder.
Instance Method Summary collapse
-
#display_additional_fields? ⇒ Boolean
Do not display additional fields if there are no secondary terms.
-
#initialize(model, current_ability, repository) ⇒ CollectionForm
constructor
A new instance of CollectionForm.
-
#primary_terms ⇒ Object
Terms that appear above the accordion.
-
#secondary_terms ⇒ Object
Terms that appear within the accordion.
-
#select_files ⇒ Hash
All FileSets in the collection, file.to_s is the key, file.id is the value.
- #thumbnail_title ⇒ Object
Constructor Details
#initialize(model, current_ability, repository) ⇒ CollectionForm
Returns a new instance of CollectionForm.
31 32 33 34 35 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 31 def initialize(model, current_ability, repository) super(model) @current_ability = current_ability @repository = repository end |
Instance Attribute Details
#current_ability ⇒ Object
Used by the search builder
7 8 9 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 7 def current_ability @current_ability end |
#repository ⇒ Object
Used by the search builder
7 8 9 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 7 def repository @repository end |
Instance Method Details
#display_additional_fields? ⇒ Boolean
Do not display additional fields if there are no secondary terms
66 67 68 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 66 def display_additional_fields? secondary_terms.any? end |
#primary_terms ⇒ Object
Terms that appear above the accordion
43 44 45 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 43 def primary_terms [:title] end |
#secondary_terms ⇒ Object
Terms that appear within the accordion
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 48 def secondary_terms [:creator, :contributor, :description, :keyword, :license, :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url, :resource_type] end |
#select_files ⇒ Hash
Returns All FileSets in the collection, file.to_s is the key, file.id is the value.
38 39 40 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 38 def select_files Hash[all_files_with_access] end |
#thumbnail_title ⇒ Object
70 71 72 73 |
# File 'app/forms/hyrax/forms/collection_form.rb', line 70 def thumbnail_title return unless model.thumbnail model.thumbnail.title.first end |