Sha256: a445625394bc017ba26cd45e4a130f63828c849518a90c27c280c970af229d46
Contents?: true
Size: 1.06 KB
Versions: 8
Compression:
Stored size: 1.06 KB
Contents
module Hyrax module Forms class WorkflowResponsibilityForm 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 def model_instance @model ||= Sipity::WorkflowResponsibility.new end def to_model model_instance end delegate :model_name, :to_key, :workflow_role_id, :persisted?, :save!, to: :model_instance def user_id nil end def user_options ::User.all end # The select options for choosing a responsibility sorted by label def workflow_role_options options = Sipity::WorkflowRole.all.map do |wf_role| [Hyrax::Admin::WorkflowRolePresenter.new(wf_role).label, wf_role.id] end options.sort_by(&:first) end private def label(wf_role) "#{wf_role.workflow.name} - #{wf_role.role.name}" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems