rails_workflow 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/app/concerns/rails_workflow/operation_status.rb +2 -50
  3. data/app/concerns/rails_workflow/operation_templates/default_builder.rb +14 -0
  4. data/app/concerns/rails_workflow/operation_templates/dependencies.rb +7 -8
  5. data/app/concerns/rails_workflow/operations/default_runner.rb +19 -6
  6. data/app/concerns/rails_workflow/operations/dependencies.rb +12 -12
  7. data/app/concerns/rails_workflow/processes/default_runner.rb +1 -1
  8. data/app/concerns/rails_workflow/processes/dependency_resolver.rb +12 -17
  9. data/app/concerns/rails_workflow/status.rb +63 -0
  10. data/app/concerns/rails_workflow/user/assignment.rb +11 -5
  11. data/app/controllers/rails_workflow/errors_controller.rb +1 -1
  12. data/app/controllers/rails_workflow/operation_templates_controller.rb +45 -34
  13. data/app/controllers/rails_workflow/operations_controller.rb +37 -31
  14. data/app/controllers/rails_workflow/process_templates_controller.rb +41 -14
  15. data/app/controllers/rails_workflow/processes_controller.rb +53 -32
  16. data/app/decorators/rails_workflow/context_decorator.rb +6 -1
  17. data/app/decorators/rails_workflow/operation_decorator.rb +7 -15
  18. data/app/decorators/rails_workflow/operation_template_decorator.rb +1 -1
  19. data/app/decorators/rails_workflow/process_decorator.rb +1 -2
  20. data/app/decorators/rails_workflow/status_decorator.rb +17 -18
  21. data/app/models/rails_workflow/error.rb +5 -3
  22. data/app/models/rails_workflow/operation_template.rb +11 -22
  23. data/app/models/rails_workflow/process.rb +1 -1
  24. data/app/views/application/_context.html.slim +11 -0
  25. data/app/views/rails_workflow/operation_templates/_default_form.html.slim +12 -6
  26. data/app/views/rails_workflow/operation_templates/_user_group_form.html.slim +10 -5
  27. data/app/views/rails_workflow/operation_templates/_user_role_form.html.slim +10 -5
  28. data/app/views/rails_workflow/operation_templates/edit.html.slim +10 -10
  29. data/app/views/rails_workflow/operation_templates/index.html.slim +9 -9
  30. data/app/views/rails_workflow/operation_templates/new.html.slim +10 -10
  31. data/app/views/rails_workflow/operation_templates/show.html.slim +12 -12
  32. data/app/views/rails_workflow/operations/index.html.slim +1 -1
  33. data/app/views/rails_workflow/operations/show.html.slim +24 -33
  34. data/app/views/rails_workflow/process_templates/_form.html.slim +3 -3
  35. data/app/views/rails_workflow/process_templates/edit.html.slim +5 -5
  36. data/app/views/rails_workflow/process_templates/index.html.slim +2 -2
  37. data/app/views/rails_workflow/process_templates/new.html.slim +2 -2
  38. data/app/views/rails_workflow/process_templates/show.html.slim +9 -9
  39. data/app/views/rails_workflow/processes/index.html.slim +2 -2
  40. data/app/views/rails_workflow/processes/show.html.slim +16 -25
  41. data/app/workers/rails_workflow/error_worker.rb +1 -8
  42. data/db/migrate/20150215164401_add_partial_name_to_context.rb +6 -0
  43. data/db/migrate/20150217161051_change_dependencies_to_json.rb +6 -0
  44. data/lib/generators/rails_workflow/install/templates/create_workflow_processes.rb +132 -99
  45. data/lib/rails_workflow/version.rb +1 -1
  46. data/lib/rails_workflow.rb +20 -8
  47. data/spec/controllers/rails_workflow/operation_templates_controller_spec.rb +1 -2
  48. data/spec/controllers/rails_workflow/operations_controller_spec.rb +0 -1
  49. data/spec/controllers/rails_workflow/process_templates_controller_spec.rb +0 -1
  50. data/spec/controllers/rails_workflow/processes_controller_spec.rb +0 -1
  51. data/spec/core/rails_workflow/process_manager_spec.rb +17 -1
  52. data/spec/dummy/app/controllers/application_controller.rb +7 -1
  53. data/spec/dummy/app/models/user.rb +5 -5
  54. data/spec/dummy/config/application.rb +1 -0
  55. data/spec/dummy/config/{database.sample.yml → database.yml.sample} +0 -0
  56. data/spec/dummy/config/database.yml.semaphore +16 -0
  57. data/spec/dummy/config/routes.rb +0 -1
  58. data/spec/dummy/db/schema.rb +14 -12
  59. data/spec/dummy/log/development.log +23189 -0
  60. data/spec/dummy/log/test.log +86228 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/0e4b210a8dc7adf45911c7c4ba8f7420 +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/1616e4e42ff5363173d1d39e6e2a03d4 +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/22bb4a1009f389151658be54233630d8 +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/310eee609d7bb0cabf2f8e68b83998b6 +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/31922eca362eb4de37a5021cccef630d +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/4de81d9fc089c3a5ba8d42b0056a9865 +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/5a73175a9ff8699c8927d3a0a876d868 +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/68446d3bc756b2b4ac2b1844f17db53b +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/6a733df9ba21863060bf032f05171bfa +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/8227b2b943e2ea911b543eb82228c432 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/94b7a81dd8f8ff07304196359c39ab38 +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/94d08b6a05042055bc46262852b983ce +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/96232456037b81cdd1370e99ec2dcc02 +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/9a2014c7524f2e0958daed330fb0e02e +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/9b7130a48df56ce8511f3fd6ef903c95 +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/a2fe1c22fbe6c6a7cb9b8f02a6acf646 +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/ab0c70eaae03da94a23f832513ff652b +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/ab2060acff429fdb2590db736072bc0c +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/b1add619756a502780e48fb4677d62d4 +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/b60aa6e3697ec580ac86be62a6f625f6 +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/c36f232ed7926598f96095a8cc300c3e +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/ca09843ddbf5238fe84bc305118283ba +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/cb0e266c16c56852a172fc789b601cba +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/cb6ceea5ffc8a15e06b98ee6e1312290 +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/d0897c7c9960a927f82986088379f93e +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/d46bdc6254b6d822735475e06f2e7100 +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/d8f3150c250e5b7c730f1c8b883bf033 +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/e4ffa3e3b8053576aae12c9bdb64a075 +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/e9f705ee81f399edce42ea0b96f52f3b +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/eda59a87268a2b4353ab0f5d8cf6bf97 +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/ef1957bb05e4fcd673c473e82a72e49a +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/f036d4fc72ce4649ae8186f985e60612 +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/f3664d9ecf05e354e7668dc11a76044a +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/f794c7b05987535f7000622afe6630d1 +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/fc4a9cfb03faaeb5136786c085d7a289 +0 -0
  96. data/spec/models/rails_workflow/operation_spec.rb +11 -13
  97. data/spec/models/rails_workflow/operation_template_spec.rb +1 -1
  98. data/spec/rails_helper.rb +1 -1
  99. data/spec/spec_helper.rb +1 -0
  100. data/spec/support/controller_macros.rb +0 -7
  101. metadata +83 -18
  102. data/app/concerns/rails_workflow/process_status.rb +0 -66
  103. data/app/controllers/application_controller.rb +0 -3
  104. data/config/initializers/will_paginate.rb +0 -29
  105. data/spec/dummy/tmp/pids/server.pid +0 -1
