Class: Hyrax::Forms::ResourceBatchEditForm
- Inherits:
-
ResourceForm
- Object
- Valkyrie::ChangeSet
- ChangeSet
- ResourceForm
- Hyrax::Forms::ResourceBatchEditForm
- Includes:
- ContainedInWorksBehavior, DepositAgreementBehavior, LeaseabilityBehavior, PermissionBehavior
- Defined in:
- app/forms/hyrax/forms/resource_batch_edit_form.rb
Constant Summary
Constants included from ContainedInWorksBehavior
ContainedInWorksBehavior::InWorksPrepopulator
Constants inherited from ResourceForm
Hyrax::Forms::ResourceForm::LockKeyPrepopulator
Instance Attribute Summary collapse
-
#batch_document_ids ⇒ Object
readonly
Returns the value of attribute batch_document_ids.
-
#names ⇒ Object
Contains a list of titles of all the works in the batch.
Class Method Summary collapse
-
.additional_permitted_params ⇒ Object
Returns a list of parameters other than those terms for the form rubocop:disable Metrics/MethodLength.
-
.build_permitted_params ⇒ Object
Returns a list of parameters we accept from the form.
-
.terms_permitted_params ⇒ Object
Returns a list of permitted parameters for the terms.
Instance Method Summary collapse
- #column_for_attribute(name) ⇒ Symbol
-
#initialize(model, _current_ability, batch_document_ids) ⇒ ResourceBatchEditForm
constructor
A new instance of ResourceBatchEditForm.
Methods included from PermissionBehavior
included, #permission_populator
Methods included from LeaseabilityBehavior
#embargo_populator, included, #lease_populator, #visibility_populator
Methods included from DepositAgreementBehavior
Methods included from ContainedInWorksBehavior
Methods inherited from ResourceForm
#[]=, check_if_flexible, #display_additional_fields?, expose_class, for, inherited, #model_class, #primary_terms, required_fields, required_fields=, schema_definitions, schema_definitions=, #secondary_terms
Methods included from BasedNearFieldBehavior
Methods inherited from ChangeSet
Constructor Details
#initialize(model, _current_ability, batch_document_ids) ⇒ ResourceBatchEditForm
26 27 28 29 30 31 32 33 34 35 |
# File 'app/forms/hyrax/forms/resource_batch_edit_form.rb', line 26 def initialize(model, _current_ability, batch_document_ids) @names = [] @batch_document_ids = batch_document_ids if @batch_document_ids.present? combined_fields = model_attributes(model, initialize_combined_fields) super(resource: model.class.new(combined_fields)) else super(resource: model) end end |
Instance Attribute Details
#batch_document_ids ⇒ Object (readonly)
Returns the value of attribute batch_document_ids.
37 38 39 |
# File 'app/forms/hyrax/forms/resource_batch_edit_form.rb', line 37 def batch_document_ids @batch_document_ids end |
#names ⇒ Object
Contains a list of titles of all the works in the batch
21 22 23 |
# File 'app/forms/hyrax/forms/resource_batch_edit_form.rb', line 21 def names @names end |
Class Method Details
.additional_permitted_params ⇒ Object
Returns a list of parameters other than those terms for the form rubocop:disable Metrics/MethodLength
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/forms/hyrax/forms/resource_batch_edit_form.rb', line 46 def self.additional_permitted_params [{ 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 |
.build_permitted_params ⇒ Object
Returns a list of parameters we accept from the form
40 41 42 |
# File 'app/forms/hyrax/forms/resource_batch_edit_form.rb', line 40 def self.build_permitted_params terms_permitted_params + additional_permitted_params end |
.terms_permitted_params ⇒ Object
Returns a list of permitted parameters for the terms
65 66 67 68 69 70 71 72 73 |
# File 'app/forms/hyrax/forms/resource_batch_edit_form.rb', line 65 def self.terms_permitted_params [].tap do |params| terms.each do |term| h = {} h[term] = [] params << h end end end |
Instance Method Details
#column_for_attribute(name) ⇒ Symbol
Added for ActiveModel compatibility.
78 79 80 |
# File 'app/forms/hyrax/forms/resource_batch_edit_form.rb', line 78 def column_for_attribute(name) name end |