Class: Sufia::Forms::WorkForm

Inherits:
CurationConcerns::Forms::WorkForm
  • Object
show all
Includes:
HydraEditor::Form::Permissions
Defined in:
app/forms/sufia/forms/work_form.rb

Direct Known Subclasses

BatchEditForm, BatchUploadForm

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, current_ability) ⇒ WorkForm

Returns a new instance of WorkForm.



15
16
17
18
# File 'app/forms/sufia/forms/work_form.rb', line 15

def initialize(model, current_ability)
  @agreement_accepted = !model.new_record?
  super
end

Instance Attribute Details

#agreement_acceptedObject (readonly)

Returns the value of attribute agreement_accepted.



10
11
12
# File 'app/forms/sufia/forms/work_form.rb', line 10

def agreement_accepted
  @agreement_accepted
end

Class Method Details

.build_permitted_paramsObject



45
46
47
# File 'app/forms/sufia/forms/work_form.rb', line 45

def self.build_permitted_params
  super + [:on_behalf_of, { collection_ids: [] }]
end

.multiple?(term) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
43
# File 'app/forms/sufia/forms/work_form.rb', line 40

def self.multiple?(term)
  return true if [:rights, :collection_ids].include? term
  super
end

Instance Method Details

#[](key) ⇒ Object



20
21
22
23
# File 'app/forms/sufia/forms/work_form.rb', line 20

def [](key)
  return model.in_collection_ids if key == :collection_ids
  super
end

#primary_termsObject

Fields that are automatically drawn on the page above the fold



26
27
28
# File 'app/forms/sufia/forms/work_form.rb', line 26

def primary_terms
  required_fields
end

#secondary_termsObject

Fields that are automatically drawn on the page below the fold



31
32
33
34
35
36
37
38
# File 'app/forms/sufia/forms/work_form.rb', line 31

def secondary_terms
  terms - primary_terms -
    [:files, :visibility_during_embargo, :embargo_release_date,
     :visibility_after_embargo, :visibility_during_lease,
     :lease_expiration_date, :visibility_after_lease, :visibility,
     :thumbnail_id, :representative_id, :ordered_member_ids,
     :collection_ids]
end