@@ -3,32 +3,32 @@ ol.breadcrumb.alert-warning
3
3
  li
4
4
  = link_to "Configuration", process_templates_path
5
5
  li
6
- = link_to "Template: #{parent.title}", process_template_path(parent)
6
+ = link_to "Template: #{@process_template.title}", process_template_path(@process_template)
7
7
  li.active
8
- = "Add #{resource.type_title}"
8
+ = "Add #{@operation_template.type_title}"
9
9
 
10
- = render partial: "flash", locals: {notice: notice}
10
+ = render partial: "application/flash", locals: {notice: notice}
11
11
 
12
12
  .row
13
13
  .col-md-10
14
14
  .panel
15
15
  .panel-heading
16
16
  h1.panel-title
17
- = "Add #{resource.type_title}"
17
+ = "Add #{@operation_template.type_title}"
18
18
  .panel-body
19
19
 
20
- = form_for [parent, resource], html: {class: "form-horizontal clearfix"} do |f|
21
- = render partial: resource.form, locals: {f: f}
20
+ = form_for [@process_template, @operation_template], html: {class: "form-horizontal clearfix"} do |f|
21
+ = render partial: @operation_template.form, locals: {f: f}
22
22
  .form-group
23
23
  = f.label :dependencies, class: "control-label col-sm-2"
