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.
Files changed (59) hide show
  1. data/VERSION +1 -1
  2. data/lib/rules_engine/process/auditor/db_auditor.rb +1 -0
  3. data/lib/rules_engine/rule/outcome.rb +1 -0
  4. data/rails_generators/manifests/complex.rb +4 -1
  5. data/rails_generators/manifests/complex.yml +0 -1
  6. data/rails_generators/manifests/rules_engine.rb +15 -2
  7. data/rails_generators/manifests/rules_engine.yml +0 -2
  8. data/rails_generators/manifests/simple.rb +4 -1
  9. data/rails_generators/manifests/simple.yml +0 -1
  10. data/rails_generators/templates/app/controllers/re_plan_workflows_controller.rb +30 -5
  11. data/rails_generators/templates/app/controllers/re_plans_controller.rb +26 -2
  12. data/rails_generators/templates/app/controllers/re_workflows_controller.rb +27 -2
  13. data/rails_generators/templates/app/models/re_rule.rb +0 -30
  14. data/rails_generators/templates/app/rules/complex.rb +3 -3
  15. data/rails_generators/templates/app/views/re_plan_workflows/change.html.erb +6 -2
  16. data/rails_generators/templates/app/views/re_plan_workflows/copy.html.erb +12 -0
  17. data/rails_generators/templates/app/views/re_plan_workflows/copy.js.erb +8 -0
  18. data/rails_generators/templates/app/views/re_plan_workflows/new.js.erb +5 -1
  19. data/rails_generators/templates/app/views/re_plan_workflows/show.html.erb +3 -2
  20. data/rails_generators/templates/app/views/re_plans/_copy.html.erb +18 -0
  21. data/rails_generators/templates/app/views/re_plans/_preview.html.erb +1 -1
  22. data/rails_generators/templates/app/views/re_plans/_workflow_preview.html.erb +1 -3
  23. data/rails_generators/templates/app/views/re_plans/change.html.erb +6 -0
  24. data/rails_generators/templates/app/views/re_plans/copy.html.erb +11 -0
  25. data/rails_generators/templates/app/views/re_plans/copy.js.erb +9 -0
  26. data/rails_generators/templates/app/views/re_plans/new.js.erb +4 -1
  27. data/rails_generators/templates/app/views/re_plans/show.html.erb +1 -1
  28. data/rails_generators/templates/app/views/re_rule_definitions/complex/_form.html.erb +2 -2
  29. data/rails_generators/templates/app/views/re_rule_definitions/simple/_form.html.erb +1 -1
  30. data/rails_generators/templates/app/views/re_workflows/_copy.html.erb +21 -0
  31. data/rails_generators/templates/app/views/re_workflows/_rule_change.html.erb +11 -14
  32. data/rails_generators/templates/app/views/re_workflows/_rule_preview.html.erb +14 -17
  33. data/rails_generators/templates/app/views/re_workflows/_rule_show.html.erb +13 -16
  34. data/rails_generators/templates/app/views/re_workflows/_show.html.erb +1 -3
  35. data/rails_generators/templates/app/views/re_workflows/change.html.erb +5 -0
  36. data/rails_generators/templates/app/views/re_workflows/copy.html.erb +11 -0
  37. data/rails_generators/templates/app/views/re_workflows/copy.js.erb +8 -0
  38. data/rails_generators/templates/app/views/re_workflows/index.html.erb +1 -1
  39. data/rails_generators/templates/app/views/re_workflows/preview.html.erb +1 -0
  40. data/rails_generators/templates/app/views/re_workflows/show.html.erb +3 -2
  41. data/rails_generators/templates/app/views/re_workflows/update.js.erb +1 -1
  42. data/rails_generators/templates/db/migrate/20100308225008_create_rules_engine.rb +0 -13
  43. data/rails_generators/templates/doc/README.rules_engine +7 -6
  44. data/rails_generators/templates/lib/tasks/rules_engine.rake +2 -2
  45. data/rails_generators/templates/public/javascripts/rules_engine/re_plan_change.js +20 -0
  46. data/rails_generators/templates/public/javascripts/rules_engine/re_plan_new.js +2 -8
  47. data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_add.js +3 -12
  48. data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_change.js +23 -4
  49. data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_new.js +2 -8
  50. data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_show.js +22 -0
  51. data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/copy-25.png +0 -0
  52. data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_workflow/copy-25.png +0 -0
  53. data/rails_generators/templates/public/stylesheets/rules_engine/screen.css +52 -1
  54. data/rails_generators/templates/spec/lib/rules/complex_spec.rb +46 -41
  55. data/rails_generators/templates/spec/lib/rules/simple_spec.rb +41 -35
  56. data/rails_generators/templates/spec/models/re_rule_spec.rb +12 -74
  57. metadata +15 -6
  58. data/rails_generators/templates/app/models/re_rule_expected_outcome.rb +0 -14
  59. data/rails_generators/templates/spec/models/re_rule_expected_outcome_spec.rb +0 -29
