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


25
26
27
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 25

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


31
32
33
34
35
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 31

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'


57
58
59
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 57

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


41
42
43
44
45
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 41

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'


49
50
51
52
53
# File 'app/forms/hyrax/forms/pcdm_collection_form.rb', line 49

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