24
24
  .col-sm-10
25
- - if resource.other_operations.blank?
25
+ - if @operation_template.other_operations.blank?
26
26
  .checkbox
27
27
  label
28
28
  | There is no other operations in this process template.
29
29
 
30
- - resource.other_operations.each_with_index do |depends_on, index|
31
- - matched_dependency = resource.dependencies.detect { |d| d['id'] == depends_on.id }
30
+ - @operation_template.other_operations.each_with_index do |depends_on, index|
31
+ - matched_dependency = @operation_template.dependencies.detect { |d| d['id'] == depends_on.id }
32
32
  .panel.panel-warning
33
33
  .panel-heading
34
34
  .checkbox
@@ -45,7 +45,7 @@ ol.breadcrumb.alert-warning
45
45
  = check_box "operation_template[dependencies][#{index}]", "statuses", {multiple: true, checked: status_matched}, status[0].to_s, nil
46
46
  = status[1]
47
47
  .btn-toolbar.pull-right
48
- = link_to 'Back', process_template_operation_templates_path(parent), class: "btn btn-default"
48
+ = link_to 'Back', process_template_operation_templates_path(@process_template), class: "btn btn-default"
49
49
  = f.submit value: 'Save', class: "btn btn-success"
50
50
 
51
51
 
@@ -2,39 +2,39 @@ ol.breadcrumb.alert-warning
2
2
  li
3
3
  = link_to "Configuration", process_templates_path
4
4
  li
5
- = link_to "Template: #{parent.title}", process_template_path(parent)
5
+ = link_to "Template: #{@process_template.title}", process_template_path(@process_template)
6
6
  li.active
7
- = "Operation Template: #{resource.title}"
8
- = render partial: "flash", locals: { notice: notice }
7
+ = "Operation Template: #{@operation_template.title}"
8
+ = render partial: "application/flash", locals: { notice: notice }
9
9
 
10
10
  .row
11
11
  .col-md-10
12
12
  .panel
13
13
  .panel-heading
14
14
  h1.panel-title
15
- = "Operation: #{resource.title}"
15
+ = "Operation: #{@operation_template.title}"
16
16
  .panel-body
17
17
  table.table.table-striped.table-hover
18
18
  tr
19
19
  td Operation Class
20
- td = resource.operation_class
20
+ td = @operation_template.operation_class
21
21
  tr
22
22
  td Operation Template Class
23
- td = resource.type
23
+ td = @operation_template.type
24
24
 
25
- - if resource.assignment.present?
25
+ - if @operation_template.assignment.present?
26
26
  tr
27
27
  td Assigned To
28
- td = resource.assignment
28
+ td = @operation_template.assignment
29
29
 
30
30
 
31
31
  tr
32
32
  td Asynchronous
33
- td = resource.async_text
33
+ td = @operation_template.async_text
34
34
 
35
35
  tr
36
36
  td Background:
37
- td = resource.is_background_text
37
+ td = @operation_template.is_background_text
38
38
 
39
39
 
40
40
  .panel
@@ -42,7 +42,7 @@ ol.breadcrumb.alert-warning
42
42
  h1.panel-title Dependencies
43
43
  .panel-body
44
44
  table.table.table-striped.table-hover
45
- - resource.show_dependencies.each do |dependency|
45
+ - @operation_template.show_dependencies.each do |dependency|
46
46
  tr
47
47
  td
48
48
  = dependency.shift
@@ -51,5 +51,5 @@ ol.breadcrumb.alert-warning
51
51
  span.label.label-default< = dependency_status
52
52
  .col-md-2
53
53
  .btn-toolbar
54
- = link_to 'Edit', edit_process_template_operation_template_path(parent, resource), class: "btn btn-primary"
54
+ = link_to 'Edit', edit_process_template_operation_template_path(@process_template, @operation_template), class: "btn btn-primary"
55
55
 