@@ -2,4 +2,8 @@ $('#re_content').html('<%=escape_javascript(render('/re_workflows/new', :create_
2
2
 
3
3
  $('#re_workflow_new_insert').closest('div.re-form-button').re_form_button();
4
4
 
5
- $("#re_workflow_new_form").submit(function() { return false; });
5
+ $("#re_workflow_new_form").submit(function() { return false; });
6
+
7
+ $.re_unblock();
8
+ $.fancybox.resize();
9
+ $.fancybox({ href: '#re_content'});
@@ -1,4 +1,4 @@
1
- <% set_re_javascript_include ['rules_engine/re_plan_preview', 'rules_engine/re_workflow_plan'] %>
1
+ <% set_re_javascript_include ['rules_engine/re_workflow_show', 'rules_engine/re_plan_preview', 'rules_engine/re_workflow_plan'] %>
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
4
  '<span class="re-bc-workflow-show">View Workflow</span>' %>
@@ -28,7 +28,8 @@
28
28
  <%= render '/re_workflows/rule_empty', :hide => !@re_workflow.re_rules.empty? %>
29
29
 
30
30
  <% @re_workflow.re_rules.each do |re_rule | %>
31
- <%= render '/re_workflows/rule_show', :re_rule => re_rule,
31
+ <%= render '/re_workflows/rule_show', :re_plan_id => @re_plan.id,
32
+ :re_rule => re_rule,
32
33
  :last_rule => re_rule == @re_workflow.re_rules[-1] %>
33
34
  <% end %>
34
35
  <div class="clear"></div>
@@ -0,0 +1,18 @@
1
+ <div class="clear prepend-1 span-18">
2
+ <h3 class="re-hdr-plan-copy"> Copy Plan : <%=h @re_plan.title %></h3>
3
+ <div class="clear top-10"></div>
4
+
5
+ <% re_form_for(@re_plan_new, :url => duplicate_re_plan_path(@re_plan), :method => :post, :span => "3x13", :html => {:id => "re_plan_copy_form"}) do |f| %>
6
+ <%= f.error_messages :message => "Unable To Duplicated Plan" %>
7
+ <% re_whitebox do %>
8
+ <%= f.text_field(:code, :required => true, :hint => "must be unique") %>
9
+ <%= f.text_field(:title, :required => true) %>
10
+ <%= f.text_area(:description) %>
11
+
12
+ <div class="clear"></div>
13
+ <%= re_button_submit_green('Duplicate', :id => "re_plan_copy_duplicate") %>
14
+ <%= re_button_link_orange('Cancel', change_re_plan_path(@re_plan), :id => "re_plan_copy_cancel") %>
15
+ <% end %>
16
+ <% end %>
17
+ </div>
18
+ <div class="clear"></div>
@@ -14,7 +14,7 @@
14
14
  <% end %>
15
15
  </div>
16
16
  <div class="span-15 last">
17
- <div class="re-infobox <%= @re_plan.re_workflows[0] == re_workflow ? 'no-top' : '' %>">
17
+ <div class="re-infobox <%= @re_plan.re_workflows[0] == re_workflow ? 'no-top' : '' %>">
18
18
  <%= render '/re_plans/workflow_preview', :re_workflow => re_workflow %>
19
19
  <div class="clear"></div>
20
20
  </div>
@@ -1,13 +1,11 @@
1
1
  <% re_workflow_error = re_workflow.workflow_error %>
2
2
 
3
- <div class="span-9">
3
+ <div class="span-14">
4
4
  <h4 class="re-sts-workflow-<%= re_workflow_error.blank? ? 'valid' : 'verify' %>">
5
5
  <%=h re_workflow.title %>
6
6
  <span class="re-code blue">(<%=h re_workflow.code%>)</span>
7
7
  </h4>
8
8
  </div>
9
- <div class="span-5 last">
10
- </div>
11
9
 
12
10
  <div class="clear top-5"></div>
13
11
  <hr/>
@@ -35,8 +35,14 @@
35
35
  <h4>
36
36
  <%= link_to("View Plan", re_plan_path(@re_plan), :class => "re-menu-plan-show") %>
37
37
  </h4>
38
+ <div class="clear top-5"></div>
38
39
 
40
+ <h4>
41
+ <%= link_to("Copy Plan", "##{@re_plan.id}", :id => "re_plan_copy", :class => "re-menu-plan-copy") %>
42
+ </h4>
39
43
  <div class="clear top-5"></div>
44
+
45
+
40
46
  <hr/>
41
47
  <div class="clear top-5"></div>
42
48
 
@@ -0,0 +1,11 @@
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
+ '<span class="re-bc-plan-copy">Copy Plan</span>' %>
4
+
5
+ <div class="prepend-1 span-22 append-1">
6
+ <div class="re-infobox">
7
+ <%= render 'copy' %>
8
+ <div class="clear top-5"></div>
9
+ </div>
10
+ </div>
11
+ <div class="clear"></div>
@@ -0,0 +1,9 @@
1
+ $('#re_content').html('<%=escape_javascript(render('/re_plans/copy'))%>');
2
+
3
+ $('#re_plan_copy_duplicate').closest('div.re-form-button').re_form_button();
4
+
5
+ $("#re_plan_copy_form").submit(function() { return false; });
6
+
7
+ $.re_unblock();
8
+ $.fancybox.resize();
9
+ $.fancybox({ href: '#re_content'});
@@ -2,4 +2,7 @@ $('#re_content').html('<%=escape_javascript(render('/re_plans/new'))%>');
2
2
 
3
3
  $('#re_plan_new_insert').closest('div.re-form-button').re_form_button();
4
4
 
5
- $("#re_plan_new_form").submit(function() { return false; });
5
+ $("#re_plan_new_form").submit(function() { return false; });
6
+
7
+ $.re_unblock();
8
+ $.fancybox({ href: '#re_content'});
@@ -1,4 +1,4 @@
1
- <% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_publication_show', 'rules_engine/re_process_index'] %>
1
+ <% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_publication_show', 'rules_engine/re_process_index', 'rules_engine/re_process_show'] %>
2
2
  <% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"), '<span class="re-bc-plan-show">View Plan</span>' %>
3
3
 
4
4
  <div class="span-17 border">
@@ -27,7 +27,7 @@
27
27
  <!-- TITLE -->
28
28
  <%%= re_text_field "Title",
29
29
  "<%=rule_name%>_title",
30
- params[:<%=rule_name%>_title] || @re_rule.rule.title,
30
+ params[:<%=rule_name%>_title] || @re_rule.rule.title || @re_rule.rule.options[:display_name],
31
31
  :size => 30,
32
32
  :required => true,
33
33
  :error => @re_rule.rule.errors[:<%=rule_name%>_title],
@@ -63,7 +63,7 @@
63
63
  ["Stop Failure", 'stop_failure'],
64
64
  ["Start another Workflow", 'start_workflow']
65
65
  ],
