Class: RailsWorkflow::OperationTemplateDecorator
- Inherits:
-
Decorator
- Object
- Draper::Decorator
- Decorator
- RailsWorkflow::OperationTemplateDecorator
show all
- Defined in:
- app/decorators/rails_workflow/operation_template_decorator.rb
Instance Method Summary
collapse
Methods inherited from Decorator
collection_decorator_class
Instance Method Details
#assignment ⇒ Object
44
45
46
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 44
def assignment
[assignment_by_role, assignment_by_group].compact.join(', ')
end
|
#assignment_by_group ⇒ Object
52
53
54
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 52
def assignment_by_group
::User.group_text(object.group) if object.group
end
|
#assignment_by_role ⇒ Object
48
49
50
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 48
def assignment_by_role
::User.role_text(object.role) if object.role
end
|
#async_text ⇒ Object
15
16
17
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 15
def async_text
object.async ? 'Yes' : 'No'
end
|
#default_class ⇒ Object
32
33
34
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 32
def default_class
object.class.types[object.kind.to_sym][:class]
end
|
#default_type ⇒ Object
36
37
38
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 36
def default_type
object.default_type
end
|
40
41
42
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 40
def form
'_form'.dup.prepend(object.kind)
end
|
#is_background_text ⇒ Object
19
20
21
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 19
def is_background_text
object.is_background ? 'Yes' : 'No'
end
|
#operation_class ⇒ Object
7
8
9
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 7
def operation_class
object.read_attribute(:operation_class).presence || object.operation_class
end
|
#other_operations ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 23
def other_operations
if object.persisted?
object.other_operations.order(id: :asc).to_a
else
object.process_template.operations.to_a - [object]
end
end
|
#show_dependencies ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 56
def show_dependencies
if object.dependencies.present?
object.dependencies.map do |dependency|
depends_on = OperationTemplate.where(id: dependency['id']).pluck(:title).first
statuses = object
.get_status_values
.select { |status| dependency['statuses'].include? status[0] }
[depends_on] + statuses.map(&:last)
end
else
[]
end
end
|
#type_title ⇒ Object
11
12
13
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 11
def type_title
object.class.types[object.kind.to_sym][:title]
end
|