Module: WorkflowsHelper

Defined in:
app/helpers/workflows_helper.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/workflows_helper.rb', line 3

def link_to_workflow( workflow, context_infos = {} )
  user = context_infos[ :user ]
  title = user.name + " " if user
  title += workflow.name_as_verb
  title += " (#{workflow.wah_group.name})" if workflow.wah_group
  workflow_params = { user_id: user.id }
  link_to(
          (icon(workflow_icon(workflow)) + " " + workflow.name).html_safe,
          workflow_kit.execute_workflow_path( workflow, workflow_params ), 
          method: :put,
          :class => 'workflow_trigger',
          title: title
          )
end


26
27
28
29
30
31
32
33
34
35
# File 'app/helpers/workflows_helper.rb', line 26

def workflow_execution_links_for( options )

  group = options[ :group ]
  user = options[ :user ]

  group.child_workflows.collect do |workflow|
    link_to_workflow workflow, user: user
  end.join.html_safe    

end

#workflow_icon(workflow) ⇒ Object



18
19
20
21
22
23
24
# File 'app/helpers/workflows_helper.rb', line 18

def workflow_icon(workflow)
  if workflow.steps.collect { |step| step.brick_name }.include? 'DestroyAccountAndEndMembershipsIfNeededBrick'
    "remove"
  else
    "chevron-up"
  end
end