66
- @re_rule.rule.workflow_action || params['<%=rule_name%>_workflow_action']),
66
+ params['<%=rule_name%>_workflow_action'] || @re_rule.rule.workflow_action),
67
67
  :required => true %>
68
68
  </div>
69
69
  <div class="prepend-1 span-7 last">
@@ -9,7 +9,7 @@
9
9
 
10
10
  <%%= re_text_field "Title",
11
11
  "<%=rule_name%>_title",
12
- params[:<%=rule_name%>_title] || @re_rule.rule.title,
12
+ params[:<%=rule_name%>_title] || @re_rule.rule.title || @re_rule.rule.options[:display_name],
13
13
  :size => 30,
14
14
  :required => true,
15
15
  :error => @re_rule.rule.errors[:<%=rule_name%>_title],
@@ -0,0 +1,21 @@
1
+ <%#= :duplicate_path => duplicate_re_plan_workflows_path(@re_plan) %>
2
+ <%#= :cancel_path => change_re_plan_path(@re_plan) %>
3
+
4
+ <div class="clear prepend-1 span-18">
5
+ <h3 class="re-hdr-workflow-new">Copy Workflow : <%=h @re_workflow.title %></h3>
6
+ <div class="clear top-10"></div>
7
+
8
+ <% re_form_for(@re_workflow_new, :url => duplicate_path, :method => :post, :span => "3x13", :html => {:id => "re_workflow_copy_form"}) do |f| %>
9
+ <%= f.error_messages :message => "Unable To Duplicate Workflow" %>
10
+ <% re_whitebox do %>
11
+ <%= f.text_field(:code, :required => true, :hint => "must be unique") %>
12
+ <%= f.text_field(:title, :required => true) %>
13
+ <%= f.text_area(:description) %>
14
+
15
+ <div class="clear"></div>
16
+ <%= re_button_submit_green('Duplicate', :id => "re_workflow_copy_duplicate") %>
17
+ <%= re_button_link_orange('Cancel', cancel_path, :id => "re_workflow_copy_cancel") %>
18
+ <% end %>
19
+ <% end %>
20
+ </div>
21
+ <div class="clear"></div>
@@ -20,6 +20,7 @@
20
20
  <div class="<%= re_rule_error.blank? ? 're-bluebox' : 're-redbox' %> no-top">
