is_admin=true # security has already been checked by controller filters
render :update do |page|
- page.replace_html("rule_#{rule.id}", :partial => 'rule', :object => rule, :locals => {:profile => profile, :active_rule => active_rule, :is_admin => is_admin})
+ page.replace_html("rule_#{rule.id}", :partial => 'rule', :object => rule, :locals => {:profile => profile, :rule => rule, :active_rule => active_rule, :is_admin => is_admin})
page.assign('localModifications', true)
end
end
java_facade.ruleParamChanged(profile.id, active_rule.id, rule_param.name, old_value, nil, current_user.name)
end
end
- render :partial => 'rule_param', :object => nil,
- :locals => {:parameter => rule_param, :active_parameter => active_param, :profile => profile, :active_rule => active_rule, :is_admin => is_admin }
+ # let's reload the active rule
+ active_rule = ActiveRule.find(active_rule.id)
+ render :partial => 'rule', :locals => {:profile => profile, :rule => active_rule.rule, :active_rule => active_rule, :is_admin => is_admin }
end
page.toggle "desc_#{rule.id}"
end
%>
- <div id="desc_<%= rule.id -%>" class="rule_detail" style="display:none">
+ <div id="desc_<%= rule.id -%>" class="rule_detail" style="<%= 'display:none' unless rule.id.to_s == params[:rule_id] -%>">
+ <a name="rule<%= rule.id -%>"/>
<table width="100%">
<tbody>
<tr>
</td>
<td class="separator"></td>
<td width="50%">
+ <%
+ ancestor_profile = profile.parent
+ ancestor_active_rule = ancestor_profile.active_by_rule_id(rule.id) if ancestor_profile && active_rule && (active_rule.inherited? || active_rule.overrides?)
+ if ancestor_active_rule
+ ancestor_active_rule_link = link_to ancestor_profile.name, :controller => 'rules_configuration', :action => 'index',
+ :id => ancestor_profile.id, :rule_id => rule.id, :anchor => 'rule' + rule.id.to_s
+ %>
+ <%= message( active_rule.inherited? ? 'rules_configuration.rule_inherited_from_profile_x' : 'rules_configuration.rule_overriding_from_profile_x',
+ :params => ancestor_active_rule_link) -%>
+ <% if is_admin && active_rule.overrides? %>
+ <br/>
+ <%= button_to message('rules_configuration.revert_to_parent_definition'), :overwrite_params => {:action => 'revert_rule', :id => profile.id, :active_rule_id => active_rule.id} %><br/>
+ <% end %>
+ <% end %>
+
<% unless rule.parameters.empty? %>
<h3><%= message('rules_configuration.rule_parameters') -%></h3>
<table style="margin-left:7px">
%>
<tbody id="param_<%= parameter.id -%>">
<%= render :partial => 'rule_param', :object => nil,
- :locals => {:parameter => parameter, :active_parameter => active_parameter, :profile => profile, :active_rule => active_rule, :is_admin => is_admin } %>
+ :locals => {:parameter => parameter, :active_parameter => active_parameter, :profile => profile,
+ :active_rule => active_rule, :ancestor_active_rule => ancestor_active_rule, :is_admin => is_admin } %>
</tbody>
<% end %>
</table>
<% end %>
+
+ <h3><%= message('rules_configuration.rule_identification') -%></h3>
+ <table style="margin-left:7px">
+ <tbody>
+ <tr><td style="padding-right:10px"><%= message('plugin') -%>:</td><td><%= rule.plugin_name.capitalize %></td></tr>
+ <tr><td style="padding-right:10px"><%= message('key') -%>:</td><td><%= rule.plugin_rule_key %></td></tr>
+ </tbody>
+ </table>
<% if is_admin %>
+ <br/>
<% if rule.template? %>
<%= button_to message('rules_configuration.copy_rule'), {:action => 'new', :id => profile.id, :rule_id => rule.id}, :id => "copy-#{u rule.key}" %>
<% end %>
<% if rule.editable? %>
<%= button_to message('rules_configuration.edit_rule'), :action => 'edit', :id => profile.id, :rule_id => rule.id %>
<% end %>
- <% if active_rule && active_rule.overrides? %>
- <%= button_to message('rules_configuration.revert_to_parent_definition'), :overwrite_params => {:action => 'revert_rule', :id => profile.id, :active_rule_id => active_rule.id} %><br/>
- <% end %>
<% end %>
- <h3><%= message('rules_configuration.rule_identification') -%></h3>
- <table style="margin-left:7px">
- <tbody>
- <tr><td style="padding-right:10px"><%= message('plugin') -%>:</td><td><%= rule.plugin_name.capitalize %></td></tr>
- <tr><td style="padding-right:10px"><%= message('key') -%>:</td><td><%= rule.plugin_rule_key %></td></tr>
- </tbody>
- </table>
</td>
</tr>
</tbody>
</td>
<td width="90%" nowrap class="left">
<%= form_remote_tag :url => {:action => 'update_param', :id => active_param_id, :profile_id => profile.id, :param_id => parameter.id, :active_rule_id => active_rule_id},
- :update => "param_#{parameter.id}",
- :loading => "$('param_loading_#{parameter.id}').show();" %>
+ :update => "rule_#{active_rule.rule_id}",
+ :loading => "$('param_loading_#{parameter.id}').show();",
+ :complete => "$('desc_#{active_rule.rule_id}').show();" %>
<% span_id = "text_#{parameter.id}" %>
<% read_only = !active_rule || !enable_modification %>
<% end %>
<% end %>
+ <%
+ if active_rule.overrides? && ancestor_active_rule
+ ancestor_param = ancestor_active_rule.active_param_by_param_id(parameter.id)
+ ancestor_value = ancestor_param.value unless ancestor_param.value.blank?
+
+ if ancestor_value && ancestor_value != param_value
+ %>
+ <span class="note" style="font-weight: bold">
+ (<%= message('rules_configuration.original_value') -%>: <%= ancestor_value -%>)
+ </span>
+ <%
+ end
+ end
+ %>
</form>
</td>
</tr>