Class: Hyrax::Forms::AdministrativeSetForm

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

Overview

Constant Summary collapse

AdminSetMembersPopulator =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

lambda do |_options|
  self.member_ids =
    if model.new_record
      []
    else
      Hyrax
        .query_service
        .find_inverse_references_by(property: :admin_set_id, resource: model)
        .map(&:id)
    end
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.model_classObject


37
38
39
# File 'app/forms/hyrax/forms/administrative_set_form.rb', line 37

def model_class
  Hyrax::AdministrativeSet
end

.required_fieldsArray<Symbol>

Returns list of required field names as symbols.

Returns:

  • (Array<Symbol>)

    list of required field names as symbols


43
44
45
46
47
# File 'app/forms/hyrax/forms/administrative_set_form.rb', line 43

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'


69
70
71
# File 'app/forms/hyrax/forms/administrative_set_form.rb', line 69

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


53
54
55
56
57
# File 'app/forms/hyrax/forms/administrative_set_form.rb', line 53

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'


61
62
63
64
65
# File 'app/forms/hyrax/forms/administrative_set_form.rb', line 61

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