21
21
  <div class="span-7">
22
22
  <p class="top-5">
23
+ <span class="re-code blue"><%=h re_rule.rule.options[:display_name]%>:</span>
23
24
  <%=h re_rule.summary %>
24
25
  </p>
25
26
  </div>
@@ -28,20 +29,16 @@
28
29
  <%=h re_rule_error %>
29
30
  </div>
30
31
  <div class="top-5 clear"></div>
31
- <% if re_rule.re_rule_expected_outcomes.empty? %>
32
- <div class="re-xtra-rule-continue">Continue</div>
33
- <% end %>
34
- <% unless re_rule.re_rule_expected_outcome_next.nil? %>
35
- <div class="re-xtra-rule-continue">Continue</div>
36
- <% end %>
37
- <% re_rule.re_rule_expected_outcomes_start_workflow.each do |re_rule_expected_outcome| %>
38
- <div class="re-xtra-rule-start-workflow">Start : <%= re_rule_expected_outcome.workflow_code %></div>
39
- <% end %>
40
- <% unless re_rule.re_rule_expected_outcome_failure.nil? %>
41
- <div class="re-xtra-rule-stop-failure">Stop Failure</div>
42
- <% end %>
43
- <% unless re_rule.re_rule_expected_outcome_success.nil? %>
44
- <div class="re-xtra-rule-stop-success">Stop Success</div>
32
+ <% re_rule.rule.expected_outcomes.each do |expected_outcome| %>
33
+ <% if expected_outcome[:outcome] == RulesEngine::Rule::Outcome::STOP_SUCCESS %>
34
+ <div class="re-xtra-rule-stop-success"><%= expected_outcome[:title] || 'Stop Success' %></div>
35
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::STOP_FAILURE %>
36
+ <div class="re-xtra-rule-stop-failure"><%= expected_outcome[:title] || 'Stop Failure' %></div>
37
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::START_WORKFLOW %>
38
+ <div class="re-xtra-rule-start-workflow"><%= expected_outcome[:title] || 'Start Workflow' %></div>
39
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::NEXT %>
40
+ <div class="re-xtra-rule-continue"><%= expected_outcome[:title] || 'Continue' %></div>
41
+ <% end %>
45
42
  <% end %>
46
43
  </div>
47
44
  <div class="clear"></div>
@@ -11,6 +11,7 @@
11
11
  <div class="<%= re_rule_error.blank? ? 're-bluebox' : 're-redbox' %>"><%=h re_rule.title %></div>
12
12
  <div class="<%= re_rule_error.blank? ? 're-bluebox' : 're-redbox' %> no-top">
13
13
  <p class="float-left top-5">
14
+ <span class="re-code blue"><%=h re_rule.rule.options[:display_name]%>.</span>
14
15
  <%=h re_rule.summary %>
15
16
  </p>
16
17
  <div class="float-right red smalltext right-5">
@@ -18,23 +19,19 @@
18
19
  </div>
19
20
  <div class="clear"></div>
20
21
 
