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
42
43
44
45
46
47
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 42
def assignment
[
::User.role_text(object.role),
::User.group_text(object.group)
].compact.join(', ')
end
|
#async_text ⇒ Object
13
14
15
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 13
def async_text
object.async ? 'Yes' : 'No'
end
|
#default_class ⇒ Object
30
31
32
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 30
def default_class
object.class.types[object.kind.to_sym][:class]
end
|
#default_type ⇒ Object
34
35
36
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 34
def default_type
object.default_type
end
|
38
39
40
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 38
def form
'_form'.prepend(object.kind)
end
|
#is_background_text ⇒ Object
17
18
19
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 17
def is_background_text
object.is_background ? 'Yes' : 'No'
end
|
#operation_class ⇒ Object
5
6
7
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 5
def operation_class
object.read_attribute(:operation_class).presence || object.operation_class
end
|
#other_operations ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 21
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 49
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
9
10
11
|
# File 'app/decorators/rails_workflow/operation_template_decorator.rb', line 9
def type_title
object.class.types[object.kind.to_sym][:title]
end
|