@@ -17,7 +17,7 @@ ol.breadcrumb.alert-warning
17
17
  th Created At
18
18
 
19
19
  tbody
20
- - collection.each do |operation|
20
+ - @operations.each do |operation|
21
21
  tr
22
22
  td = link_to operation.title, process_operation_path(operation.process, operation)
23
23
  td
@@ -1,24 +1,24 @@
1
1
  ruby:
2
- child_process = resource.child_process
2
+ child_process = @operation.child_process
3
3
 
4
4
  ol.breadcrumb.alert-warning
5
5
  li
6
6
  = link_to "Processes", processes_path
7
7
  li
8
- = link_to "Process: #{parent.title}", parent
8
+ = link_to "Process: #{@operation.process.title}", @operation.process
9
9
  li.active
10
- = "Operation: #{resource.title} "
10
+ = "Operation: #{@operation.title} "
11
11
 
12
- = render partial: "flash", locals: { notice: notice }
12
+ = render partial: "application/flash", locals: { notice: notice }
13
13
 
14
14
  .row
15
15
  .col-md-10
16
16
  .panel
17
17
  .panel-heading
18
18
  h1.panel-title
19
- = "Operation: #{resource.title} "
20
- span.label.more-info-label class=(resource.status[:class])
21
- = resource.status[:text]
19
+ = "Operation: #{@operation.title} "
20
+ span.label.more-info-label class=(@operation.status[:class])
21
+ = @operation.status[:text]
22
22
  .panel-body
23
23
  .col-md-6
24
24
  table.table.table-striped.table-hover
@@ -26,21 +26,21 @@ ol.breadcrumb.alert-warning
26
26
 
27
27
  tr
28
28
  td Created At
29
- td = resource.created_at
29
+ td = @operation.created_at
30
30
 
31
31
  tr
32
32
  td Completed At
33
- td = resource.completed_at
33
+ td = @operation.completed_at
34
34
 
35
- - if resource.assigned_to.present?
35
+ - if @operation.assigned_to.present?
36
36
  tr
37
37
  td Assigned To
38
- td = resource.assigned_to
38
+ td = @operation.assigned_to
39
39
  tr
40
40
  td Operation Template
41
- td = link_to resource.template.title,
42
- process_template_operation_template_path(resource.template.process_template,
43
- resource.template)
41
+ td = link_to @operation.template.title,
42
+ process_template_operation_template_path(@operation.template.process_template,
43
+ @operation.template)
44
44
 
45
45
  - if child_process.present?
46
46
  tr
@@ -52,16 +52,16 @@ ol.breadcrumb.alert-warning
52
52
  = child_process.status[:text]
53
53
  tr
54
54
  td Asynchronous
55
- td = resource.async
55
+ td = @operation.async
56
56
 
57
57
  tr
58
58
  td Background
59
- td = resource.is_background
59
+ td = @operation.is_background
60
60
 
61
61
 
62
62
  .col-md-6
63
63
 
64
- - if resource.show_dependencies.empty?
64
+ - if @operation.show_dependencies.empty?
65
65
  .col-md-12
66
66
  strong
67
67
  | No dependencies
@@ -71,7 +71,7 @@ ol.breadcrumb.alert-warning
71
71
  tr
72
72
  td
73
73
  strong Satisfied Dependencies
74
- - resource.show_dependencies.each do |dependency|
74
+ - @operation.show_dependencies.each do |dependency|
75
75
  tr
76
76
  td
77
77
  = link_to process_operation_path(dependency.process, dependency)
@@ -83,7 +83,7 @@ ol.breadcrumb.alert-warning
83
83
  tr
84
84
  td
85
85
  strong Template Dependencies
86
- - resource.show_template_dependencies.each do |dependency|
86
+ - @operation.show_template_dependencies.each do |dependency|
87
87
  tr
88
88
  td
89
89
  = dependency.shift
@@ -96,7 +96,7 @@ ol.breadcrumb.alert-warning
96
96
  .btn-toolbar
97
97
  ul.nav.nav-pills
98
98
  li role="presentation" class="active"
99
- = link_to "Back to Process", process_path(resource.process)
99
+ = link_to "Back to Process", process_path(@operation.process)
100
100
 
101
101
 
102
102
  .row
@@ -105,19 +105,10 @@ ol.breadcrumb.alert-warning
105
105
  .panel-heading
