def languages
controller.java_facade.getLanguages()
end
+
+ def label_for_rules_count(profile)
+ label="#{profile.active_rules.count} rules"
+
+ count_overriding=profile.count_overriding_rules
+ if count_overriding>0
+ label += ", incl. #{count_overriding} overriding"
+ label += image_tag('overrides.png')
+ end
+ label
+ end
end
\ No newline at end of file
!provided? && !default_profile? && children.empty?
end
+ def count_overriding_rules
+ @count_overriding_rules||=
+ begin
+ active_rules.count(:conditions => ['inheritance=?', 'OVERRIDES'])
+ end
+ end
+
def inherited?
parent_name.present?
end
<td align="center" valign="top">
<div>
<% @profile.ancestors.reverse.each do |parent| %>
- <a href="<%= url_for :action => 'inheritance', :id => parent.id -%>"><%= parent.name -%></a> <span class="note">(<%= parent.active_rules.size -%> rules)</span><br/>
+ <a href="<%= url_for :action => 'inheritance', :id => parent.id -%>"><%= parent.name -%></a>
+ <span class="note">(<%= label_for_rules_count(parent) -%>)</span><br/>
<%= image_tag 'blue-up.png' -%><br/>
<% end %>
- <b><%= @profile.name -%></b> <span class="note">(<%= @profile.active_rules.size -%> rules)</span><br/>
+ <b><%= @profile.name -%></b> <span class="note">(<%= label_for_rules_count(@profile) -%>)</span><br/>
<% if @profile.children.size>0 %>
<%= image_tag 'blue-up.png' -%><br/>
<% @profile.children.each_with_index do |child,index| %>
<%= ', ' if index>0 -%>
- <a href="<%= url_for :action => 'inheritance', :id => child.id -%>"><%= child.name -%></a> <span class="note">(<%= child.active_rules.size -%> rules)</span>
+ <a href="<%= url_for :action => 'inheritance', :id => child.id -%>"><%= child.name -%></a>
+ <span class="note">(<%= label_for_rules_count(child) -%>)</span>
<% end %>
<br/><%= image_tag 'blue-up.png' -%><br/>
...