diff options
author | David Gageot <david@gageot.net> | 2012-07-06 12:55:57 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-06 12:56:00 +0200 |
commit | c43f79f93a44d5294ca30a74f935f3ded8672a1f (patch) | |
tree | cac8cca3dbfb63b03018cc6447447828d9f36b17 /sonar-server/src/main | |
parent | d1454524c4c8ae3722d75ea34fa36f4420465218 (diff) | |
download | sonarqube-c43f79f93a44d5294ca30a74f935f3ded8672a1f.tar.gz sonarqube-c43f79f93a44d5294ca30a74f935f3ded8672a1f.zip |
SONAR-3432 fix and format html
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb | 180 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb | 2 |
2 files changed, 90 insertions, 92 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb index 61270e48483..99b342d9d0d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb @@ -1,65 +1,65 @@ +<td nowrap valign="top" class="left" x="<%= active_rule.failure_level if active_rule -%>" width="1%"> + <form id="levels_<%= rule.id -%>" action=""> + <% enable_modification = is_admin && !profile.provided? + select_box_id = "levels_select_#{rule.id}" + check_box_id = "levels_check_#{rule.id}" + rule_select_box = "$('#{select_box_id}')" + rule_check_box = "$('#{check_box_id}')" + changel_level = remote_function( + :url => {:action => 'activate_rule', :rule_id => rule.id, :id => profile.id}, + :loading => "$('levels_#{rule.id}').replace('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');", + :with => "'level=' + #{rule_select_box}.value", :condition => "#{rule_check_box}.checked") + activate_rule = remote_function( + :url => {:action => 'activate_rule', :rule_id => rule.id, :id => profile.id}, + :loading => "$('levels_#{rule.id}').replace('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');", + :with => "'level=' + get_level_for_rule(#{rule_select_box},#{rule_check_box})") + %> + <%= check_box_tag(check_box_id, 'yes', (!active_rule.nil?), :onclick => activate_rule, :disabled => !enable_modification || (active_rule && (active_rule.inherited? || active_rule.overrides?))) %> + <%= select_tag(select_box_id, options_for_select(RulesConfigurationController::RULE_PRIORITIES, (active_rule.nil? ? rule.priority_text : active_rule.priority_text)), + {:onchange => changel_level, :disabled => (!(enable_modification) || active_rule.nil?)}) %> - <td nowrap valign="top" class="left" x="<%= active_rule.failure_level if active_rule -%>" width="1%"> - <form id="levels_<%= rule.id -%>" action=""> - <% enable_modification = is_admin && !profile.provided? - select_box_id = "levels_select_#{rule.id}" - check_box_id = "levels_check_#{rule.id}" - rule_select_box = "$('#{select_box_id}')" - rule_check_box = "$('#{check_box_id}')" - changel_level = remote_function( - :url => { :action => 'activate_rule', :rule_id => rule.id, :id => profile.id}, - :loading => "$('levels_#{rule.id}').replace('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');", - :with => "'level=' + #{rule_select_box}.value", :condition => "#{rule_check_box}.checked") - activate_rule = remote_function( - :url => { :action => 'activate_rule', :rule_id => rule.id, :id => profile.id}, - :loading => "$('levels_#{rule.id}').replace('<img src=\"#{ApplicationController.root_context}/images/loading.gif\"/>');", - :with => "'level=' + get_level_for_rule(#{rule_select_box},#{rule_check_box})") - %> - <%= check_box_tag(check_box_id, 'yes', (!active_rule.nil?), :onclick => activate_rule, :disabled => !enable_modification || (active_rule && (active_rule.inherited? || active_rule.overrides?))) %> - <%= select_tag(select_box_id, options_for_select(RulesConfigurationController::RULE_PRIORITIES, (active_rule.nil? ? rule.priority_text : active_rule.priority_text)), - {:onchange => changel_level, :disabled => (!(enable_modification) || active_rule.nil?)}) %> - - <% if active_rule %> - <% if active_rule.inherited? %> - <img src="<%= ApplicationController.root_context -%>/images/inherited.png" alt="Inherited from parent" title="<%= message('rules_configuration.inherited_from_parent') -%>"/> - <% elsif active_rule.overrides? %> - <img src="<%= ApplicationController.root_context -%>/images/overrides.png" alt="Overrides parent definition" title="<%= message('rules_configuration.overrides_parent_definition') -%>"/> - <% end %> + <% if active_rule %> + <% if active_rule.inherited? %> + <img src="<%= ApplicationController.root_context -%>/images/inherited.png" alt="Inherited from parent" title="<%= message('rules_configuration.inherited_from_parent') -%>"/> + <% elsif active_rule.overrides? %> + <img src="<%= ApplicationController.root_context -%>/images/overrides.png" alt="Overrides parent definition" title="<%= message('rules_configuration.overrides_parent_definition') -%>"/> <% end %> - </form> - </td> - - <td class="left"> - <div class="h3"><%= link_to_function("#{h rule.name}", nil, :class => "") do |page| - page.toggle "desc_#{rule.id}" - end - %></div> - - <div id="desc_<%= rule.id -%>" class="rule_detail" style="<%= 'display:none' unless rule.id.to_s == params[:rule_id] -%>"> - <a name="rule<%= rule.id -%>"></a> - - <div class="spacer-top spacer-bottom" id="rule_note_<%= rule.id -%>"> - <%= render :partial => 'rule_note', :locals => {:rule => rule, :is_admin => is_admin } %> - </div> - - <% - 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 || !rule.parameters.empty? - %> - <table width="100%" class="table spacer-bottom bordered background-gray"> - <% - 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 - %> + <% end %> + </form> +</td> + +<td class="left"> + <div class="h3"><%= link_to_function("#{h rule.name}", nil, :class => "") do |page| + page.toggle "desc_#{rule.id}" + end + %></div> + + <div id="desc_<%= rule.id -%>" class="rule_detail" style="<%= 'display:none' unless rule.id.to_s == params[:rule_id] -%>"> + <a name="rule<%= rule.id -%>"></a> + + <div class="spacer-top spacer-bottom" id="rule_note_<%= rule.id -%>"> + <%= render :partial => 'rule_note', :locals => {:rule => rule, :is_admin => is_admin} %> + </div> + + <% + 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 || !rule.parameters.empty? + %> + <table width="100%" class="table spacer-bottom bordered background-gray"> + <% + 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 + %> <tr> <td colspan="2"> - <%= message( active_rule.inherited? ? 'rules_configuration.rule_inherited_from_profile_x' : 'rules_configuration.rule_overriding_from_profile_x', - :params => ancestor_active_rule_link) -%> + <%= message(active_rule.inherited? ? 'rules_configuration.rule_inherited_from_profile_x' : 'rules_configuration.rule_overriding_from_profile_x', + :params => ancestor_active_rule_link) -%> <% if ancestor_active_rule.priority != active_rule.priority %> <img src="<%= ApplicationController.root_context -%>/images/overrides.png" alt="Overrides parent definition" title="<%= message('rules_configuration.overrides_parent_definition') -%>" style="vertical-align: middle"/> - <span class="form-val-note" style="font-weight: bold"> <%= message('rules_configuration.original_severity') -%>: <%= ancestor_active_rule.priority_text -%></span> + <span class="form-val-note" style="font-weight: bold"> <%= message('rules_configuration.original_severity') -%> + : <%= ancestor_active_rule.priority_text -%></span> <% end %> <% if is_admin && active_rule.overrides? %> <form action="<%= url_for :overwrite_params => {:action => 'revert_rule', :id => profile.id, :active_rule_id => active_rule.id} -%>" method="post" style="display: inline"> @@ -68,46 +68,44 @@ <% end %> </td> </tr> - <% end %> - <% unless rule.parameters.empty? - rule.parameters.sort.each do |parameter| - active_parameter = active_rule.active_param_by_param_id(parameter.id) if active_rule - %> + <% end %> + <% rule.parameters.sort.each do |parameter| + active_parameter = active_rule.active_param_by_param_id(parameter.id) if active_rule + %> <tr id="param_<%= parameter.id -%>"> <%= render :partial => 'rule_param', :object => nil, :locals => {:parameter => parameter, :active_parameter => active_parameter, :profile => profile, :rule => rule, - :active_rule => active_rule, :ancestor_active_rule => ancestor_active_rule, :is_admin => is_admin } %> + :active_rule => active_rule, :ancestor_active_rule => ancestor_active_rule, :is_admin => is_admin} %> </tr> - <% - end - end - %> - </table> + <% + end + %> + </table> + <% end %> + + <% if active_rule %> + <div id="active_rule_note_<%= active_rule.id -%>"> + <%= render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => is_admin} %> + </div> + <% end %> + + <% if is_admin %> + <% if rule.template? %> + <%= link_to message('rules_configuration.copy_rule'), {:action => 'new', :id => profile.id, :rule_id => rule.id}, :id => "copy-#{u rule.key}", :class => 'link-action spacer-right' %> <% end %> - - <% if active_rule %> - <div id="active_rule_note_<%= active_rule.id -%>"> - <%= render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => is_admin } %> - </div> + <% if rule.editable? %> + <%= link_to message('rules_configuration.edit_rule'), {:action => 'edit', :id => profile.id, :rule_id => rule.id}, :class => 'link-action spacer-right' %> <% end %> - - <% if is_admin %> - <% if rule.template? %> - <%= link_to message('rules_configuration.copy_rule'), {:action => 'new', :id => profile.id, :rule_id => rule.id}, :id => "copy-#{u rule.key}", :class => 'link-action spacer-right' %> - <% end %> - <% if rule.editable? %> - <%= link_to message('rules_configuration.edit_rule'), {:action => 'edit', :id => profile.id, :rule_id => rule.id}, :class => 'link-action spacer-right' %> - <% end %> - <% end %> - - <div style="height: 17px;line-height: 17px;font-size: 11px;"> - <div style="float: left"> - <span style="color: #888"><%= rule.key %></span> - </div> + <% end %> + + <div style="height: 17px;line-height: 17px;font-size: 11px;"> + <div style="float: left"> + <span style="color: #888"><%= rule.key %></span> </div> - - </td> + </div> + </div> +</td> - <script type="text/javascript"> - Form.reset($('levels_<%= rule.id -%>')); - </script> +<script type="text/javascript"> + Form.reset($('levels_<%= rule.id -%>')); +</script> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb index 2530ab33a1b..7fbf65ade5c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb @@ -1,4 +1,4 @@ -<% #locals : parameter, active_parameter, active_rule, is_admin +<% #locals : parameter, active_parameter, active_rule, is_admin, rule, profile, ancestor_active_rule active_param_id = nil param_value = parameter.default_value || '' if active_parameter |