Class: Hyrax::Forms::AdministrativeSetForm

Inherits:
ResourceForm 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

Constants inherited from ResourceForm

ResourceForm::LockKeyPrepopulator

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResourceForm

#[]=, check_if_flexible, expose_class, for, inherited, #initialize, #model_class, required_fields=, schema_definitions, schema_definitions=

Methods included from BasedNearFieldBehavior

#deserialize, included

Methods inherited from ChangeSet

for

Constructor Details

This class inherits a constructor from Hyrax::Forms::ResourceForm

Class Method Details

.model_classObject



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

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



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

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’



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

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



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

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’



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

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