Class: Sufia::Forms::AdminSetForm
- Inherits:
-
CurationConcerns::Forms::CollectionEditForm
- Object
- CurationConcerns::Forms::CollectionEditForm
- Sufia::Forms::AdminSetForm
- Defined in:
- app/forms/sufia/forms/admin_set_form.rb
Class Method Summary collapse
-
.multiple?(_term) ⇒ Boolean
This determines whether the allowed parameters are single or multiple.
-
.sanitize_params(form_params) ⇒ Object
Overriden to cast ‘title’ and ‘description’ to an array.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Cast any array values on the model to scalars.
-
#initialize(model, permission_template) ⇒ AdminSetForm
constructor
A new instance of AdminSetForm.
- #permission_template ⇒ Object
- #workflow_name ⇒ Object
- #workflows ⇒ Object
Constructor Details
#initialize(model, permission_template) ⇒ AdminSetForm
Returns a new instance of AdminSetForm.
9 10 11 12 |
# File 'app/forms/sufia/forms/admin_set_form.rb', line 9 def initialize(model, ) super(model) = end |
Class Method Details
.multiple?(_term) ⇒ Boolean
This determines whether the allowed parameters are single or multiple. By default it delegates to the model.
35 36 37 |
# File 'app/forms/sufia/forms/admin_set_form.rb', line 35 def multiple?(_term) false end |
.sanitize_params(form_params) ⇒ Object
Overriden to cast ‘title’ and ‘description’ to an array
40 41 42 43 44 45 |
# File 'app/forms/sufia/forms/admin_set_form.rb', line 40 def sanitize_params(form_params) super.tap do |params| params['title'] = Array.wrap(params['title']) if params.key?('title') params['description'] = Array.wrap(params['description']) if params.key?('description') end end |
Instance Method Details
#[](key) ⇒ Object
Cast any array values on the model to scalars.
15 16 17 18 |
# File 'app/forms/sufia/forms/admin_set_form.rb', line 15 def [](key) return super if key == :thumbnail_id super.first end |
#permission_template ⇒ Object
20 21 22 |
# File 'app/forms/sufia/forms/admin_set_form.rb', line 20 def PermissionTemplateForm.new() end |
#workflow_name ⇒ Object
24 25 26 |
# File 'app/forms/sufia/forms/admin_set_form.rb', line 24 def workflow_name .workflow_name end |
#workflows ⇒ Object
28 29 30 |
# File 'app/forms/sufia/forms/admin_set_form.rb', line 28 def workflows Sipity::Workflow.all.map { |workflow| [workflow.label, workflow.name] } end |