icentris-rules 0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +33 -0
  5. data/app/assets/images/pyr_rules/ui-anim_basic_16x16.gif +0 -0
  6. data/app/assets/javascripts/pyr_rules/rules.js +135 -0
  7. data/app/assets/stylesheets/pyr_rules/rules.css.scss +258 -0
  8. data/app/assets/stylesheets/scaffold.css +57 -0
  9. data/app/controllers/pyr_rules/actions_controller.rb +22 -0
  10. data/app/controllers/pyr_rules/events_controller.rb +17 -0
  11. data/app/controllers/pyr_rules/rules_controller.rb +233 -0
  12. data/app/helpers/pyr_rules/actions_helper.rb +2 -0
  13. data/app/helpers/pyr_rules/events_helper.rb +95 -0
  14. data/app/helpers/pyr_rules/rules_helper.rb +10 -0
  15. data/app/models/pyr_rules.rb +3 -0
  16. data/app/models/pyr_rules/action.rb +116 -0
  17. data/app/models/pyr_rules/rule.rb +201 -0
  18. data/app/rules/pyr_rules/action_handler.rb +94 -0
  19. data/app/rules/pyr_rules/controller_event_emitter.rb +34 -0
  20. data/app/rules/pyr_rules/email_action_handler.rb +6 -0
  21. data/app/rules/pyr_rules/event_concerns.rb +23 -0
  22. data/app/rules/pyr_rules/event_config_loader.rb +97 -0
  23. data/app/rules/pyr_rules/event_subscriber.rb +36 -0
  24. data/app/rules/pyr_rules/model_creation_handler.rb +25 -0
  25. data/app/rules/pyr_rules/model_event_emitter.rb +80 -0
  26. data/app/rules/pyr_rules/rule_context.rb +20 -0
  27. data/app/rules/pyr_rules/rules_config.rb +87 -0
  28. data/app/rules/pyr_rules/rules_engine.rb +38 -0
  29. data/app/rules/pyr_rules/web_request_logger.rb +6 -0
  30. data/app/views/pyr_rules/actions/index.html.erb +12 -0
  31. data/app/views/pyr_rules/events/_sidebar.html.erb +8 -0
  32. data/app/views/pyr_rules/events/index.html.erb +72 -0
  33. data/app/views/pyr_rules/events/show.html.erb +11 -0
  34. data/app/views/pyr_rules/rules/_form.html.erb +28 -0
  35. data/app/views/pyr_rules/rules/_ready_headers.js.erb +11 -0
  36. data/app/views/pyr_rules/rules/_rule_context_field.html.erb +10 -0
  37. data/app/views/pyr_rules/rules/_rules.html.erb +34 -0
  38. data/app/views/pyr_rules/rules/add_action_mapping.js.erb +13 -0
  39. data/app/views/pyr_rules/rules/edit.html.erb +14 -0
  40. data/app/views/pyr_rules/rules/index.html.erb +5 -0
  41. data/app/views/pyr_rules/rules/lookup_sub_properties.js.erb +13 -0
  42. data/app/views/pyr_rules/rules/new.html.erb +11 -0
  43. data/app/views/pyr_rules/rules/remove_action_mapping.js.erb +15 -0
  44. data/app/views/pyr_rules/rules/show.html.erb +98 -0
  45. data/app/views/shared/_action.html.erb +41 -0
  46. data/app/views/shared/_action_field_mapping.html.erb +33 -0
  47. data/app/views/shared/_event.html.erb +21 -0
  48. data/app/views/shared/_rule.html.erb +27 -0
  49. data/config/routes.rb +32 -0
  50. data/config/security.yml +9 -0
  51. data/db/seeds.rb +1 -0
  52. data/lib/pyr_rules.rb +34 -0
  53. data/lib/pyr_rules/engine.rb +72 -0
  54. data/lib/pyr_rules/generators/dummy_generator.rb +27 -0
  55. data/lib/pyr_rules/version.rb +3 -0
  56. data/lib/tasks/pyr_rules_tasks.rake +57 -0
  57. metadata +224 -0
