Class: Hyrax::Forms::PcdmCollectionForm
- Inherits:
-
ResourceForm
- Object
- Valkyrie::ChangeSet
- ChangeSet
- ResourceForm
- Hyrax::Forms::PcdmCollectionForm
- Defined in:
- app/forms/hyrax/forms/pcdm_collection_form.rb
Overview
Constant Summary collapse
- BannerInfoPrepopulator =
lambda do |**| self. ||= begin = CollectionBrandingInfo.where(collection_id: id.to_s, role: "banner") = File.split(.first.local_path).last unless .empty? alttext = .first.alt_text unless .empty? file_location = .first.local_path unless .empty? relative_path = "/" + .first.local_path.split("/")[-4..-1].join("/") unless .empty? { file: , full_path: file_location, relative_path: relative_path, alttext: alttext } end end
- LogoInfoPrepopulator =
lambda do |**| self.logo_info ||= begin logos_info = CollectionBrandingInfo.where(collection_id: id.to_s, role: "logo") logos_info.map do |logo_info| logo_file = File.split(logo_info.local_path).last relative_path = "/" + logo_info.local_path.split("/")[-4..-1].join("/") alttext = logo_info.alt_text linkurl = logo_info.target_url { file: logo_file, full_path: logo_info.local_path, relative_path: relative_path, alttext: alttext, linkurl: linkurl } end end end
Constants inherited from ResourceForm
ResourceForm::LockKeyPrepopulator
Class Method Summary collapse
- .model_class ⇒ Object
-
.required_fields ⇒ Array<Symbol>
List of required field names as symbols.
Instance Method Summary collapse
-
#display_additional_fields? ⇒ Boolean
Whether there are terms to display ‘below-the-fold’.
-
#primary_terms ⇒ Array<Symbol>
Terms for display ‘above-the-fold’, or in the most prominent form real estate.
-
#secondary_terms ⇒ Array<Symbol>
Terms for display ‘below-the-fold’.
Methods inherited from ResourceForm
#[]=, for, #initialize, #model_class, required_fields=
Methods inherited from ChangeSet
Constructor Details
This class inherits a constructor from Hyrax::Forms::ResourceForm
Class Method Details
.model_class ⇒ Object
48 49 50 |
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 48 def model_class Hyrax::PcdmCollection end |
.required_fields ⇒ Array<Symbol>
Returns list of required field names as symbols.
54 55 56 57 58 |
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 54 def required_fields definitions .select { |_, definition| definition[:required] } .keys.map(&:to_sym) end |
Instance Method Details
#display_additional_fields? ⇒ Boolean
Returns whether there are terms to display ‘below-the-fold’.
80 81 82 |
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 80 def display_additional_fields? secondary_terms.any? end |
#primary_terms ⇒ Array<Symbol>
Returns terms for display ‘above-the-fold’, or in the most prominent form real estate.
64 65 66 67 68 |
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 64 def primary_terms _form_field_definitions .select { |_, definition| definition[:primary] } .keys.map(&:to_sym) end |
#secondary_terms ⇒ Array<Symbol>
Returns terms for display ‘below-the-fold’.
72 73 74 75 76 |
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 72 def secondary_terms _form_field_definitions .select { |_, definition| definition[:display] && !definition[:primary] } .keys.map(&:to_sym) end |