106
106
  h1.panel-title Operation Context
107
107
  .panel-body
108
- table.table.table-striped.table-hover
109
- thead
110
- tr
111
- th Key
112
- th Value
113
- tbody
114
- - resource.context.each_pair do |key, value|
115
- tr
116
- td = key
117
- td = value
108
+ = render @operation.context.partial_name, { context: @operation.context }
118
109
 
119
- - if resource.workflow_errors.unresolved.present?
120
- - resource.workflow_errors.unresolved.each do |error|
110
+ - if @operation.workflow_errors.unresolved.present?
111
+ - @operation.workflow_errors.unresolved.each do |error|
121
112
  .row
122
113
  .col-md-10
123
114
  .panel
@@ -131,7 +122,7 @@ ol.breadcrumb.alert-warning
131
122
  strong Created at
132
123
  td
133
124
  .pull-right
134
- = button_to "Retry", retry_process_operation_error_path(resource.process, resource, error), class: "btn btn-warning", method: :put
125
+ = button_to "Retry", retry_process_operation_error_path(@operation.process, @operation, error), class: "btn btn-warning", method: :put
135
126
  = error.created_at
136
127
  tr
137
128
  td
@@ -1,8 +1,8 @@
1
- - if resource.errors.any?
1
+ - if @process_template.errors.any?
2
2
  #error_explanation
3
- h2 = "#{pluralize(resource.errors.count, "error")} prohibited this process template from being saved:"
3
+ h2 = "#{pluralize(@process_template.errors.count, "error")} prohibited this process template from being saved:"
4
4
  ul
5
- - resource.errors.full_messages.each do |message|
5
+ - @process_template.errors.full_messages.each do |message|
6
6
  li = message
7
7
 
8
8
  .form-group
@@ -1,21 +1,21 @@
1
- = render partial: "flash", locals: {notice: notice}
1
+ = render partial: "application/flash", locals: {notice: notice}
2
2
 
3
3
  ol.breadcrumb.alert-warning
4
4
  li
5
5
  = link_to "Configuration", process_templates_path
6
6
  li.active
7
- = "Template: #{resource.title}"
7
+ = "Template: #{@process_template.title}"
8
8
 
9
9
  .row
10
10
  .col-md-10
11
11
  .panel
12
12
  .panel-heading
13
13
  h1.panel-title
14
- = "Template: #{resource.title}"
14
+ = "Template: #{@process_template.title}"
15
15
  .panel-body
16
- = form_for resource, html: { class: "form-horizontal clearfix" } do |f|
16
+ = form_for @process_template, html: { class: "form-horizontal clearfix" } do |f|
17
17
  = render partial: 'form', locals: {f: f}
18
18
  .btn-toolbar.pull-right
19
- = link_to 'Show', resource, class: "btn btn-default"
19
+ = link_to 'Show', @process_template, class: "btn btn-default"
20
20
  = link_to 'Back', process_templates_path, class: "btn btn-default"
21
21
  = f.submit value: 'Save', class: "btn btn-success"
@@ -1,7 +1,7 @@
1
1
  ol.breadcrumb.alert-warning
2
2
  li.active Configuration
3
3
 
4
- = render partial: "flash", locals: {notice: notice}
4
+ = render partial: "application/flash", locals: {notice: notice}
5
5
 
6
6
  .row
7
7
  .col-sm-10
@@ -21,7 +21,7 @@ ol.breadcrumb.alert-warning
21
21
  th
22
22
 
23
23
  tbody
24
- - collection.each do |process_template|
24
+ - @process_templates.each do |process_template|
25
25
  tr
26
26
  td = link_to process_template.title, process_template_operation_templates_path(process_template)
27
27
  td = process_template.manager_class
@@ -5,8 +5,8 @@
5
5
  h1.panel-title
6
6
  = "New Process Template"
7
7
  .panel-body
8
- = form_for resource, html: {class: "form-horizontal clearfix"} do |f|
9
- = render partial: resource.form, locals: {f: f}
8
+ = form_for @process_template, html: {class: "form-horizontal clearfix"} do |f|
9
+ = render partial: @process_template.form, locals: {f: f}
10
10
  .btn-toolbar.pull-right