21
- <div class="top-5 float-right">
22
- <% if re_rule.re_rule_expected_outcomes.empty? %>
23
- <div class="re-xtra-rule-continue">Continue</div>
24
- <% end %>
25
- <% unless re_rule.re_rule_expected_outcome_next.nil? %>
26
- <div class="re-xtra-rule-continue">Continue</div>
27
- <% end %>
28
- <% re_rule.re_rule_expected_outcomes_start_workflow.each do |re_rule_expected_outcome| %>
29
- <div class="re-xtra-rule-start-pipeline">Start : <%= re_rule_expected_outcome.pipeline_code %></div>
30
- <% end %>
31
- <% unless re_rule.re_rule_expected_outcome_failure.nil? %>
32
- <div class="re-xtra-rule-stop-failure">Stop Failure</div>
33
- <% end %>
34
- <% unless re_rule.re_rule_expected_outcome_success.nil? %>
35
- <div class="re-xtra-rule-stop-success">Stop Success</div>
36
- <% end %>
37
- </div>
22
+ <!-- <div class="top-5 float-right">
23
+ <% re_rule.rule.expected_outcomes.each do |expected_outcome| %>
24
+ <% if expected_outcome[:outcome] == RulesEngine::Rule::Outcome::STOP_SUCCESS %>
25
+ <div class="re-xtra-rule-stop-success"><%= expected_outcome[:title] || 'Stop Success' %></div>
26
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::STOP_FAILURE %>
27
+ <div class="re-xtra-rule-stop-failure"><%= expected_outcome[:title] || 'Stop Failure' %></div>
28
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::START_WORKFLOW %>
29
+ <div class="re-xtra-rule-start-workflow"><%= expected_outcome[:title] || 'Start Workflow' %></div>
30
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::NEXT %>
31
+ <div class="re-xtra-rule-continue"><%= expected_outcome[:title] || 'Continue' %></div>
32
+ <% end %>
33
+ <% end %>
34
+ </div> -->
38
35
  <div class="clear"></div>
39
36
  </div>
40
37
  </div>
@@ -5,12 +5,14 @@
5
5
  <h4 class="float-left re-sts-rule-<%= re_rule_error.blank? ? 'valid' : 'verify' %>"><%=h re_rule.title %></h4>
6
6
  <div class="float-right">
7
7
  <!-- NO ACTIONS ON THE RULE -->
8
+ <%= link_to("<span>Help</span>", "##{re_plan_id}|#{@re_workflow.id}|#{re_rule.rule_class_name}", :class => "re-list-rule-help") %>
8
9
  </div>
9
10
  <div class="clear"></div>
10
11
  </div>
11
12
  <div class="<%= re_rule_error.blank? ? 're-bluebox' : 're-redbox' %> no-top">
12
13
  <div class="span-7">
13
14
  <p class="top-5">
15
+ <span class="re-code blue"><%=h re_rule.rule.options[:display_name]%>:</span>
14
16
  <%=h re_rule.summary %>
15
17
  </p>
16
18
  </div>
@@ -19,22 +21,17 @@
19
21
  <%=h re_rule_error %>
20
22
  </div>
21
23
  <div class="top-5 clear"></div>
22
-
23
- <% if re_rule.re_rule_expected_outcomes.empty? %>
24
- <div class="re-xtra-rule-continue">Continue</div>
25
- <% end %>
26
- <% unless re_rule.re_rule_expected_outcome_next.nil? %>
27
- <div class="re-xtra-rule-continue">Continue</div>
28
- <% end %>
29
- <% re_rule.re_rule_expected_outcomes_start_workflow.each do |re_rule_expected_outcome| %>
30
- <div class="re-xtra-rule-start-workflow">Start : <%= re_rule_expected_outcome.workflow_code %></div>
31
- <% end %>
32
- <% unless re_rule.re_rule_expected_outcome_failure.nil? %>
33
- <div class="re-xtra-rule-stop-failure">Stop Failure</div>
34
- <% end %>
35
- <% unless re_rule.re_rule_expected_outcome_success.nil? %>
36
- <div class="re-xtra-rule-stop-success">Stop Success</div>
37
- <% end %>
24
+ <% re_rule.rule.expected_outcomes.each do |expected_outcome| %>
25
+ <% if expected_outcome[:outcome] == RulesEngine::Rule::Outcome::STOP_SUCCESS %>
26
+ <div class="re-xtra-rule-stop-success"><%= expected_outcome[:title] || 'Stop Success' %></div>
27
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::STOP_FAILURE %>
28
+ <div class="re-xtra-rule-stop-failure"><%= expected_outcome[:title] || 'Stop Failure' %></div>
29
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::START_WORKFLOW %>
30
+ <div class="re-xtra-rule-start-workflow"><%= expected_outcome[:title] || 'Start Workflow' %></div>
31
+ <% elsif expected_outcome[:outcome] == RulesEngine::Rule::Outcome::NEXT %>
32
+ <div class="re-xtra-rule-continue"><%= expected_outcome[:title] || 'Continue' %></div>
33
+ <% end %>
34
+ <% end %>
38
35
  </div>
