rails_workflow 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concerns/rails_workflow/operation_status.rb +2 -50
- data/app/concerns/rails_workflow/operation_templates/default_builder.rb +14 -0
- data/app/concerns/rails_workflow/operation_templates/dependencies.rb +7 -8
- data/app/concerns/rails_workflow/operations/default_runner.rb +19 -6
- data/app/concerns/rails_workflow/operations/dependencies.rb +12 -12
- data/app/concerns/rails_workflow/processes/default_runner.rb +1 -1
- data/app/concerns/rails_workflow/processes/dependency_resolver.rb +12 -17
- data/app/concerns/rails_workflow/status.rb +63 -0
- data/app/concerns/rails_workflow/user/assignment.rb +11 -5
- data/app/controllers/rails_workflow/errors_controller.rb +1 -1
- data/app/controllers/rails_workflow/operation_templates_controller.rb +45 -34
- data/app/controllers/rails_workflow/operations_controller.rb +37 -31
- data/app/controllers/rails_workflow/process_templates_controller.rb +41 -14
- data/app/controllers/rails_workflow/processes_controller.rb +53 -32
- data/app/decorators/rails_workflow/context_decorator.rb +6 -1
- data/app/decorators/rails_workflow/operation_decorator.rb +7 -15
- data/app/decorators/rails_workflow/operation_template_decorator.rb +1 -1
- data/app/decorators/rails_workflow/process_decorator.rb +1 -2
- data/app/decorators/rails_workflow/status_decorator.rb +17 -18
- data/app/models/rails_workflow/error.rb +5 -3
- data/app/models/rails_workflow/operation_template.rb +11 -22
- data/app/models/rails_workflow/process.rb +1 -1
- data/app/views/application/_context.html.slim +11 -0
- data/app/views/rails_workflow/operation_templates/_default_form.html.slim +12 -6
- data/app/views/rails_workflow/operation_templates/_user_group_form.html.slim +10 -5
- data/app/views/rails_workflow/operation_templates/_user_role_form.html.slim +10 -5
- data/app/views/rails_workflow/operation_templates/edit.html.slim +10 -10
- data/app/views/rails_workflow/operation_templates/index.html.slim +9 -9
- data/app/views/rails_workflow/operation_templates/new.html.slim +10 -10
- data/app/views/rails_workflow/operation_templates/show.html.slim +12 -12
- data/app/views/rails_workflow/operations/index.html.slim +1 -1
- data/app/views/rails_workflow/operations/show.html.slim +24 -33
- data/app/views/rails_workflow/process_templates/_form.html.slim +3 -3
- data/app/views/rails_workflow/process_templates/edit.html.slim +5 -5
- data/app/views/rails_workflow/process_templates/index.html.slim +2 -2
- data/app/views/rails_workflow/process_templates/new.html.slim +2 -2
- data/app/views/rails_workflow/process_templates/show.html.slim +9 -9
- data/app/views/rails_workflow/processes/index.html.slim +2 -2
- data/app/views/rails_workflow/processes/show.html.slim +16 -25
- data/app/workers/rails_workflow/error_worker.rb +1 -8
- data/db/migrate/20150215164401_add_partial_name_to_context.rb +6 -0
- data/db/migrate/20150217161051_change_dependencies_to_json.rb +6 -0
- data/lib/generators/rails_workflow/install/templates/create_workflow_processes.rb +132 -99
- data/lib/rails_workflow/version.rb +1 -1
- data/lib/rails_workflow.rb +20 -8
- data/spec/controllers/rails_workflow/operation_templates_controller_spec.rb +1 -2
- data/spec/controllers/rails_workflow/operations_controller_spec.rb +0 -1
- data/spec/controllers/rails_workflow/process_templates_controller_spec.rb +0 -1
- data/spec/controllers/rails_workflow/processes_controller_spec.rb +0 -1
- data/spec/core/rails_workflow/process_manager_spec.rb +17 -1
- data/spec/dummy/app/controllers/application_controller.rb +7 -1
- data/spec/dummy/app/models/user.rb +5 -5
- data/spec/dummy/config/application.rb +1 -0
- data/spec/dummy/config/{database.sample.yml → database.yml.sample} +0 -0
- data/spec/dummy/config/database.yml.semaphore +16 -0
- data/spec/dummy/config/routes.rb +0 -1
- data/spec/dummy/db/schema.rb +14 -12
- data/spec/dummy/log/development.log +23189 -0
- data/spec/dummy/log/test.log +86228 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0e4b210a8dc7adf45911c7c4ba8f7420 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1616e4e42ff5363173d1d39e6e2a03d4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/22bb4a1009f389151658be54233630d8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/310eee609d7bb0cabf2f8e68b83998b6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/31922eca362eb4de37a5021cccef630d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4de81d9fc089c3a5ba8d42b0056a9865 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5a73175a9ff8699c8927d3a0a876d868 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/68446d3bc756b2b4ac2b1844f17db53b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6a733df9ba21863060bf032f05171bfa +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8227b2b943e2ea911b543eb82228c432 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/94b7a81dd8f8ff07304196359c39ab38 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/94d08b6a05042055bc46262852b983ce +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/96232456037b81cdd1370e99ec2dcc02 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9a2014c7524f2e0958daed330fb0e02e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9b7130a48df56ce8511f3fd6ef903c95 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a2fe1c22fbe6c6a7cb9b8f02a6acf646 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ab0c70eaae03da94a23f832513ff652b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ab2060acff429fdb2590db736072bc0c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b1add619756a502780e48fb4677d62d4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b60aa6e3697ec580ac86be62a6f625f6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c36f232ed7926598f96095a8cc300c3e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ca09843ddbf5238fe84bc305118283ba +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cb0e266c16c56852a172fc789b601cba +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cb6ceea5ffc8a15e06b98ee6e1312290 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d0897c7c9960a927f82986088379f93e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d46bdc6254b6d822735475e06f2e7100 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d8f3150c250e5b7c730f1c8b883bf033 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e4ffa3e3b8053576aae12c9bdb64a075 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e9f705ee81f399edce42ea0b96f52f3b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/eda59a87268a2b4353ab0f5d8cf6bf97 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ef1957bb05e4fcd673c473e82a72e49a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f036d4fc72ce4649ae8186f985e60612 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f3664d9ecf05e354e7668dc11a76044a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f794c7b05987535f7000622afe6630d1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fc4a9cfb03faaeb5136786c085d7a289 +0 -0
- data/spec/models/rails_workflow/operation_spec.rb +11 -13
- data/spec/models/rails_workflow/operation_template_spec.rb +1 -1
- data/spec/rails_helper.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/controller_macros.rb +0 -7
- metadata +83 -18
- data/app/concerns/rails_workflow/process_status.rb +0 -66
- data/app/controllers/application_controller.rb +0 -3
- data/config/initializers/will_paginate.rb +0 -29
- data/spec/dummy/tmp/pids/server.pid +0 -1
@@ -1,39 +1,66 @@
|
|
1
|
-
require 'rails_workflow/application_controller'
|
2
1
|
module RailsWorkflow
|
3
|
-
class ProcessTemplatesController < ::
|
2
|
+
class ProcessTemplatesController < ::ActionController::Base
|
3
|
+
layout 'rails_workflow/application'
|
4
|
+
respond_to :html
|
5
|
+
|
6
|
+
before_action :set_process_template, only: [:show, :edit, :update, :destroy]
|
7
|
+
|
4
8
|
before_filter do
|
5
9
|
@config_section_active = true
|
6
10
|
end
|
7
11
|
|
8
|
-
|
12
|
+
|
13
|
+
def index
|
14
|
+
@process_templates = ProcessTemplateDecorator.
|
15
|
+
decorate_collection(process_templates_collection)
|
16
|
+
|
17
|
+
respond_with(@process_templates)
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def new
|
22
|
+
@process_template = ProcessTemplate.new(permitted_params).decorate
|
23
|
+
respond_with @process_template
|
24
|
+
end
|
25
|
+
|
9
26
|
|
10
27
|
def create
|
11
|
-
|
12
|
-
|
28
|
+
@process_template = ProcessTemplate.create(permitted_params)
|
29
|
+
redirect_to process_template_operation_templates_path(@process_template)
|
13
30
|
end
|
14
31
|
|
15
32
|
def update
|
16
|
-
update
|
33
|
+
@process_template.update(permitted_params)
|
34
|
+
redirect_to process_template_url(@process_template)
|
17
35
|
end
|
18
36
|
|
19
37
|
def destroy
|
20
|
-
destroy
|
38
|
+
@process_template.destroy
|
39
|
+
redirect_to process_templates_url
|
21
40
|
end
|
22
41
|
|
23
42
|
protected
|
24
43
|
def permitted_params
|
25
|
-
params.permit(
|
44
|
+
params.permit(
|
45
|
+
process_template: [
|
46
|
+
:title,
|
47
|
+
:source,
|
48
|
+
:manager_class,
|
49
|
+
:partial_name,
|
50
|
+
:process_class,
|
51
|
+
:type
|
52
|
+
]
|
53
|
+
)[:process_template]
|
26
54
|
end
|
27
55
|
|
28
|
-
|
29
|
-
|
30
|
-
::RailsWorkflow::ProcessTemplateDecorator.decorate_collection(super)
|
56
|
+
def set_process_template
|
57
|
+
@process_template = ProcessTemplate.find(params[:id]).decorate
|
31
58
|
end
|
32
59
|
|
33
|
-
def
|
34
|
-
|
60
|
+
def process_templates_collection
|
61
|
+
ProcessTemplate.
|
62
|
+
order(id: :desc)
|
35
63
|
end
|
36
64
|
|
37
|
-
|
38
65
|
end
|
39
66
|
end
|
@@ -1,70 +1,91 @@
|
|
1
|
-
require 'rails_workflow/application_controller'
|
2
1
|
module RailsWorkflow
|
3
|
-
class ProcessesController < ::
|
2
|
+
class ProcessesController < ::ActionController::Base
|
4
3
|
layout 'rails_workflow/application'
|
4
|
+
respond_to :html
|
5
|
+
before_action :set_process, only: [:show, :edit, :update, :destroy]
|
5
6
|
|
6
7
|
before_filter do
|
7
8
|
@processes_section_active = true
|
8
9
|
end
|
9
10
|
|
10
|
-
def create
|
11
|
-
#any process should be build by process manager
|
12
|
-
#using some process template.
|
13
11
|
|
14
|
-
|
12
|
+
def index
|
13
|
+
@processes = ProcessDecorator.decorate_collection(undecorated_collection)
|
15
14
|
|
16
|
-
|
17
|
-
|
15
|
+
@errors = Error.
|
16
|
+
unresolved.order(id: :asc).
|
17
|
+
includes(:parent).limit(10)
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
@open_user_operations = OperationDecorator.
|
20
|
+
decorate_collection(
|
21
|
+
RailsWorkflow::Operation.incompleted.
|
22
|
+
unassigned.includes(:template).
|
23
|
+
limit(20)
|
24
|
+
)
|
25
|
+
|
26
|
+
@statistic = {
|
27
|
+
all: RailsWorkflow::Process.count,
|
28
|
+
statuses: RailsWorkflow::Process.count_by_statuses
|
29
|
+
}
|
21
30
|
end
|
22
31
|
|
23
|
-
def
|
24
|
-
|
32
|
+
def new
|
33
|
+
@process = Process.new(permitted_params).decorate
|
25
34
|
end
|
26
35
|
|
27
|
-
def index
|
28
36
|
|
29
|
-
|
30
|
-
@
|
31
|
-
|
37
|
+
def create
|
38
|
+
@process = RailsWorkflow::ProcessManager.start_process(
|
39
|
+
params[:process][:template_id], {}
|
32
40
|
)
|
33
|
-
@statistic = {
|
34
|
-
all: RailsWorkflow::Process.count,
|
35
|
-
statuses: RailsWorkflow::Process.count_by_statuses
|
36
|
-
}
|
37
41
|
|
38
|
-
|
42
|
+
redirect_to process_url(@process)
|
39
43
|
end
|
40
44
|
|
41
45
|
|
46
|
+
def update
|
47
|
+
@process.update(permitted_params)
|
48
|
+
redirect_to processes_path
|
49
|
+
end
|
50
|
+
|
51
|
+
def destroy
|
52
|
+
@process.destroy
|
53
|
+
redirect_to processes_path
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
|
42
58
|
protected
|
43
59
|
def permitted_params
|
44
|
-
params.permit(
|
60
|
+
params.permit(
|
61
|
+
process: [
|
62
|
+
:status,
|
63
|
+
:async,
|
64
|
+
:title,
|
65
|
+
:template_id
|
66
|
+
],
|
67
|
+
filter: [:status]
|
68
|
+
)[:process]
|
45
69
|
end
|
46
70
|
|
47
71
|
def undecorated_collection
|
48
|
-
|
49
|
-
collection_scope =
|
72
|
+
|
73
|
+
collection_scope = Process.default_scoped
|
50
74
|
|
51
75
|
if params[:filter]
|
52
|
-
status =
|
76
|
+
status = Process.get_status_code(params[:filter]['status'])
|
53
77
|
collection_scope = collection_scope.by_status(status)
|
54
78
|
end
|
55
79
|
|
56
|
-
|
80
|
+
collection_scope.paginate(page: params[:page]).order(created_at: :desc)
|
57
81
|
|
58
|
-
end
|
59
82
|
end
|
60
83
|
|
61
84
|
|
62
|
-
def collection
|
63
|
-
ProcessDecorator.decorate_collection(undecorated_collection)
|
64
|
-
end
|
65
85
|
|
66
|
-
|
67
|
-
|
86
|
+
|
87
|
+
def set_process
|
88
|
+
@process ||= ProcessDecorator.decorate(Process.find params[:id]).decorate
|
68
89
|
end
|
69
90
|
|
70
91
|
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module RailsWorkflow
|
2
|
-
class ContextDecorator < Decorator
|
2
|
+
class ContextDecorator < Draper::Decorator
|
3
|
+
|
4
|
+
def partial_name
|
5
|
+
object.parent.template.partial_name.presence || "application/context"
|
6
|
+
end
|
7
|
+
|
3
8
|
def data
|
4
9
|
if object.present?
|
5
10
|
object.prepare_data object.data
|
@@ -2,6 +2,12 @@
|
|
2
2
|
module RailsWorkflow
|
3
3
|
class OperationDecorator < OperationHelperDecorator
|
4
4
|
delegate_all
|
5
|
+
decorates_association :template, with: OperationTemplateDecorator
|
6
|
+
|
7
|
+
|
8
|
+
def context
|
9
|
+
ContextDecorator.decorate object.context
|
10
|
+
end
|
5
11
|
|
6
12
|
def process
|
7
13
|
object.process.decorate
|
@@ -32,23 +38,9 @@ module RailsWorkflow
|
|
32
38
|
|
33
39
|
end
|
34
40
|
|
35
|
-
def context
|
36
|
-
ContextDecorator.decorate(object.context).data
|
37
|
-
end
|
38
41
|
|
39
42
|
def show_template_dependencies
|
40
|
-
|
41
|
-
object.template.dependencies.map do |dependency|
|
42
|
-
depends_on = OperationTemplate.where(id: dependency['id']).pluck(:title).first
|
43
|
-
statuses = object.
|
44
|
-
get_status_values.
|
45
|
-
select{|status| dependency['statuses'].include? status[0]}
|
46
|
-
[depends_on] + statuses.map(&:last)
|
47
|
-
end
|
48
|
-
else
|
49
|
-
[]
|
50
|
-
end
|
51
|
-
|
43
|
+
template.show_dependencies
|
52
44
|
end
|
53
45
|
|
54
46
|
end
|
@@ -20,7 +20,7 @@ module RailsWorkflow
|
|
20
20
|
|
21
21
|
def other_operations
|
22
22
|
if object.persisted?
|
23
|
-
object.
|
23
|
+
object.other_operations.order(id: :asc).to_a
|
24
24
|
else
|
25
25
|
#operations without current to build dependencies form part
|
26
26
|
object.process_template.operations.to_a - [object]
|
@@ -5,31 +5,30 @@ module RailsWorkflow
|
|
5
5
|
included do
|
6
6
|
def status
|
7
7
|
if object.status
|
8
|
-
|
9
|
-
label_class = 'label-default'
|
10
|
-
|
11
|
-
if object.status == object.class::DONE
|
12
|
-
label_class = 'label-success'
|
13
|
-
elsif [object.class::IN_PROGRESS, object.class::WAITING].include? object.status
|
14
|
-
label_class = 'label-primary'
|
15
|
-
elsif object.status == object.class::ERROR
|
16
|
-
label_class = 'label-danger'
|
17
|
-
#'warning'
|
18
|
-
end
|
19
|
-
|
20
|
-
text = object.get_status_values.
|
21
|
-
detect { |status| object.status == status[0] }[1]
|
22
|
-
|
23
8
|
{
|
24
|
-
class:
|
25
|
-
text:
|
9
|
+
class: get_label_class(object),
|
10
|
+
text: object.get_status_values.assoc(object.status)[1]
|
26
11
|
}
|
27
12
|
else
|
28
13
|
{
|
29
14
|
class: nil,
|
30
|
-
text: nil
|
15
|
+
text: nil
|
31
16
|
}
|
32
17
|
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_label_class object
|
22
|
+
case object.status
|
23
|
+
when object.class::DONE
|
24
|
+
'label-success'
|
25
|
+
when object.class::IN_PROGRESS..object.class::WAITING
|
26
|
+
'label-primary'
|
27
|
+
when object.class::ERROR
|
28
|
+
'label-danger'
|
29
|
+
else
|
30
|
+
'label-default'
|
31
|
+
end
|
33
32
|
end
|
34
33
|
|
35
34
|
end
|
@@ -4,12 +4,14 @@ module RailsWorkflow
|
|
4
4
|
has_one :context, class_name: "RailsWorkflow::Context", as: :parent
|
5
5
|
scope :unresolved, -> { where("resolved is null or resolved = false")}
|
6
6
|
|
7
|
+
delegate :data, to: :context
|
8
|
+
|
7
9
|
def retry
|
8
10
|
update_attribute(:resolved, true)
|
9
11
|
|
10
|
-
target =
|
11
|
-
method =
|
12
|
-
args =
|
12
|
+
target = data[:target]
|
13
|
+
method = data[:method]
|
14
|
+
args = data[:args]
|
13
15
|
|
14
16
|
target.send(method, *args)
|
15
17
|
|
@@ -8,24 +8,21 @@ module RailsWorkflow
|
|
8
8
|
belongs_to :process_template, class_name: "RailsWorkflow::ProcessTemplate"
|
9
9
|
belongs_to :child_process, class_name: "RailsWorkflow::ProcessTemplate"
|
10
10
|
|
11
|
-
|
11
|
+
scope :other_operations, ->(process_template_id, operation_template_id) {
|
12
|
+
where(process_template_id: process_template_id).
|
13
|
+
where.not(id: operation_template_id)
|
14
|
+
}
|
12
15
|
|
13
|
-
def types
|
14
|
-
RailsWorkflow.config.operation_types
|
15
|
-
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies.first.try(:context).try(:data)
|
21
|
-
end
|
17
|
+
def other_operations
|
18
|
+
OperationTemplate.other_operations(self.process_template_id, self.id)
|
19
|
+
end
|
22
20
|
|
23
|
-
def build_context! operation, dependencies
|
24
|
-
RailsWorkflow::Context.new(
|
25
|
-
parent: operation,
|
26
|
-
data: build_context(dependencies) || operation.process.data)
|
27
|
-
end
|
28
21
|
|
22
|
+
class << self
|
23
|
+
def types
|
24
|
+
RailsWorkflow.config.operation_types
|
25
|
+
end
|
29
26
|
end
|
30
27
|
|
31
28
|
|
@@ -38,14 +35,6 @@ module RailsWorkflow
|
|
38
35
|
RailsWorkflow.config.default_operation_template_type
|
39
36
|
end
|
40
37
|
|
41
|
-
def resolve_dependency operation
|
42
|
-
true
|
43
|
-
end
|
44
|
-
|
45
|
-
def resolve_dependency! operation
|
46
|
-
resolve_dependency operation
|
47
|
-
end
|
48
|
-
|
49
38
|
private
|
50
39
|
def default_class kind
|
51
40
|
RailsWorkflow.config.operation_types[kind][:class]
|
@@ -1,11 +1,11 @@
|
|
1
|
-
- if
|
1
|
+
- if @operation_template.errors.any?
|
2
2
|
#error_explanation
|
3
|
-
h2 = "#{pluralize(
|
3
|
+
h2 = "#{pluralize(@operation_template.errors.count, "error")} prohibited this wf_operation_template from being saved:"
|
4
4
|
ul
|
5
|
-
-
|
5
|
+
- @operation_template.errors.full_messages.each do |message|
|
6
6
|
li = message
|
7
7
|
|
8
|
-
= hidden_field_tag 'operation_template[kind]',
|
8
|
+
= hidden_field_tag 'operation_template[kind]', @operation_template.kind
|
9
9
|
|
10
10
|
.form-group
|
11
11
|
= f.label :title, class: "control-label col-sm-2"
|
@@ -19,14 +19,20 @@
|
|
19
19
|
= f.text_field :operation_class, class: "form-control", placeholder: f.object.default_class
|
20
20
|
|
21
21
|
.form-group
|
22
|
-
= f.label :type, "
|
22
|
+
= f.label :type, "Template Class", class: "control-label col-sm-2"
|
23
23
|
.col-sm-10
|
24
24
|
= f.text_field :type, class: "form-control", placeholder: f.object.default_type
|
25
25
|
|
26
|
+
.form-group
|
27
|
+
= f.label :partial_name, "Context Partial", class: "control-label col-sm-2"
|
28
|
+
.col-sm-10
|
29
|
+
= f.text_field :partial_name, class: "form-control", placeholder: "Default"
|
30
|
+
|
31
|
+
|
26
32
|
.form-group
|
27
33
|
= f.label :child_process, class: "control-label col-sm-2"
|
28
34
|
.col-sm-10
|
29
|
-
= f.collection_select(:child_process_id,
|
35
|
+
= f.collection_select(:child_process_id, @process_template.other_processes, :id, :title, {include_blank: true}, { class: "form-control" })
|
30
36
|
|
31
37
|
.checkbox
|
32
38
|
.col-sm-2
|
@@ -1,11 +1,11 @@
|
|
1
|
-
- if
|
1
|
+
- if @operation_template.errors.any?
|
2
2
|
#error_explanation
|
3
|
-
h2 = "#{pluralize(
|
3
|
+
h2 = "#{pluralize(@operation_template.errors.count, "error")} prohibited this wf_operation_template from being saved:"
|
4
4
|
ul
|
5
|
-
-
|
5
|
+
- @operation_template.errors.full_messages.each do |message|
|
6
6
|
li = message
|
7
7
|
|
8
|
-
= hidden_field_tag 'operation_template[kind]',
|
8
|
+
= hidden_field_tag 'operation_template[kind]', @operation_template.kind
|
9
9
|
|
10
10
|
.form-group
|
11
11
|
= f.label :group, class: "control-label col-sm-2"
|
@@ -24,10 +24,15 @@
|
|
24
24
|
= f.text_field :operation_class, class: "form-control", placeholder: f.object.default_class
|
25
25
|
|
26
26
|
.form-group
|
27
|
-
= f.label :type, "
|
27
|
+
= f.label :type, "Template Class", class: "control-label col-sm-2"
|
28
28
|
.col-sm-10
|
29
29
|
= f.text_field :type, class: "form-control", placeholder: f.object.default_type
|
30
30
|
|
31
|
+
.form-group
|
32
|
+
= f.label :partial_name, "Context Partial", class: "control-label col-sm-2"
|
33
|
+
.col-sm-10
|
34
|
+
= f.text_field :partial_name, class: "form-control", placeholder: "Default"
|
35
|
+
|
31
36
|
.form-group
|
32
37
|
.col-sm-2
|
33
38
|
.col-sm-10
|
@@ -1,11 +1,11 @@
|
|
1
|
-
- if
|
1
|
+
- if @operation_template.errors.any?
|
2
2
|
#error_explanation
|
3
|
-
h2 = "#{pluralize(
|
3
|
+
h2 = "#{pluralize(@operation_template.errors.count, "error")} prohibited this wf_operation_template from being saved:"
|
4
4
|
ul
|
5
|
-
-
|
5
|
+
- @operation_template.errors.full_messages.each do |message|
|
6
6
|
li = message
|
7
7
|
|
8
|
-
= hidden_field_tag 'operation_template[kind]',
|
8
|
+
= hidden_field_tag 'operation_template[kind]', @operation_template.kind
|
9
9
|
|
10
10
|
.form-group
|
11
11
|
= f.label :role, class: "control-label col-sm-2"
|
@@ -24,10 +24,15 @@
|
|
24
24
|
= f.text_field :operation_class, class: "form-control", placeholder: f.object.default_class
|
25
25
|
|
26
26
|
.form-group
|
27
|
-
= f.label :type, "
|
27
|
+
= f.label :type, "Template Class", class: "control-label col-sm-2"
|
28
28
|
.col-sm-10
|
29
29
|
= f.text_field :type, class: "form-control", placeholder: f.object.default_type
|
30
30
|
|
31
|
+
.form-group
|
32
|
+
= f.label :partial_name, "Context Partial", class: "control-label col-sm-2"
|
33
|
+
.col-sm-10
|
34
|
+
= f.text_field :partial_name, class: "form-control", placeholder: "Default"
|
35
|
+
|
31
36
|
.form-group
|
32
37
|
.col-sm-2
|
33
38
|
.col-sm-10
|
@@ -3,31 +3,31 @@ ol.breadcrumb.alert-warning
|
|
3
3
|
li
|
4
4
|
= link_to "Configuration", process_templates_path
|
5
5
|
li
|
6
|
-
= link_to "Template: #{
|
6
|
+
= link_to "Template: #{@process_template.title}", process_template_path(@process_template)
|
7
7
|
li.active
|
8
|
-
= "Operation Template: #{
|
8
|
+
= "Operation Template: #{@operation_template.title}"
|
9
9
|
|
10
|
-
= render partial: "flash", locals: {notice: notice}
|
10
|
+
= render partial: "application/flash", locals: {notice: notice}
|
11
11
|
.row
|
12
12
|
.col-md-10
|
13
13
|
.panel
|
14
14
|
.panel-heading
|
15
15
|
h1.panel-title
|
16
|
-
= "Operation: #{
|
16
|
+
= "Operation: #{@operation_template.title}"
|
17
17
|
.panel-body
|
18
18
|
|
19
|
-
= form_for [
|
20
|
-
= render partial:
|
19
|
+
= form_for [@process_template, @operation_template], url: process_template_operation_template_path, html: {class: "form-horizontal clearfix"} do |f|
|
20
|
+
= render partial: @operation_template.form, locals: {f: f}
|
21
21
|
.form-group
|
22
22
|
= f.label :dependencies, class: "control-label col-sm-2"
|
23
23
|
.col-sm-10
|
24
|
-
- if
|
24
|
+
- if @operation_template.other_operations.blank?
|
25
25
|
.checkbox
|
26
26
|
label
|
27
27
|
| There is no other operations in this process template.
|
28
28
|
|
29
|
-
-
|
30
|
-
- matched_dependency =
|
29
|
+
- @operation_template.other_operations.each_with_index do |depends_on, index|
|
30
|
+
- matched_dependency = @operation_template.dependencies.detect { |d| d['id'] == depends_on.id }
|
31
31
|
.panel.panel-warning
|
32
32
|
.panel-heading
|
33
33
|
.checkbox
|
@@ -44,5 +44,5 @@ ol.breadcrumb.alert-warning
|
|
44
44
|
= check_box "operation_template[dependencies][#{index}]", "statuses", {multiple: true, checked: status_matched}, status[0].to_s, nil
|
45
45
|
= status[1]
|
46
46
|
.btn-toolbar.pull-right
|
47
|
-
= link_to 'Back', process_template_operation_templates_path(
|
47
|
+
= link_to 'Back', process_template_operation_templates_path(@process_template), class: "btn btn-default"
|
48
48
|
= f.submit value: 'Save', class: "btn btn-success"
|
@@ -8,11 +8,11 @@ ol.breadcrumb.alert-warning
|
|
8
8
|
li
|
9
9
|
= link_to "Configuration", process_templates_path
|
10
10
|
li.active
|
11
|
-
= "Template: #{
|
11
|
+
= "Template: #{@process_template.title}"
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
= render partial: "flash", locals: {notice: notice}
|
15
|
+
= render partial: "application/flash", locals: {notice: notice}
|
16
16
|
|
17
17
|
|
18
18
|
.row
|
@@ -20,7 +20,7 @@ ol.breadcrumb.alert-warning
|
|
20
20
|
.panel
|
21
21
|
.panel-heading
|
22
22
|
h1.panel-title
|
23
|
-
= "Template: #{
|
23
|
+
= "Template: #{@process_template.title}"
|
24
24
|
.panel-body
|
25
25
|
|
26
26
|
table.table.table-striped.table-hover
|
@@ -36,9 +36,9 @@ ol.breadcrumb.alert-warning
|
|
36
36
|
|
37
37
|
|
38
38
|
tbody
|
39
|
-
-
|
39
|
+
- @operation_templates.each do |operation|
|
40
40
|
tr
|
41
|
-
td = link_to operation.title, process_template_operation_template_path(
|
41
|
+
td = link_to operation.title, process_template_operation_template_path(@process_template, operation)
|
42
42
|
td = operation.assignment
|
43
43
|
td
|
44
44
|
ul.list-unstyled
|
@@ -51,13 +51,13 @@ ol.breadcrumb.alert-warning
|
|
51
51
|
- if operation.child_process.present?
|
52
52
|
= operation.child_process.title
|
53
53
|
span.label.label-default<> = (operation.async || false) ? "async" : "sync"
|
54
|
-
td = link_to 'Edit', edit_process_template_operation_template_path(
|
55
|
-
td = link_to 'Destroy', process_template_operation_template_path(
|
54
|
+
td = link_to 'Edit', edit_process_template_operation_template_path(@process_template, operation)
|
55
|
+
td = link_to 'Destroy', process_template_operation_template_path(@process_template, operation), data: {:confirm => 'Are you sure?'}, :method => :delete
|
56
56
|
|
57
57
|
.col-md-2
|
58
58
|
.row
|
59
59
|
.btn-group
|
60
|
-
= button_to "Create Process", { controller: "processes", action: "create", process: { template_id:
|
60
|
+
= button_to "Create Process", { controller: "processes", action: "create", process: { template_id: @process_template.id } }, method: :post, class: "btn btn-lg btn-success"
|
61
61
|
br
|
62
62
|
br
|
63
63
|
.btn-group
|
@@ -72,6 +72,6 @@ ol.breadcrumb.alert-warning
|
|
72
72
|
br
|
73
73
|
br
|
74
74
|
.btn-group
|
75
|
-
= link_to 'Edit', edit_process_template_path(
|
75
|
+
= link_to 'Edit', edit_process_template_path(@process_template), class: "btn btn-primary"
|
76
76
|
|
77
77
|
|