11
11
  = link_to 'Back', process_templates_path, class: "btn btn-default"
12
12
  = f.submit value: 'Save', class: "btn btn-success"
@@ -1,16 +1,16 @@
1
1
 
2
2
  ruby:
3
3
  new_template_path = -> (type) do
4
- new_process_template_operation_template_path(resource.id, operation_template: {kind: type} )
4
+ new_process_template_operation_template_path(@process_template.id, operation_template: {kind: type} )
5
5
  end
6
6
 
7
7
  ol.breadcrumb.alert-warning
8
8
  li
9
9
  = link_to "Configuration", process_templates_path
10
10
  li.active
11
- = "Template: #{resource.title}"
11
+ = "Template: #{@process_template.title}"
12
12
 
13
- = render partial: "flash", locals: { notice: notice }
13
+ = render partial: "application/flash", locals: { notice: notice }
14
14
 
15
15
  .row
16
16
  .col-sm-10
@@ -25,22 +25,22 @@ ol.breadcrumb.alert-warning
25
25
  tr
26
26
  td
27
27
  strong Process manager
28
- td = resource.manager_class
28
+ td = @process_template.manager_class
29
29
 
30
30
  tr
31
31
  td
32
32
  strong Process class
33
- td = resource.process_class
33
+ td = @process_template.process_class
34
34
 
35
35
  tr
36
36
  td
37
37
  strong Process Template class
38
- td = resource.type
38
+ td = @process_template.type
39
39
 
40
40
  .col-sm-2
41
41
  .row
42
42
  .btn-group
43
- = button_to "Create Process", {controller: "processes", action: "create", process: {template_id: resource.id}}, method: :post, class: "btn btn-lg btn-success"
43
+ = button_to "Create Process", {controller: "processes", action: "create", process: {template_id: @process_template.id}}, method: :post, class: "btn btn-lg btn-success"
44
44
  br
45
45
  br
46
46
  .btn-group
@@ -55,9 +55,9 @@ ol.breadcrumb.alert-warning
55
55
  br
56
56
  br
57
57
  .btn-group
58
- = link_to 'Edit', edit_process_template_path(resource), class: "btn btn-primary"
58
+ = link_to 'Edit', edit_process_template_path(@process_template), class: "btn btn-primary"
59
59
  br
60
60
  br
61
61
  .btn-group
62
- = link_to 'Operations', process_template_operation_templates_path(resource), class: "btn btn-primary"
62
+ = link_to 'Operations', process_template_operation_templates_path(@process_template), class: "btn btn-primary"
63
63
 
@@ -36,7 +36,7 @@ ol.breadcrumb.alert-warning
36
36
  th Created At
37
37
  th Parent/Child
38
38
  tbody
39
- - collection.each do |process|
39
+ - @processes.each do |process|
40
40
  tr
41
41
  td = link_to process.title, process
42
42
  td
@@ -56,7 +56,7 @@ ol.breadcrumb.alert-warning
56
56
  = link_to child.title, child
57
57
  span.label<> class=(child.status[:class])
58
58
  = child.status[:text]
59
- = will_paginate collection
59
+ = will_paginate @processes
60
60
 
61
61
  .col-sm-4
62
62
 
@@ -1,23 +1,23 @@
1
1
  ruby:
2
- parent_operation = resource.parent_operation
2
+ parent_operation = @process.parent_operation
3
3
  parent_process = parent_operation.process if parent_operation.present?
4
4
 
5
5
  ol.breadcrumb.alert-warning
6
6
  li
7
7
  = link_to "Processes", processes_path
8
8
  li.active
9
- = "Process: #{resource.title}"
9
+ = "Process: #{@process.title}"
10
10
 
11
- = render partial: "flash", locals: { notice: notice }
11
+ = render partial: "application/flash", locals: { notice: notice }
12
12
 
13
13
  .row
14
14
  .col-sm-8
15
15
  .panel
16
16
  .panel-heading
17
17
  h1.panel-title
18
- = "Process: #{resource.title} "
19
- span.label class=(resource.status[:class])
20
- = resource.status[:text]
18
+ = "Process: #{@process.title} "
19
+ span.label class=(@process.status[:class])
20
+ = @process.status[:text]
21
21
  .panel-body
22
22
  table.table.table-striped.table-hover
23
23
  thead