@@ -0,0 +1,72 @@
1
+ <h3>Listing Events</h3>
2
+
3
+
4
+ <!--
5
+ :model_events=>
6
+ {"PyrCommunity"=>
7
+ {"Blog"=>
8
+ {:context=>
9
+ {"id"=>{:type=>:integer},
10
+ "title"=>{:type=>:string},
11
+ "author_id"=>{:type=>:integer},
12
+ "disqus_shortname"=>{:type=>:string},
13
+ "background_tile"=>{:type=>:boolean},
14
+ "background_blur"=>{:type=>:integer},
15
+ "footer"=>{:type=>:text},
16
+ "description"=>{:type=>:text},
17
+ "twitter"=>{:type=>:string},
18
+ "google_analytics"=>{:type=>:string},
19
+ "background_uid"=>{:type=>:string},
20
+ "logo_uid"=>{:type=>:string},
21
+ "created_at"=>{:type=>:datetime},
22
+ "updated_at"=>{:type=>:datetime}},
23
+ :actions=>[:create, :update, :delete]}
24
+ }
25
+ },
26
+ "PyrCore"=>
27
+ {"Lead"=>
28
+ {:context=>
29
+ {"id"=>{:type=>:integer},
30
+ "first_name"=>{:type=>:string},
31
+ "last_name"=>{:type=>:string},
32
+ "email"=>{:type=>:string},
33
+ "phone"=>{:type=>:string},
34
+ "lead_group"=>{:type=>:string},
35
+ "comments"=>{:type=>:text},
36
+ "user_id"=>{:type=>:integer},
37
+ "created_at"=>{:type=>:datetime},
38
+ "updated_at"=>{:type=>:datetime}},
39
+ :actions=>[:create, :update, :delete]}}}}
40
+
41
+ --------------------------------------------------------------------------
42
+ DynaTree equivalent below
43
+ --------------------------------------------------------------------------
44
+
45
+ [
46
+ {title: "Model Events", isFolder: true, key: "model_events",
47
+ children: [
48
+ {title: "PyrCommunity", isFolder: true, key: "model_events.pyr_community",
49
+ children: [
50
+ {title: "Blog", isFolder: true, key: "model_events.pyr_community.blog",
51
+ children: [
52
+ {title: "Create", key: "model_events.pyr_community.blog.create" },
53
+ {title: "Update", key: "model_events.pyr_community.blog.update" },
54
+ {title: "Delete", key: "model_events.pyr_community.blog.delete" },
55
+ ]}
56
+ ]},
57
+ children: [
58
+ {title: "PyrCore", isFolder: true, key: "model_events.pyr_core",
59
+ children: [
60
+ {title: "Lead", isFolder: true, key: "model_events.pyr_core.lead",
61
+ children: [
62
+ {title: "Create", key: "model_events.pyr_core.lead.create" },
63
+ {title: "Update", key: "model_events.pyr_core.lead.update" },
64
+ {title: "Delete", key: "model_events.pyr_core.lead.delete" },
65
+ ]}
66
+ ]}
67
+
68
+ ]}
69
+
70
+ ]
71
+ -->
72
+ <%= render_tree @events_tree %>
@@ -0,0 +1,11 @@
1
+ <% content_for :page_title do %>
2
+ Listing Rules for event
3
+ <% end %>
4
+
5
+ <% content_for :left_column do %>
6
+ <%= render "pyr_rules/events/sidebar" %>
7
+ <% end %>
8
+
9
+ <%= @event[:name] %>
10
+ <%= @event[:description] %>
11
+ <%= render "pyr_rules/rules/rules"%>
@@ -0,0 +1,28 @@
1
+ <%
2
+ url = params[:event_id].presence ? pyr_rules_event_rules_path(event_id: params[:event_id]) : pyr_rules_rules_path
3
+ url = (params[:event_id].presence ? pyr_rules_event_rule_path(@pyr_rules_rule, event_id: params[:event_id]) : pyr_rules_rule_path(@pyr_rules_rule)) unless @pyr_rules_rule.new_record?
4
+ %>
5
+
6
+ <%= simple_form_for( @pyr_rules_rule, url: url) do |f| %>
7
+ <% if @pyr_rules_rule.errors.any? %>
8
+ <div id="error_explanation">
9
+ <h2><%= pluralize(@pyr_rules_rule.errors.count, "error") %> prohibited this pyr_rules_rule from being saved:</h2>
10
+
11
+ <ul>
12
+ <% @pyr_rules_rule.errors.full_messages.each do |msg| %>
13
+ <li><%= msg %></li>
14
+ <% end %>
15
+ </ul>
16
+ </div>
17
+ <% end %>
18
+
19
+ <div class="field">
20
+ <%= f.input :name , label: "Name" , input_html: {class: "col-md-3"} %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.input :description , label: "Description" , input_html: {class: "col-md-3"} %>
24
+ </div>
25
+ <div class="actions">
26
+ <%= f.button :submit %>
27
+ </div>
28
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% if @action.ready? %>
2
+ $("#action_title_<%= @action.id.to_s %>").addClass("ready");
3
+ <% else %>
4
+ $("#action_title_<%= @action.id.to_s %>").removeClass("ready");
5
+ <% end %>
6
+
7
+ <% if @pyr_rules_rule.ready? %>
8
+ $("#rule_title_<%= @pyr_rules_rule.id.to_s %>").addClass("ready");
9
+ <% else %>
10
+ $("#rule_title_<%= @pyr_rules_rule.id.to_s %>").removeClass("ready");
11
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% path_id = "#{rule.id.to_s}_#{path.to_s.gsub('.','__')}" %>
2
+ <div id="rule_field_<%= path_id %>" class="context context-draggable <%= 'used' if rule.context_field_mapped?(path,type) %>" data-fieldtype="<%= type %>" data-fieldname="<%= path %>">
3
+ <% if drillable_rule_type? type %>
4
+ <%= link_to "+", lookup_sub_properties_pyr_rules_rules_path(rule_id: rule.id, div_id: path_id, path: path), remote: true, id: "expand_link_#{path_id}" %>
5
+ <%= link_to "-", "javascript:void();", onclick:"remove_sub_properties('#{path_id}');", class: "hidden", id: "collapse_link_#{path_id}" %>
6
+ <% else %>
7
+ &nbsp;&nbsp;
8
+ <% end %>
9
+ <b><%= field %></b> (<i><%= type %></i>)
10
+ </div>
@@ -0,0 +1,34 @@
1
+ <%= link_to "Reload Rules Engine Configuration", reload_rules_engine_pyr_rules_rules_path, class: "btn btn-mini btn-primary", "data-confirm" => "This may take a moment - it may also cause threading race conditions until it is done in a smarter fashion, it will reload available Events and ActionHandlers. That being said... ARE YOU SURE?" %>
2
+
3
+ <%= link_to "New Rule", new_pyr_rules_rule_path, class: "btn btn-mini btn-primary" %>
4
+
5
+ <table>
6
+ <tr>
7
+ <th>Active</th>
8
+ <th>Modified</th>
9
+ <th>Name</th>
10
+ <th style="min-width:300px;">Events</th>
11
+ <th>Criteria</th>
12
+ <th style="min-width:300px;">Actions</th>
13
+ </tr>
14
+
15
+ <% @pyr_rules_rules.each do |pyr_rules_rule| %>
16
+ <tr style="border-bottom:1px solid black;margin-top:10px;">
17
+ <td><input type="checkbox" disabled checked></td>
18
+ <td><%= time_ago_in_words(pyr_rules_rule.u_at) %></td>
19
+ <td><%= link_to pyr_rules_rule.name, params[:event_id].presence ? pyr_rules_event_rule_path(pyr_rules_rule, event_id: params[:event_id]) : pyr_rules_rule_path(pyr_rules_rule) %></td>
20
+ <td style="min-width:300px;">
21
+ <%= pyr_rules_rule.events.count %> event(s) trigger this rule
22
+ </td>
23
+ <td><%= pyr_rules_rule.criteria %></td>
24
+ <td style="min-width:300px;">
25
+ <% pyr_rules_rule.actions.each do |a| %>
26
+ <div class="title <%= "ready" if a.ready? %>"><%= a.type.split("::").last.titleize %></div>
27
+ <% end %>
28
+ </td>
29
+ </tr>
30
+ <% end %>
31
+ </table>
32
+
33
+ <br />
34
+
@@ -0,0 +1,13 @@
1
+ <% if @error %>
2
+ toastr.error("<%= j @error %>");
3
+ <% else %>
4
+ toastr.success("Mapping added <%= @rule_field_name %> to <%= @action_field_name %>");
5
+ $("#action_mapping_<%= @action.id.to_s %>_<%= @action_field_name %>").replaceWith("<%= j render 'shared/action_field_mapping',
6
+ action: @action,
7
+ field_name: @action_field_name,
8
+ field_type: @action_field_type %>");
9
+ $("#rule_field_<%= @action.rule.id.to_s %>_<%= @rule_field_name.to_s.gsub(".", "__") %>").addClass("used");
10
+
11
+ <%= render 'ready_headers' %>
12
+
13
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% content_for :page_title do %>
2
+ <h1>Editing Rule</h1>
3
+ <% end %>
4
+
5
+ <% if params[:event_id].presence %>
6
+ <% content_for :left_column do %>
7
+ <%= render "pyr_rules/events/sidebar" %>
8
+ <% end %>
9
+ <% end %>
10
+
11
+ <%= render 'form' %>
12
+
13
+ <%= link_to 'Show', params[:event_id].presence ? pyr_rules_event_rule_path(@pyr_rules_rule, event_id: params[:event_id]) : pyr_rules_rule_path(@pyr_rules_rule) %> |
14
+ <%= link_to 'Back', params[:event_id].presence ? pyr_rules_event_rules_path(event_id: params[:event_id]) : pyr_rules_rules_path %>
@@ -0,0 +1,5 @@
1
+ <% content_for :page_title do %>
2
+ <h1>Listing Rules</h1>
3
+ <% end %>
4
+
5
+ <%= render "rules"%>
@@ -0,0 +1,13 @@
1
+ $('#expand_link_<%= "#{@div_id}" %>').toggleClass("hidden");
2
+ $('#collapse_link_<%= "#{@div_id}" %>').toggleClass("hidden");
3
+ <% @ctx.each do |field, type| %>
4
+ $('#rule_field_<%= "#{@div_id}" %>').append("<%= j render 'pyr_rules/rules/rule_context_field', rule: @rule, path: "#{@path}.#{field}", field: field, type: type %>");
5
+ <% end %>
6
+
7
+ $('<%= "#rule_field_#{@div_id}" %>').children(".context-draggable" ).draggable({
8
+ cursor: "move",
9
+ cursorAt: { top: -2, left: -20 },
10
+ containment: $("#main-content").parent(),
11
+ helper: function( event ) {
12
+ return $( "<div style='color:black;'>" + $(this).html() + "</div>" );
13
+ }});
@@ -0,0 +1,11 @@
1
+ <% content_for :page_title do %>
2
+ <h1>New Rule</h1>
3
+ <% end %>
4
+ <% if params[:event_id].presence %>
5
+ <% content_for :left_column do %>
6
+ <%= render "pyr_rules/events/sidebar" %>
7
+ <% end %>
8
+ <% end %>
9
+
10
+ <%= render 'form' %>
11
+ <%= link_to 'Back', params[:event_id].presence ? pyr_rules_event_rules_path(event_id: params[:event_id]) : pyr_rules_rules_path %>
@@ -0,0 +1,15 @@
1
+ <% if @message %>
2
+ toastr.success("<%= j @message %>");
3
+ <% end %>
4
+ $("#action_mapping_<%= @action.id.to_s %>_<%= @action_field_name %>").
5
+ replaceWith("<%= j render 'shared/action_field_mapping',
6
+ action: @action,
7
+ field_name: @action_field_name,
8
+ field_type: @action_field_type %>");
9
+ $(".context-droppable").not(".ui-droppable").droppable( droppableConfiguration );
10
+
11
+ <%= render 'ready_headers' %>
12
+
13
+ <% if @rule_field_name && !@pyr_rules_rule.context_field_mapped?(@rule_field_name,@rule_field_type) %>
14
+ $("#rule_field_<%= @action.rule.id.to_s %>_<%= @rule_field_name.to_s.gsub(".", "__") %>").removeClass("used");
15
+ <% end %>
@@ -0,0 +1,98 @@
1
+ <style>
2
+ h2 {
3
+ font-size: 24px;
4
+ font-weight: bold;
5
+ margin: 15px 0px;
6
+ text-align: center;
7
+ }
8
+
9
+ input[type='text'] {
10
+ margin-bottom: 15px;
11
+ padding: 5px;
12
+ width: 100%;
13
+ }
14
+
15
+
16
+ .affix-top {
17
+ position: static;
18
+ }
19
+
20
+ .affix {
21
+ position: fixed;
22
+ top: 0px;
23
+ }
24
+ </style>
25
+
26
+ <% content_for :page_javascript do %>
27
+ <script>
28
+ var rule_id = "<%= @pyr_rules_rule.id %>";
29
+ </script>
30
+ <script type="text/javascript">
31
+ $(document).ready(function() {
32
+ // Set the width of the rule actions column content before Bootstrap Affix makes it fixed
33
+ var $rule_actions = $("#rule-actions > div");
34
+ $rule_actions.width($rule_actions.width());
35
+
36
+ // Affix the actions column
37
+ rule_actions_top = $rule_actions.offset().top - 20;
38
+ $rule_actions.affix({
39
+ offset: {
40
+ top: function () {
41
+ return rule_actions_top;
42
+ }
43
+ }
44
+ });
45
+ });
46
+ </script>
47
+ <% end %>
48
+
49
+ <% content_for :page_title do %>
50
+ Rules Manager
51
+ <% end %>
52
+
53
+ <% content_for :page_tools do %>
54
+ <%= link_to "Reload Rules Engine Configuration", reload_rules_engine_pyr_rules_rules_path, class: "btn btn-mini btn-primary", "data-confirm" => "This may take a moment - it may also cause threading race conditions until it is done in a smarter fashion, it will reload available Events and ActionHandlers. That being said... ARE YOU SURE?" %>
55
+
56
+ <%= link_to "New Rule", new_pyr_rules_rule_path, class: "btn btn-mini btn-primary" %>
57
+
58
+ <%= link_to "Show Rules", pyr_rules_rules_path, class: "btn btn-mini btn-primary" %>
59
+ <% end %>
60
+
61
+ <div id="rules-manager">
62
+ <div class="row">
63
+ <div class="col-md-4">
64
+ <h2>Events (Triggers)</h2>
65
+ <input id="event_lookup_autocomplete" type="text" placeholder="Add an Event..."/>
66
+ <div>
67
+ <% if @pyr_rules_rule.events %>
68
+ <% @pyr_rules_rule.events.sort.each do |event_name| %>
69
+ <%= render 'shared/event', event_name: event_name, rule: @pyr_rules_rule, show_arrow: true %>
70
+ <% end %>
71
+ <% end %>
72
+ <div class="clear"></div>
73
+ </div>
74
+ </div>
75
+
76
+ <div class="col-md-4">
77
+ <h2>
78
+ Rule Configuration
79
+ </h2>
80
+ <%= render 'shared/rule', rule: @pyr_rules_rule %>
81
+ </div>
82
+
83
+ <div id="rule-actions" class="col-md-4">
84
+ <div>
85
+ <h2>Actions</h2>
86
+ <input id="action_lookup_autocomplete" type="text" placeholder="Add an Action..."/>
87
+ <div>
88
+ <% if @pyr_rules_rule.actions %>
89
+ <% @pyr_rules_rule.actions.each do |a| %>
90
+ <%= render 'shared/action', action: a, show_arrow: true %>
91
+ <div class="clear"></div>
92
+ <% end %>
93
+ <% end %>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </div>
98
+ </div>
@@ -0,0 +1,41 @@
1
+ <% show_arrow ||= false %>
2
+ <% title_only = false unless defined? title_only %>
3
+ <div class="rules-widget">
4
+ <div id="action_title_<%= action.id.to_s %>" class="title <%= "ready" if action.ready? %>"><%= action.type.split("::").last.titleize %></div>
5
+ <% unless title_only %>
6
+ <% if @pyr_rules_rule %>
7
+ <div class="action-links"><%= link_to "<i class='#{PyrRules.trash_icon}'></i>".html_safe, remove_action_pyr_rules_rule_path(@pyr_rules_rule, action_id: action.id ), "data-confirm" => "Are you sure you want to remove this Action from your Rule?" %></div>
8
+ <% end %>
9
+ <div class="classname"><%= action.type %></div>
10
+ <% needs = action.needs %>
11
+ <% templates = action.template_names %>
12
+ <% if @pyr_rules_rule %>
13
+ <div class="collapse-group">
14
+ <a class="collapse-context" data-toggle='collapse' data-target='#provided_<%= action.type.gsub("::","_") %>'>Mapping</a>
15
+ <div id="provided_<%= action.type.gsub("::","_") %>" class="collapse in">
16
+ <% if needs %>
17
+ <% needs.each do |field, type| %>
18
+ <%= render 'shared/action_field_mapping', action: action, field_name: field, field_type: type %>
19
+ <% end %>
20
+ <% end %>
21
+ <% if templates %>
22
+ <% templates.each do |name| %>
23
+ <div class="text-area collapse in">
24
+ <div class="name"><%= name.to_s.titleize %></div>
25
+ <%= simple_form_for @pyr_rules_rule do %>
26
+
27
+ <textarea name="pyr_rules_rule[action][<%= action.id.to_s %>][template][<%= name %>]"><%= action.template_body(name) %></textarea>
28
+ <input type="submit" class="action-links btn btn-mini btn-primary" value="save"/>
29
+ <% end %>
30
+ </div>
31
+ <% end %>
32
+ <% end %>
33
+
34
+ </div>
35
+ </div>
36
+ <% end %>
37
+ <% if show_arrow %>
38
+ <div class="in_arrow"><i class='<%= PyrRules.arrow_icon %>'></i></div>
39
+ <% end %>
40
+ <% end %>
41
+ </div>
@@ -0,0 +1,33 @@
1
+ <% mapping = action.lookup_context_mapping(field_name,field_type) %>
2
+ <% if mapping %>
3
+ <% mapping_class = "action-context-mapped" %>
4
+ <% else %>
5
+ <% mapping_class = "context-droppable needs-mapping" %>
6
+ <% end %>
7
+
8
+ <div id="action_mapping_<%= action.id.to_s %>_<%= field_name.to_s.gsub(".", "__") %>" style="position:relative;" class="context <%= mapping_class %>" data-rule-id="<%= @pyr_rules_rule.id rescue "" %>" data-action-id="<%= action.id %>" data-fieldtype="<%= field_type %>" data-fieldname="<%= field_name %>">
9
+
10
+ <% if mapping %>
11
+
12
+ <span class="source-mapping"><%= "<b>#{mapping[0]}</b>(<i>#{mapping[1]}</i>)".html_safe %></span>
13
+ <i class='<%= PyrRules.arrow_icon %>'></i>
14
+ <span class="delete-source-mapping" onclick="remove_action_mapping('<%= action.id %>','<%= field_name %>', '<%= field_type %>');"><i class="<%= PyrRules.delete_icon %>"></i></span>
15
+
16
+ <% elsif field_type == :class_lookup %>
17
+
18
+ <div class="collapse-group" style="max-height:300px;overflow:auto;">
19
+ <a data-toggle="collapse" data-target="#class_lookup">
20
+ <i class='btn btn-xs btn-primary <%= PyrRules.lookup_icon %>'></i>
21
+ </a>
22
+ <div class="collapse" id="class_lookup">
23
+ <% PyrRules::RulesConfig.events_config[:model_events].keys.sort.each do |klazz| %>
24
+ <div onclick="add_action_mapping('<%= action.id.to_s %>', '<%= field_name %>:class_lookup', '<%= klazz.underscore %>:class_lookup','class_lookup');" style="cursor:pointer;">
25
+ <%= klazz %>
26
+ </div>
27
+ <% end %>
28
+ </div>
29
+ </div>
30
+
31
+ <% end %>
32
+ <b><%= field_name %></b> (<i><%= field_type %></i>)
33
+ </div>
@@ -0,0 +1,21 @@
1
+ <% show_arrow ||= false %>
2
+
3
+ <% context = PyrRules::RulesConfig.event_config(event_name)[:context] %>
4
+ <div class="rules-widget">
5
+ <div class="title ready"><%= event_name.split("::").last(2).join("::").titleize %></div>
6
+ <div class="action-links"><%= link_to "<i class='#{PyrRules.trash_icon}'></i>".html_safe, remove_event_pyr_rules_rule_path(@pyr_rules_rule, event: event_name), "data-confirm" => "Are you sure you want to remove this Event Trigger from this Rule?" %></div>
7
+ <div class="classname"><%= event_name %></div>
8
+ <% if context %>
9
+ <div class="collapse-group">
10
+ <a class="collapse-context" data-toggle='collapse' data-target='#provided_<%= event_name.gsub("::","_") %>'>Context</a>
11
+ <div id="provided_<%= event_name.gsub("::","_") %>" class="collapse out">
12
+ <% context.each do |field, type| %>
13
+ <div class="context <%= 'unavailable' unless rule && rule.context[field] == type %>">
14
+ <b><%= field %></b> (<i><%= type %></i>)
15
+ </div>
16
+ <% end %>
17
+ </div>
18
+ </div>
19
+ <% end %>
20
+ <div class="out_arrow"><i class='<%= PyrRules.arrow_icon %>'></i></div>
21
+ </div>