rules_engine 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rules_engine/process/auditor/db_auditor.rb +1 -0
- data/lib/rules_engine/rule/outcome.rb +1 -0
- data/rails_generators/manifests/complex.rb +4 -1
- data/rails_generators/manifests/complex.yml +0 -1
- data/rails_generators/manifests/rules_engine.rb +15 -2
- data/rails_generators/manifests/rules_engine.yml +0 -2
- data/rails_generators/manifests/simple.rb +4 -1
- data/rails_generators/manifests/simple.yml +0 -1
- data/rails_generators/templates/app/controllers/re_plan_workflows_controller.rb +30 -5
- data/rails_generators/templates/app/controllers/re_plans_controller.rb +26 -2
- data/rails_generators/templates/app/controllers/re_workflows_controller.rb +27 -2
- data/rails_generators/templates/app/models/re_rule.rb +0 -30
- data/rails_generators/templates/app/rules/complex.rb +3 -3
- data/rails_generators/templates/app/views/re_plan_workflows/change.html.erb +6 -2
- data/rails_generators/templates/app/views/re_plan_workflows/copy.html.erb +12 -0
- data/rails_generators/templates/app/views/re_plan_workflows/copy.js.erb +8 -0
- data/rails_generators/templates/app/views/re_plan_workflows/new.js.erb +5 -1
- data/rails_generators/templates/app/views/re_plan_workflows/show.html.erb +3 -2
- data/rails_generators/templates/app/views/re_plans/_copy.html.erb +18 -0
- data/rails_generators/templates/app/views/re_plans/_preview.html.erb +1 -1
- data/rails_generators/templates/app/views/re_plans/_workflow_preview.html.erb +1 -3
- data/rails_generators/templates/app/views/re_plans/change.html.erb +6 -0
- data/rails_generators/templates/app/views/re_plans/copy.html.erb +11 -0
- data/rails_generators/templates/app/views/re_plans/copy.js.erb +9 -0
- data/rails_generators/templates/app/views/re_plans/new.js.erb +4 -1
- data/rails_generators/templates/app/views/re_plans/show.html.erb +1 -1
- data/rails_generators/templates/app/views/re_rule_definitions/complex/_form.html.erb +2 -2
- data/rails_generators/templates/app/views/re_rule_definitions/simple/_form.html.erb +1 -1
- data/rails_generators/templates/app/views/re_workflows/_copy.html.erb +21 -0
- data/rails_generators/templates/app/views/re_workflows/_rule_change.html.erb +11 -14
- data/rails_generators/templates/app/views/re_workflows/_rule_preview.html.erb +14 -17
- data/rails_generators/templates/app/views/re_workflows/_rule_show.html.erb +13 -16
- data/rails_generators/templates/app/views/re_workflows/_show.html.erb +1 -3
- data/rails_generators/templates/app/views/re_workflows/change.html.erb +5 -0
- data/rails_generators/templates/app/views/re_workflows/copy.html.erb +11 -0
- data/rails_generators/templates/app/views/re_workflows/copy.js.erb +8 -0
- data/rails_generators/templates/app/views/re_workflows/index.html.erb +1 -1
- data/rails_generators/templates/app/views/re_workflows/preview.html.erb +1 -0
- data/rails_generators/templates/app/views/re_workflows/show.html.erb +3 -2
- data/rails_generators/templates/app/views/re_workflows/update.js.erb +1 -1
- data/rails_generators/templates/db/migrate/20100308225008_create_rules_engine.rb +0 -13
- data/rails_generators/templates/doc/README.rules_engine +7 -6
- data/rails_generators/templates/lib/tasks/rules_engine.rake +2 -2
- data/rails_generators/templates/public/javascripts/rules_engine/re_plan_change.js +20 -0
- data/rails_generators/templates/public/javascripts/rules_engine/re_plan_new.js +2 -8
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_add.js +3 -12
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_change.js +23 -4
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_new.js +2 -8
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_show.js +22 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/copy-25.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_workflow/copy-25.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/screen.css +52 -1
- data/rails_generators/templates/spec/lib/rules/complex_spec.rb +46 -41
- data/rails_generators/templates/spec/lib/rules/simple_spec.rb +41 -35
- data/rails_generators/templates/spec/models/re_rule_spec.rb +12 -74
- metadata +15 -6
- data/rails_generators/templates/app/models/re_rule_expected_outcome.rb +0 -14
- data/rails_generators/templates/spec/models/re_rule_expected_outcome_spec.rb +0 -29
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
@@ -22,6 +22,7 @@ module RulesEngine
|
|
22
22
|
|
23
23
|
def audit(process_id, message, code = RulesEngine::Process::AUDIT_INFO)
|
24
24
|
if perform_audit?(code)
|
25
|
+
# $stderr.puts("#{'*' * 5} #{process_id}, #{code}, #{message}")
|
25
26
|
ReProcessAudit.create({
|
26
27
|
:process_id => process_id,
|
27
28
|
:created_at => Time.now,
|
@@ -4,7 +4,6 @@ class ComplexManifest
|
|
4
4
|
%W(
|
5
5
|
app/rules
|
6
6
|
app/views/re_rule_definitions/#{rule_name}
|
7
|
-
lib/tasks
|
8
7
|
spec/lib/rules
|
9
8
|
).each do |dirname|
|
10
9
|
m.directory dirname
|
@@ -24,4 +23,8 @@ class ComplexManifest
|
|
24
23
|
m.template "spec/lib/rules/complex_spec.rb", "spec/lib/rules/#{rule_name}_spec.rb"
|
25
24
|
|
26
25
|
end
|
26
|
+
|
27
|
+
def self.after_generate(rule_name ,rule_class)
|
28
|
+
end
|
29
|
+
|
27
30
|
end
|
@@ -66,7 +66,6 @@ class RulesEngineManifest
|
|
66
66
|
app/models/re_plan.rb
|
67
67
|
app/models/re_plan_workflow.rb
|
68
68
|
app/models/re_rule.rb
|
69
|
-
app/models/re_rule_expected_outcome.rb
|
70
69
|
app/models/re_workflow.rb
|
71
70
|
app/views/layouts/rules_engine.html.erb
|
72
71
|
app/views/re_plan_workflow_rules/edit.html.erb
|
@@ -79,6 +78,8 @@ class RulesEngineManifest
|
|
79
78
|
app/views/re_plan_workflow_rules/new.js.erb
|
80
79
|
app/views/re_plan_workflow_rules/update.js.erb
|
81
80
|
app/views/re_plan_workflows/change.html.erb
|
81
|
+
app/views/re_plan_workflows/copy.html.erb
|
82
|
+
app/views/re_plan_workflows/copy.js.erb
|
82
83
|
app/views/re_plan_workflows/edit.html.erb
|
83
84
|
app/views/re_plan_workflows/edit.js.erb
|
84
85
|
app/views/re_plan_workflows/new.html.erb
|
@@ -86,6 +87,7 @@ class RulesEngineManifest
|
|
86
87
|
app/views/re_plan_workflows/show.html.erb
|
87
88
|
app/views/re_plan_workflows/update.js.erb
|
88
89
|
app/views/re_plans/_change.html.erb
|
90
|
+
app/views/re_plans/_copy.html.erb
|
89
91
|
app/views/re_plans/_edit.html.erb
|
90
92
|
app/views/re_plans/_empty.html.erb
|
91
93
|
app/views/re_plans/_index.html.erb
|
@@ -97,6 +99,8 @@ class RulesEngineManifest
|
|
97
99
|
app/views/re_plans/_workflow_preview.html.erb
|
98
100
|
app/views/re_plans/_workflow_show.html.erb
|
99
101
|
app/views/re_plans/change.html.erb
|
102
|
+
app/views/re_plans/copy.html.erb
|
103
|
+
app/views/re_plans/copy.js.erb
|
100
104
|
app/views/re_plans/create.js.erb
|
101
105
|
app/views/re_plans/edit.html.erb
|
102
106
|
app/views/re_plans/edit.js.erb
|
@@ -137,6 +141,7 @@ class RulesEngineManifest
|
|
137
141
|
app/views/re_workflow_rules/update.js.erb
|
138
142
|
app/views/re_workflows/_add_prepare.html.erb
|
139
143
|
app/views/re_workflows/_add_update.html.erb
|
144
|
+
app/views/re_workflows/_copy.html.erb
|
140
145
|
app/views/re_workflows/_edit.html.erb
|
141
146
|
app/views/re_workflows/_empty.html.erb
|
142
147
|
app/views/re_workflows/_index.html.erb
|
@@ -153,6 +158,8 @@ class RulesEngineManifest
|
|
153
158
|
app/views/re_workflows/add.html.erb
|
154
159
|
app/views/re_workflows/add.js.erb
|
155
160
|
app/views/re_workflows/change.html.erb
|
161
|
+
app/views/re_workflows/copy.html.erb
|
162
|
+
app/views/re_workflows/copy.js.erb
|
156
163
|
app/views/re_workflows/create.js.erb
|
157
164
|
app/views/re_workflows/edit.html.erb
|
158
165
|
app/views/re_workflows/edit.js.erb
|
@@ -195,6 +202,7 @@ class RulesEngineManifest
|
|
195
202
|
public/javascripts/rules_engine/re_workflow_new.js
|
196
203
|
public/javascripts/rules_engine/re_workflow_plan.js
|
197
204
|
public/javascripts/rules_engine/re_workflow_preview.js
|
205
|
+
public/javascripts/rules_engine/re_workflow_show.js
|
198
206
|
public/stylesheets/blueprint/ie.css
|
199
207
|
public/stylesheets/blueprint/plugins/buttons/icons/cross.png
|
200
208
|
public/stylesheets/blueprint/plugins/buttons/icons/key.png
|
@@ -285,6 +293,7 @@ class RulesEngineManifest
|
|
285
293
|
public/stylesheets/rules_engine/images/rules_engine/re_common/status-verify-25.png
|
286
294
|
public/stylesheets/rules_engine/images/rules_engine/re_plan/alert-25.png
|
287
295
|
public/stylesheets/rules_engine/images/rules_engine/re_plan/change-25.png
|
296
|
+
public/stylesheets/rules_engine/images/rules_engine/re_plan/copy-25.png
|
288
297
|
public/stylesheets/rules_engine/images/rules_engine/re_plan/delete-25.png
|
289
298
|
public/stylesheets/rules_engine/images/rules_engine/re_plan/edit-25.png
|
290
299
|
public/stylesheets/rules_engine/images/rules_engine/re_plan/list-25.png
|
@@ -327,6 +336,7 @@ class RulesEngineManifest
|
|
327
336
|
public/stylesheets/rules_engine/images/rules_engine/re_workflow/alert-25.png
|
328
337
|
public/stylesheets/rules_engine/images/rules_engine/re_workflow/change-18.png
|
329
338
|
public/stylesheets/rules_engine/images/rules_engine/re_workflow/change-25.png
|
339
|
+
public/stylesheets/rules_engine/images/rules_engine/re_workflow/copy-25.png
|
330
340
|
public/stylesheets/rules_engine/images/rules_engine/re_workflow/delete-25.png
|
331
341
|
public/stylesheets/rules_engine/images/rules_engine/re_workflow/edit-25.png
|
332
342
|
public/stylesheets/rules_engine/images/rules_engine/re_workflow/is-default-18.png
|
@@ -346,7 +356,6 @@ class RulesEngineManifest
|
|
346
356
|
spec/helpers/rules_engine_helper_spec.rb
|
347
357
|
spec/models/re_plan_spec.rb
|
348
358
|
spec/models/re_plan_workflow_spec.rb
|
349
|
-
spec/models/re_rule_expected_outcome_spec.rb
|
350
359
|
spec/models/re_rule_spec.rb
|
351
360
|
spec/models/re_workflow_spec.rb
|
352
361
|
spec/support/rules_engine_blueprints.rb
|
@@ -357,4 +366,8 @@ class RulesEngineManifest
|
|
357
366
|
|
358
367
|
|
359
368
|
end
|
369
|
+
|
370
|
+
def self.after_generate()
|
371
|
+
end
|
372
|
+
|
360
373
|
end
|
@@ -34,7 +34,6 @@ files :
|
|
34
34
|
- app/models/re_plan.rb
|
35
35
|
- app/models/re_plan_workflow.rb
|
36
36
|
- app/models/re_rule.rb
|
37
|
-
- app/models/re_rule_expected_outcome.rb
|
38
37
|
- app/models/re_workflow.rb
|
39
38
|
|
40
39
|
- app/views/layouts/rules_engine.html.erb
|
@@ -60,7 +59,6 @@ files :
|
|
60
59
|
- spec/models/re_plan_spec.rb
|
61
60
|
- spec/models/re_plan_workflow_spec.rb
|
62
61
|
- spec/models/re_rule_spec.rb
|
63
|
-
- spec/models/re_rule_expected_outcome_spec.rb
|
64
62
|
- spec/models/re_workflow_spec.rb
|
65
63
|
|
66
64
|
- spec/controllers/re_plans_controller_spec.rb
|
@@ -4,7 +4,6 @@ class SimpleManifest
|
|
4
4
|
%W(
|
5
5
|
app/rules
|
6
6
|
app/views/re_rule_definitions/#{rule_name}
|
7
|
-
lib/tasks
|
8
7
|
spec/lib/rules
|
9
8
|
).each do |dirname|
|
10
9
|
m.directory dirname
|
@@ -23,4 +22,8 @@ class SimpleManifest
|
|
23
22
|
m.template "spec/lib/rules/simple_spec.rb", "spec/lib/rules/#{rule_name}_spec.rb"
|
24
23
|
|
25
24
|
end
|
25
|
+
|
26
|
+
def self.after_generate(rule_name ,rule_class)
|
27
|
+
end
|
28
|
+
|
26
29
|
end
|
@@ -3,14 +3,14 @@ class RePlanWorkflowsController < ApplicationController
|
|
3
3
|
layout 'rules_engine'
|
4
4
|
|
5
5
|
# before_filter :login_required
|
6
|
-
before_filter :rules_engine_editor_access_required, :only => [:new, :create, :edit, :update, :destroy, :change, :default, :add, :remove]
|
6
|
+
before_filter :rules_engine_editor_access_required, :only => [:new, :create, :edit, :update, :destroy, :change, :default, :add, :remove, :copy, :duplicate]
|
7
7
|
before_filter :rules_engine_reader_access_required, :only => [:show]
|
8
8
|
|
9
9
|
before_filter do |controller|
|
10
10
|
controller.re_load_model :re_plan, {:param_id => :re_plan_id, :redirect_path => :re_plans_path}
|
11
11
|
end
|
12
12
|
|
13
|
-
before_filter :only => [:show, :edit, :update, :destroy, :change, :default, :remove] do |controller|
|
13
|
+
before_filter :only => [:show, :edit, :update, :destroy, :change, :default, :remove, :copy, :duplicate] do |controller|
|
14
14
|
controller.re_load_model :re_workflow, {:parents => [:re_plan], :redirect_path => :re_plan_path, :validate => :has_plan?}
|
15
15
|
end
|
16
16
|
before_filter :only => [:add] do |controller|
|
@@ -30,10 +30,9 @@ class RePlanWorkflowsController < ApplicationController
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def create
|
33
|
-
@re_workflow = ReWorkflow.new(params[:re_workflow])
|
34
|
-
@re_plan.add_workflow(@re_workflow)
|
35
|
-
|
33
|
+
@re_workflow = ReWorkflow.new(params[:re_workflow])
|
36
34
|
if @re_workflow.save
|
35
|
+
@re_plan.add_workflow(@re_workflow)
|
37
36
|
flash[:success] = 'Workflow Created.'
|
38
37
|
|
39
38
|
respond_to do |format|
|
@@ -136,4 +135,30 @@ class RePlanWorkflowsController < ApplicationController
|
|
136
135
|
end
|
137
136
|
end
|
138
137
|
end
|
138
|
+
|
139
|
+
def copy
|
140
|
+
@re_workflow_new = ReWorkflow.new
|
141
|
+
end
|
142
|
+
|
143
|
+
def duplicate
|
144
|
+
@re_workflow_new = ReWorkflow.new
|
145
|
+
@re_workflow_new.revert!(@re_workflow.publish)
|
146
|
+
@re_workflow_new.attributes = params[:re_workflow]
|
147
|
+
|
148
|
+
if @re_workflow_new.save
|
149
|
+
@re_plan.add_workflow(@re_workflow_new)
|
150
|
+
flash[:success] = 'Workflow Duplicated.'
|
151
|
+
respond_to do |format|
|
152
|
+
format.html do
|
153
|
+
redirect_to(change_re_plan_workflow_path(@re_plan, @re_workflow_new))
|
154
|
+
end
|
155
|
+
format.js do
|
156
|
+
render :inline => "window.location.href = '#{change_re_plan_workflow_path(@re_plan, @re_workflow_new)}';"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else
|
160
|
+
render :action => "copy"
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
139
164
|
end
|
@@ -3,10 +3,10 @@ class RePlansController < ApplicationController
|
|
3
3
|
layout 'rules_engine'
|
4
4
|
|
5
5
|
# before_filter :login_required
|
6
|
-
before_filter :rules_engine_editor_access_required, :only => [:new, :create, :edit, :update, :destroy, :change, :publish, :revert]
|
6
|
+
before_filter :rules_engine_editor_access_required, :only => [:new, :create, :edit, :update, :destroy, :change, :publish, :revert, :copy, :duplicate]
|
7
7
|
before_filter :rules_engine_reader_access_required, :only => [:index, :show, :preview, :re_process]
|
8
8
|
|
9
|
-
before_filter :only => [:show, :edit, :update, :destroy, :change, :preview, :publish, :revert, :re_process] do |controller|
|
9
|
+
before_filter :only => [:show, :edit, :update, :destroy, :change, :preview, :publish, :revert, :re_process, :copy, :duplicate] do |controller|
|
10
10
|
controller.re_load_model :re_plan
|
11
11
|
end
|
12
12
|
|
@@ -128,4 +128,28 @@ class RePlansController < ApplicationController
|
|
128
128
|
def re_process
|
129
129
|
@re_processes = RulesEngine::Process.runner.history(@re_plan.code, :page => params[:page] || 1, :per_page => 5)
|
130
130
|
end
|
131
|
+
|
132
|
+
def copy
|
133
|
+
@re_plan_new = RePlan.new
|
134
|
+
end
|
135
|
+
|
136
|
+
def duplicate
|
137
|
+
@re_plan_new = RePlan.new
|
138
|
+
@re_plan_new.revert!(@re_plan.publish)
|
139
|
+
@re_plan_new.attributes = params[:re_plan]
|
140
|
+
|
141
|
+
if @re_plan_new.save
|
142
|
+
flash[:success] = 'Plan Duplicated.'
|
143
|
+
respond_to do |format|
|
144
|
+
format.html do
|
145
|
+
redirect_to(change_re_plan_path(@re_plan_new))
|
146
|
+
end
|
147
|
+
format.js do
|
148
|
+
render :inline => "window.location.href = '#{change_re_plan_path(@re_plan_new)}';"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
else
|
152
|
+
render :action => "copy"
|
153
|
+
end
|
154
|
+
end
|
131
155
|
end
|
@@ -3,10 +3,10 @@ class ReWorkflowsController < ApplicationController
|
|
3
3
|
layout 'rules_engine'
|
4
4
|
|
5
5
|
# before_filter :login_required
|
6
|
-
before_filter :rules_engine_editor_access_required, :only => [:new, :create, :edit, :update, :destroy, :change]
|
6
|
+
before_filter :rules_engine_editor_access_required, :only => [:new, :create, :edit, :update, :destroy, :change, :copy, :duplicate]
|
7
7
|
before_filter :rules_engine_reader_access_required, :only => [:index, :show, :preview, :plan, :add]
|
8
8
|
|
9
|
-
before_filter :only => [:show, :edit, :update, :destroy, :change, :preview, :plan] do |controller|
|
9
|
+
before_filter :only => [:show, :edit, :update, :destroy, :change, :preview, :plan, :copy, :duplicate] do |controller|
|
10
10
|
controller.re_load_model :re_workflow
|
11
11
|
end
|
12
12
|
|
@@ -93,4 +93,29 @@ class ReWorkflowsController < ApplicationController
|
|
93
93
|
def add
|
94
94
|
@re_workflows = ReWorkflow.order_title.find(:all)
|
95
95
|
end
|
96
|
+
|
97
|
+
def copy
|
98
|
+
@re_workflow_new = ReWorkflow.new
|
99
|
+
end
|
100
|
+
|
101
|
+
def duplicate
|
102
|
+
@re_workflow_new = ReWorkflow.new
|
103
|
+
@re_workflow_new.revert!(@re_workflow.publish)
|
104
|
+
@re_workflow_new.attributes = params[:re_workflow]
|
105
|
+
|
106
|
+
if @re_workflow_new.save
|
107
|
+
flash[:success] = 'Workflow Duplicated.'
|
108
|
+
respond_to do |format|
|
109
|
+
format.html do
|
110
|
+
redirect_to(change_re_workflow_path(@re_workflow_new))
|
111
|
+
end
|
112
|
+
format.js do
|
113
|
+
render :inline => "window.location.href = '#{change_re_workflow_path(@re_workflow_new)}';"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
else
|
117
|
+
render :action => "copy"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
96
121
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
class ReRule < ActiveRecord::Base
|
2
2
|
belongs_to :re_workflow
|
3
|
-
has_many :re_rule_expected_outcomes, :dependent => :destroy, :order => "outcome ASC"
|
4
3
|
acts_as_list :scope => :re_workflow
|
5
4
|
|
6
5
|
validates_associated :re_workflow
|
@@ -24,8 +23,6 @@ class ReRule < ActiveRecord::Base
|
|
24
23
|
self.summary = rule.summary
|
25
24
|
self.data = rule.data
|
26
25
|
|
27
|
-
self.re_rule_expected_outcomes = (rule.expected_outcomes || []).map { |expected_outcome| ReRuleExpectedOutcome.new(expected_outcome) }
|
28
|
-
|
29
26
|
re_workflow.changed! if changes.detect { |change| !ignore_attributes.include?(change[0])}
|
30
27
|
end
|
31
28
|
|
@@ -57,7 +54,6 @@ class ReRule < ActiveRecord::Base
|
|
57
54
|
self.summary = rule_data["summary"]
|
58
55
|
self.data = rule_data["data"]
|
59
56
|
|
60
|
-
self.re_rule_expected_outcomes = (rule.expected_outcomes || []).map { |expected_outcome| ReRuleExpectedOutcome.new(expected_outcome) }
|
61
57
|
self
|
62
58
|
end
|
63
59
|
|
@@ -79,35 +75,9 @@ class ReRule < ActiveRecord::Base
|
|
79
75
|
return "class #{rule_class_name} missing" if rule.nil?
|
80
76
|
return "#{rule.errors.values.join(', ')}" unless rule.valid?
|
81
77
|
|
82
|
-
re_rule_expected_outcomes.each do |re_rule_expected_outcome|
|
83
|
-
next if re_rule_expected_outcome.workflow_code.blank?
|
84
|
-
|
85
|
-
re_workflow = ReWorkflow.find_by_code(re_rule_expected_outcome.workflow_code)
|
86
|
-
return "#{re_rule_expected_outcome.workflow_code} missing" if re_workflow.nil?
|
87
|
-
|
88
|
-
workflow_error = re_workflow.workflow_error
|
89
|
-
return "#{re_rule_expected_outcome.workflow_code} invalid" unless re_workflow.workflow_error.blank?
|
90
|
-
end
|
91
|
-
|
92
78
|
nil
|
93
79
|
end
|
94
80
|
|
95
|
-
def re_rule_expected_outcome_next
|
96
|
-
re_rule_expected_outcomes.detect{ |re_rule_expected_outcome| re_rule_expected_outcome.outcome == RulesEngine::Rule::Outcome::NEXT }
|
97
|
-
end
|
98
|
-
|
99
|
-
def re_rule_expected_outcome_success
|
100
|
-
re_rule_expected_outcomes.detect{ |re_rule_expected_outcome| re_rule_expected_outcome.outcome == RulesEngine::Rule::Outcome::STOP_SUCCESS }
|
101
|
-
end
|
102
|
-
|
103
|
-
def re_rule_expected_outcome_failure
|
104
|
-
re_rule_expected_outcomes.detect{ |re_rule_expected_outcome| re_rule_expected_outcome.outcome == RulesEngine::Rule::Outcome::STOP_FAILURE }
|
105
|
-
end
|
106
|
-
|
107
|
-
def re_rule_expected_outcomes_start_workflow
|
108
|
-
re_rule_expected_outcomes.select{ |re_rule_expected_outcome| re_rule_expected_outcome.outcome == RulesEngine::Rule::Outcome::START_WORKFLOW }
|
109
|
-
end
|
110
|
-
|
111
81
|
protected
|
112
82
|
def ignore_attributes
|
113
83
|
[self.class.primary_key, self.class.inheritance_column, "re_workflow_id", "created_at", "updated_at"]
|
@@ -53,7 +53,7 @@ module RulesEngine
|
|
53
53
|
when 'stop_failure'
|
54
54
|
[:outcome => RulesEngine::Rule::Outcome::STOP_FAILURE]
|
55
55
|
when 'start_workflow'
|
56
|
-
[:outcome => RulesEngine::Rule::Outcome::START_WORKFLOW, :
|
56
|
+
[:outcome => RulesEngine::Rule::Outcome::START_WORKFLOW, :title => "Start Workflow : #{workflow}"]
|
57
57
|
else
|
58
58
|
[:outcome => RulesEngine::Rule::Outcome::NEXT]
|
59
59
|
end
|
@@ -112,9 +112,9 @@ module RulesEngine
|
|
112
112
|
end
|
113
113
|
|
114
114
|
words.each do |word|
|
115
|
-
if
|
115
|
+
if /\b#{word}\b/i =~ tweet
|
116
116
|
RulesEngine::Process.auditor.audit(process_id, "Found #{word}", RulesEngine::Process::AUDIT_INFO)
|
117
|
-
data[:
|
117
|
+
data[:tweet_match] = word
|
118
118
|
|
119
119
|
case workflow_action
|
120
120
|
when 'stop_success'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
<% set_re_javascript_include 'rules_engine/re_workflow_change' %>
|
2
2
|
<% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
|
3
3
|
link_to("View Plan", re_plan_path(@re_plan), :class => "re-bc-plan-show"),
|
4
|
-
link_to("Edit Plan", change_re_plan_path(@re_plan), :class => "re-bc-plan-change"),
|
5
4
|
'<span class="re-bc-workflow-change">Edit Workflow</span>' %>
|
6
5
|
|
7
6
|
<div class="span-17 border">
|
@@ -65,8 +64,13 @@
|
|
65
64
|
<h4>
|
66
65
|
<%= link_to("View Workflow", re_plan_workflow_path(@re_plan, @re_workflow), :class => "re-menu-workflow-show") %>
|
67
66
|
</h4>
|
68
|
-
|
69
67
|
<div class="clear top-5"></div>
|
68
|
+
|
69
|
+
<h4>
|
70
|
+
<%= link_to("Copy Workflow", "##{@re_plan.id}|#{@re_workflow.id}", :id => "re_workflow_copy", :class => "re-menu-workflow-copy") %>
|
71
|
+
</h4>
|
72
|
+
<div class="clear top-5"></div>
|
73
|
+
|
70
74
|
<hr/>
|
71
75
|
<div class="clear top-5"></div>
|
72
76
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
|
2
|
+
link_to("Edit Plan", change_re_plan_path(@re_plan), :class => "re-bc-plan-change"),
|
3
|
+
link_to("Edit Workflow", change_re_plan_workflow_path(@re_plan, @re_workflow), :class => "re-bc-workflow-change"),
|
4
|
+
'<span class="re-bc-workflow-copy">copy Details</span>' %>
|
5
|
+
|
6
|
+
<div class="prepend-1 span-22 append-1">
|
7
|
+
<div class="re-infobox">
|
8
|
+
<%= render '/re_workflows/copy', :duplicate_path => duplicate_re_plan_workflow_path(@re_plan, @re_workflow), :cancel_path => change_re_plan_workflow_path(@re_plan, @re_workflow) %>
|
9
|
+
<div class="clear top-5"></div>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<div class="clear"></div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
$('#re_content').html('<%=escape_javascript(render('/re_workflows/copy', :duplicate_path => duplicate_re_plan_workflow_path(@re_plan, @re_workflow), :cancel_path => change_re_plan_workflow_path(@re_plan, @re_workflow)))%>');
|
2
|
+
|
3
|
+
$('#re_workflow_copy_duplicate').closest('div.re-form-button').re_form_button();
|
4
|
+
|
5
|
+
$("#re_workflow_copy_form").submit(function() { return false; });
|
6
|
+
|
7
|
+
$.re_unblock();
|
8
|
+
$.fancybox({ href: '#re_content'});
|