@@ -30,9 +30,9 @@ ol.breadcrumb.alert-warning
30
30
 
31
31
 
32
32
  tbody
33
- - resource.operations.each do |operation|
33
+ - @process.operations.each do |operation|
34
34
  tr
35
- td = link_to operation.title, process_operation_path(resource, operation)
35
+ td = link_to operation.title, process_operation_path(@process, operation)
36
36
  td
37
37
  span.label class=(operation.status[:class])
38
38
  = operation.status[:text]
@@ -52,9 +52,9 @@ ol.breadcrumb.alert-warning
52
52
  th Operation Assignment
53
53
  th Sub process
54
54
  tbody
55
- - resource.future_operations.each do |operation|
55
+ - @process.future_operations.each do |operation|
56
56
  tr
57
- td = link_to operation.title, process_template_operation_template_path(resource.template, operation)
57
+ td = link_to operation.title, process_template_operation_template_path(@process.template, operation)
58
58
  td
59
59
  ul.list-unstyled
60
60
  - operation.show_dependencies.each do |dependency|
@@ -69,8 +69,8 @@ ol.breadcrumb.alert-warning
69
69
  = operation.child_process.title
70
70
  span.label.label-default<> = (operation.async || false) ? "async" : "sync"
71
71
 
72
- - if resource.workflow_errors.unresolved.present?
73
- - resource.workflow_errors.unresolved.each do |error|
72
+ - if @process.workflow_errors.unresolved.present?
73
+ - @process.workflow_errors.unresolved.each do |error|
74
74
  .panel
75
75
  .panel-heading
76
76
  h1.panel-title Error
@@ -82,7 +82,7 @@ ol.breadcrumb.alert-warning
82
82
  strong Created at
83
83
  td
84
84
  .pull-right
85
- = button_to "Retry", retry_process_error_path(resource, error), class: "btn btn-warning", method: :put
85
+ = button_to "Retry", retry_process_error_path(@process, error), class: "btn btn-warning", method: :put
86
86
 
87
87
  = error.created_at
88
88
  tr
@@ -102,12 +102,12 @@ ol.breadcrumb.alert-warning
102
102
  td
103
103
  strong Created at
104
104
  td
105
- = resource.created_at
105
+ = @process.created_at
106
106
  tr
107
107
  td
108
108
  strong Process Template
109
109
  td
110
- = link_to resource.template.title, process_template_path(resource.template)
110
+ = link_to @process.template.title, process_template_path(@process.template)
111
111
 
112
112
  - if parent_operation.present?
113
113
  tr
@@ -122,13 +122,4 @@ ol.breadcrumb.alert-warning
122
122
  .panel-heading
123
123
  h1.panel-title Process Context
124
124
  .panel-body
125
- table.table.table-striped.table-hover
126
- thead
127
- tr
128
- th Key
129
- th Value
130
- tbody
131
- - resource.context.data.each_pair do |key, value|
132
- tr
133
- td = key
134
- td = value
125
+ = render @process.context.partial_name, { context: @process.context }
@@ -4,14 +4,7 @@ module RailsWorkflow
4
4
 
5
5
  def perform(parent_id, parent_class)
6
6
  parent = parent_class.constantize.find(parent_id)
7
-
8
- if parent.is_a? RailsWorkflow::Operation
9
- parent.status = RailsWorkflow::Operation::ERROR
10
- end
11
- if parent.is_a? RailsWorkflow::Process
12
- parent.status = RailsWorkflow::Process::ERROR
13
- end
14
-
7
+ parent.status = parent.class::ERROR
15
8
  parent.save
16
9
 
17
10
  if parent.respond_to?(:parent_operation) &&
@@ -0,0 +1,6 @@
1
+ class AddPartialNameToContext < ActiveRecord::Migration
2
+ def change
3
+ add_column :rails_workflow_operation_templates, :partial_name, :string
4
+ add_column :rails_workflow_process_templates, :partial_name, :string
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class ChangeDependenciesToJson < ActiveRecord::Migration
2
+ def change
3
+ change_column :rails_workflow_operation_templates, :dependencies, 'JSON USING dependencies::JSON'
4
+ change_column :rails_workflow_operations, :dependencies, 'JSON USING dependencies::JSON'
5
+ end
6
+ end