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, #display_additional_fields?, #member_of_collections, #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



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

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

Instance Attribute Details

#batch_document_idsObject (readonly)

Returns the value of attribute batch_document_ids.



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

def batch_document_ids
  @batch_document_ids
end

#namesObject

Contains a list of titles of all the works in the batch



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

def names
  @names
end

Class Method Details

.build_permitted_paramsObject

Which parameters can we accept from the form



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

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,
            based_near_attributes: [:id, :_destroy]]) -
    [{ work_members_attributes: [:id, :_destroy],
       based_near_attributes: [:id, :_destroy] }]
end