Class: Hyrax::Forms::BatchEditForm

Inherits:
WorkForm
  • Object
show all
Defined in:
app/forms/hyrax/forms/batch_edit_form.rb

Instance Attribute Summary collapse

Attributes inherited from WorkForm

#agreement_accepted, #current_ability

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WorkForm

#[], #collections_for_select, #initialize_field, #primary_terms, sanitize_params, #secondary_terms, #select_files, #version, #work_members

Constructor Details

#initialize(model, current_ability, batch_document_ids) ⇒ BatchEditForm

Returns a new instance of BatchEditForm.

Parameters:

  • model (ActiveFedora::Base)

    the model backing the form

  • current_ability (Ability)

    the user authorization model

  • batch_document_ids (Array<String>)

    a list of document ids in the batch



19
20
21
22
23
24
# File 'app/forms/hyrax/forms/batch_edit_form.rb', line 19

def initialize(model, current_ability, batch_document_ids)
  super(model, current_ability, nil)
  @names = []
  @batch_document_ids = batch_document_ids
  initialize_combined_fields
end

Instance Attribute Details

#batch_document_idsObject (readonly)

Returns the value of attribute batch_document_ids.



26
27
28
# File 'app/forms/hyrax/forms/batch_edit_form.rb', line 26

def batch_document_ids
  @batch_document_ids
end

#namesObject

Returns the value of attribute names.



12
13
14
# File 'app/forms/hyrax/forms/batch_edit_form.rb', line 12

def names
  @names
end

Class Method Details

.build_permitted_paramsObject

Which parameters can we accept from the form



29
30
31
32
33
34
# File 'app/forms/hyrax/forms/batch_edit_form.rb', line 29

def self.build_permitted_params
  super + [:visibility_during_embargo, :embargo_release_date,
           :visibility_after_embargo, :visibility_during_lease,
           :lease_expiration_date, :visibility_after_lease, :visibility] -
    [{ work_members_attributes: [:id, :_destroy] }]
end