39
36
  <div class="clear"></div>
40
37
  </div>
@@ -1,13 +1,11 @@
1
1
  <% re_workflow_error = @re_workflow.workflow_error %>
2
2
 
3
- <div class="span-9">
3
+ <div class="span-14">
4
4
  <h4 class="re-sts-workflow-<%= re_workflow_error.blank? ? 'valid' : 'verify' %>">
5
5
  <%=h @re_workflow.title %>
6
6
  <span class="re-code blue">(<%=h @re_workflow.code%>)</span>
7
7
  </h4>
8
8
  </div>
9
- <div class="span-5 last">
10
- </div>
11
9
 
12
10
  <div class="clear top-5"></div>
13
11
  <hr/>
@@ -41,8 +41,13 @@
41
41
  <h4>
42
42
  <%= link_to("View Workflow", re_workflow_path(@re_workflow), :class => "re-menu-workflow-show") %>
43
43
  </h4>
44
+ <div class="clear top-5"></div>
44
45
 
46
+ <h4>
47
+ <%= link_to("Copy Workflow", "#0|#{@re_workflow.id}", :id => "re_workflow_copy", :class => "re-menu-workflow-copy") %>
48
+ </h4>
45
49
  <div class="clear top-5"></div>
50
+
46
51
  <hr/>
47
52
  <div class="clear top-5"></div>
48
53
 
@@ -0,0 +1,11 @@
1
+ <% set_re_breadcrumbs link_to("All Workflows", re_workflows_path, :class => "re-bc-workflow-list"),
2
+ link_to("Edit Workflow", change_re_workflow_path(@re_workflow), :class => "re-bc-workflow-change"),
3
+ '<span class="re-bc-workflow-copy">Copy Workflow</span>' %>
4
+
5
+ <div class="prepend-1 span-22 append-1">
6
+ <div class="re-infobox">
7
+ <%= render '/re_workflows/copy', :duplicate_path => duplicate_re_workflow_path(@re_workflow), :cancel_path => change_re_workflow_path(@re_workflow) %>
8
+ <div class="clear top-5"></div>
9
+ </div>
10
+ </div>
11
+ <div class="clear"></div>
@@ -0,0 +1,8 @@
1
+ $('#re_content').html('<%=escape_javascript(render('/re_workflows/copy', :duplicate_path => duplicate_re_workflow_path(@re_workflow), :cancel_path => change_re_workflow_path(@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'});
@@ -1,4 +1,4 @@
1
- <% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_workflow_new', 'rules_engine/re_process_index'] %>
1
+ <% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_workflow_new', 'rules_engine/re_process_index', 'rules_engine/re_process_show'] %>
2
2
  <% set_re_breadcrumbs_right link_to("All Workflows", re_workflows_path, :class => "re-bc-workflow-list"),
3
3
  link_to("<em>All Plans</em>", re_plans_path, :class => "re-bc-plan-list blue")%>
4
4
 
@@ -1,5 +1,6 @@
1
1
  <% set_re_breadcrumbs link_to("All Workflows", re_workflows_path, :class => "re-bc-workflow-list"), '<span class="re-bc-workflow-show">Preview Workflow</span>' %>
2
2
 
3
3
  <div class="prepend-1 span-22 append-1">
4
+
4
5
  <%= render '/re_workflows/preview' %>
5
6
  </div>
@@ -1,4 +1,4 @@
1
- <% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_workflow_plan', 'rules_engine/re_plan_preview'] %>
1
+ <% set_re_javascript_include ['rules_engine/re_workflow_show', 'rules_engine/re_workflow_preview', 'rules_engine/re_workflow_plan', 'rules_engine/re_plan_preview'] %>
2
2
  <% set_re_breadcrumbs link_to("All Workflows", re_workflows_path, :class => "re-bc-workflow-list"), '<span class="re-bc-workflow-show">View Workflow</span>' %>
