Sha256: 253f6aa95935fdc69afdf0cf8fd621be89eff946eca885202721cdebc8c81054
Contents?: true
Size: 1.61 KB
Versions: 2
Compression:
Stored size: 1.61 KB
Contents
# frozen_string_literal: true module Hyrax module Forms ## # @api public # @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking class AdministrativeSetForm < Valkyrie::ChangeSet property :title, required: true, primary: true property :description, primary: true property :human_readable_type, writable: false property :date_modified, readable: false property :date_uploaded, readable: false property :depositor class << self def model_class Hyrax::AdministrativeSet end ## # @return [Array<Symbol>] list of required field names as symbols def required_fields definitions .select { |_, definition| definition[:required] } .keys.map(&:to_sym) end end ## # @return [Array<Symbol>] terms for display 'above-the-fold', or in the most # prominent form real estate def primary_terms _form_field_definitions .select { |_, definition| definition[:primary] } .keys.map(&:to_sym) end ## # @return [Array<Symbol>] terms for display 'below-the-fold' def secondary_terms _form_field_definitions .select { |_, definition| definition[:display] && !definition[:primary] } .keys.map(&:to_sym) end ## # @return [Boolean] whether there are terms to display 'below-the-fold' def display_additional_fields? secondary_terms.any? end private def _form_field_definitions self.class.definitions end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hyrax-3.3.0 | app/forms/hyrax/forms/administrative_set_form.rb |
hyrax-3.2.0 | app/forms/hyrax/forms/administrative_set_form.rb |