Class: Hyrax::Forms::WorkflowResponsibilityForm
- Inherits:
-
Object
- Object
- Hyrax::Forms::WorkflowResponsibilityForm
- Defined in:
- app/forms/hyrax/forms/workflow_responsibility_form.rb
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ WorkflowResponsibilityForm
constructor
A new instance of WorkflowResponsibilityForm.
- #model_instance ⇒ Object
- #user_id ⇒ Object
- #user_options ⇒ Object
-
#workflow_role_options ⇒ Object
The select options for choosing a responsibility sorted by label.
Constructor Details
#initialize(params = {}) ⇒ WorkflowResponsibilityForm
Returns a new instance of WorkflowResponsibilityForm.
5 6 7 8 9 10 |
# File 'app/forms/hyrax/forms/workflow_responsibility_form.rb', line 5 def initialize(params = {}) model_instance.workflow_role_id = params[:workflow_role_id] return unless params[:user_id] user = ::User.find(params[:user_id]) model_instance.agent = user.to_sipity_agent end |
Instance Method Details
#model_instance ⇒ Object
12 13 14 |
# File 'app/forms/hyrax/forms/workflow_responsibility_form.rb', line 12 def model_instance @model ||= Sipity::WorkflowResponsibility.new end |
#user_id ⇒ Object
18 19 20 |
# File 'app/forms/hyrax/forms/workflow_responsibility_form.rb', line 18 def user_id nil end |
#user_options ⇒ Object
22 23 24 |
# File 'app/forms/hyrax/forms/workflow_responsibility_form.rb', line 22 def ::User.all end |
#workflow_role_options ⇒ Object
The select options for choosing a responsibility sorted by label
27 28 29 30 31 32 |
# File 'app/forms/hyrax/forms/workflow_responsibility_form.rb', line 27 def = Sipity::WorkflowRole.all.map do |wf_role| [Hyrax::Admin::WorkflowRolePresenter.new(wf_role).label, wf_role.id] end .sort_by(&:first) end |