3
3
 
4
4
  <div class="span-2">
@@ -18,7 +18,8 @@
18
18
  <%= render '/re_workflows/rule_empty', :hide => !@re_workflow.re_rules.empty? %>
19
19
 
20
20
  <% @re_workflow.re_rules.each do |re_rule | %>
21
- <%= render '/re_workflows/rule_show', :re_rule => re_rule,
21
+ <%= render '/re_workflows/rule_show', :re_plan_id => 0,
22
+ :re_rule => re_rule,
22
23
  :last_rule => re_rule == @re_workflow.re_rules[-1] %>
23
24
  <% end %>
24
25
  <div class="clear"></div>
@@ -5,7 +5,7 @@ $.re_unblock();
5
5
 
6
6
  $('#re_workflow_change').html('<%=escape_javascript(render('/re_workflows/show'))%>');
7
7
 
8
- $('#re_rule_change').html('<%=escape_javascript(render('/re_workflows/rule_empty':hide => !@re_workflow.re_rules.empty?))%>');
8
+ $('#re_rule_change').html('<%=escape_javascript(render('/re_workflows/rule_empty', :hide => !@re_workflow.re_rules.empty?))%>');
9
9
  <% @re_workflow.re_rules.each do |re_rule | %>
10
10
  $('#re_rule_change').append('<%=escape_javascript(render('/re_workflows/rule_change', :re_rule => re_rule,
11
11
  :re_plan_id => 0,
@@ -47,18 +47,6 @@ class CreateRulesEngine < ActiveRecord::Migration
47
47
  add_index :re_rules, [:re_workflow_id]
48
48
  add_index :re_rules, [:re_workflow_id, :position]
49
49
 
50
- #################################
51
- create_table :re_rule_expected_outcomes do |t|
52
- t.integer :re_rule_id
53
-
54
- t.integer :outcome
55
- t.string :workflow_code
56
-
57
- t.datetime :created_at
58
- t.datetime :updated_at
59
- end
60
-
61
- add_index :re_rule_expected_outcomes, [:re_rule_id]
62
50
 
63
51
  #################################
64
52
  create_table :re_published_plans do |t|
@@ -104,7 +92,6 @@ class CreateRulesEngine < ActiveRecord::Migration
104
92
  drop_table :re_process_runs
105
93
  drop_table :re_process_audits
106
94
 
107
- drop_table :re_rule_expected_outcomes
108
95
  drop_table :re_rules
109
96
  drop_table :re_workflows
110
97
  drop_table :re_plan_workflows
@@ -67,16 +67,16 @@ ActionController::Routing::Routes.draw do |map|
67
67
  map.root :controller => :re_plans, :action => 'template'
68
68
  map.resources :re_plans, :member => {:change => :get,
69
69
  :preview => :get,
70
- :publish => :put,
71
- :revert => :put,
72
- :re_process => :get} do |re_map|
70
+ :publish => :put, :revert => :put,
71
+ :re_process => :get,
72
+ :copy => :get, :duplicate => :post} do |re_map|
73
73
 
74
74
  re_map.resources :workflows, :controller => :re_plan_workflows,
75
75
  :except => [:index],
76
76
  :member => {:change => :get,
77
77
  :default => :put,
78
- :add => :put,
79
- :remove => :put} do |re_pipeline|
78
+ :add => :put, :remove => :put,
79
+ :copy => :get, :duplicate => :post} do |re_pipeline|
80
80
  re_pipeline.resources :rules, :controller => :re_plan_workflow_rules,
81
81
  :except => [:index, :show],
82
82
  :collection => {:help => :get, :error => :get},
@@ -88,7 +88,8 @@ ActionController::Routing::Routes.draw do |map|
88
88
  map.resources :re_workflows, :collection => {:add => :get},
89
89
  :member => {:plan => :get,
90
90
  :change => :get,
91
- :preview => :get} do |re_pipeline|
91
+ :preview => :get,
92
+ :copy => :get, :duplicate => :post} do |re_pipeline|
92
93
  re_pipeline.resources :rules, :controller => :re_workflow_rules,
93
94
  :except => [:index, :show],
94
95
  :collection => {:help => :get, :error => :get},