Class: Hyrax::Forms::PcdmCollectionForm

Inherits:
Valkyrie::ChangeSet
  • Object
show all
Defined in:
app/forms/hyrax/forms/pcdm_collection_form.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.model_classObject



21
22
23
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 21

def model_class
  Hyrax::PcdmCollection
end

.required_fieldsArray<Symbol>

Returns list of required field names as symbols.

Returns:

  • (Array<Symbol>)

    list of required field names as symbols



27
28
29
30
31
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 27

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’.

Returns:

  • (Boolean)

    whether there are terms to display ‘below-the-fold’



53
54
55
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 53

def display_additional_fields?
  secondary_terms.any?
end

#primary_termsArray<Symbol>

Returns terms for display ‘above-the-fold’, or in the most prominent form real estate.

Returns:

  • (Array<Symbol>)

    terms for display ‘above-the-fold’, or in the most prominent form real estate



37
38
39
40
41
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 37

def primary_terms
  _form_field_definitions
    .select { |_, definition| definition[:primary] }
    .keys.map(&:to_sym)
end

#secondary_termsArray<Symbol>

Returns terms for display ‘below-the-fold’.

Returns:

  • (Array<Symbol>)

    terms for display ‘below-the-fold’



45
46
47
48
49
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 45

def secondary_terms
  _form_field_definitions
    .select { |_, definition| definition[:display] && !definition[:primary] }
    .keys.map(&:to_sym)
end