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

#current_ability

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WorkForm

#[], #agreement_accepted?, #display_additional_fields?, #find_child_work, #member_of_collections, #member_of_collections_json, #primary_terms, sanitize_params, #secondary_terms, #select_files, #version, #work_members, #work_members_json

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)
  @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.



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

def batch_document_ids
  @batch_document_ids
end

#namesObject

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



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

def names
  @names
end

Class Method Details

.build_permitted_paramsObject

Returns a list of parameters we accept from the form rubocop:disable Metrics/MethodLength



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/forms/hyrax/forms/batch_edit_form.rb', line 30

def self.build_permitted_params
  [{ creator: [] },
   { contributor: [] },
   { description: [] },
   { keyword: [] },
   { resource_type: [] },
   { license: [] },
   { publisher: [] },
   { date_created: [] },
   { subject: [] },
   { language: [] },
   { identifier: [] },
   { based_near: [] },
   { related_url: [] },
   { permissions_attributes: [:type, :name, :access, :id, :_destroy] },
   :on_behalf_of,
   :version,
   :add_works_to_collection,
   :visibility_during_embargo,
   :embargo_release_date,
   :visibility_after_embargo,
   :visibility_during_lease,
   :lease_expiration_date,
   :visibility_after_lease,
   :visibility,
   { based_near_attributes: [:id, :_destroy] }]
end