Class: Sufia::Forms::BatchUploadForm
- Inherits:
-
WorkForm
- Object
- CurationConcerns::Forms::WorkForm
- WorkForm
- Sufia::Forms::BatchUploadForm
- Includes:
- HydraEditor::Form::Permissions
- Defined in:
- app/forms/sufia/forms/batch_upload_form.rb
Defined Under Namespace
Classes: Name
Instance Attribute Summary
Attributes inherited from WorkForm
Class Method Summary collapse
-
.model_name ⇒ Object
Override of ActiveModel::Model name that allows us to use our custom name class.
Instance Method Summary collapse
-
#depositor ⇒ Object
The WorkForm delegates ‘#depositor` to `:model`, but `:model` in the BatchUpload context is a blank work with a `nil` depositor value.
- #model_name ⇒ Object
-
#primary_terms ⇒ Object
On the batch upload, title is set per-file.
-
#to_model ⇒ Object
This is required for routing to the BatchUploadController.
Methods inherited from WorkForm
#[], build_permitted_params, #initialize, multiple?, #secondary_terms
Constructor Details
This class inherits a constructor from Sufia::Forms::WorkForm
Class Method Details
.model_name ⇒ Object
Override of ActiveModel::Model name that allows us to use our custom name class
30 31 32 33 34 35 36 37 |
# File 'app/forms/sufia/forms/batch_upload_form.rb', line 30 def self.model_name @_model_name ||= begin namespace = parents.detect do |n| n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming? end Name.new(model_class, namespace) end end |
Instance Method Details
#depositor ⇒ Object
The WorkForm delegates ‘#depositor` to `:model`, but `:model` in the BatchUpload context is a blank work with a `nil` depositor value. This causes the “Sharing With” widget to display the Depositor as “()”. We should be able to reliably pull back the depositor of the new batch of works by asking the form’s Ability what its ‘current_user` is.
14 15 16 |
# File 'app/forms/sufia/forms/batch_upload_form.rb', line 14 def depositor current_ability.current_user end |
#model_name ⇒ Object
39 40 41 |
# File 'app/forms/sufia/forms/batch_upload_form.rb', line 39 def model_name self.class.model_name end |
#primary_terms ⇒ Object
On the batch upload, title is set per-file.
19 20 21 |
# File 'app/forms/sufia/forms/batch_upload_form.rb', line 19 def primary_terms super - [:title] end |
#to_model ⇒ Object
This is required for routing to the BatchUploadController
44 45 46 |
# File 'app/forms/sufia/forms/batch_upload_form.rb', line 44 def to_model self end |