Class: CurationConcerns::Forms::WorkflowResponsibilityForm

Inherits:
Object
  • Object
show all
Defined in:
app/forms/curation_concerns/forms/workflow_responsibility_form.rb

Overview

Since:

  • 0.14.0

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ WorkflowResponsibilityForm

Returns a new instance of WorkflowResponsibilityForm.

Since:

  • 0.14.0



4
5
6
7
8
9
10
# File 'app/forms/curation_concerns/forms/workflow_responsibility_form.rb', line 4

def initialize(params = {})
  model_instance.workflow_role_id = params[:workflow_role_id]
  if params[:user_id]
    user = ::User.find(params[:user_id])
    model_instance.agent = user.to_sipity_agent
  end
end

Instance Method Details

#model_instanceObject

Since:

  • 0.14.0



12
13
14
# File 'app/forms/curation_concerns/forms/workflow_responsibility_form.rb', line 12

def model_instance
  @model ||= Sipity::WorkflowResponsibility.new
end

#to_modelObject

Since:

  • 0.14.0



16
17
18
# File 'app/forms/curation_concerns/forms/workflow_responsibility_form.rb', line 16

def to_model
  model_instance
end

#user_idObject

Since:

  • 0.14.0



22
23
24
# File 'app/forms/curation_concerns/forms/workflow_responsibility_form.rb', line 22

def user_id
  nil
end

#user_optionsObject

Since:

  • 0.14.0



26
27
28
# File 'app/forms/curation_concerns/forms/workflow_responsibility_form.rb', line 26

def user_options
  ::User.all
end

#workflow_role_optionsObject

The select options for choosing a responsibility

Since:

  • 0.14.0



31
32
33
# File 'app/forms/curation_concerns/forms/workflow_responsibility_form.rb', line 31

def workflow_role_options
  Sipity::WorkflowRole.all.map { |wf_role| [label(wf_role), wf_role.id] }
end