layout.ie6_warn=Your web browser is outdated. This website may not display correctly.
layout.dashboards=Dashboards
layout.tools=Tools
-layout.tools.quality_profiles=Quality Profiles
layout.user_panel.my_profile=My profile
layout.user_panel.recent_history.title=Recent history
layout.user_panel.recent_history.clear=Clear
#
#------------------------------------------------------------------------------
-quality_profiles.quality_profiles=Quality profiles
-quality_profiles.new_profile=New profile
-quality_profiles.compare_profiles=Compare profiles
-quality_profiles.restore_profile=Restore profile
+quality_profiles.quality_profiles=Quality Profiles
+quality_profiles.new_profile=New Profile
+quality_profiles.compare_profiles=Compare Profiles
+quality_profiles.restore_profile=Restore Profile
quality_profiles.restore_submit=Restore
quality_profiles.x_language_profiles={0} Profiles
quality_profiles.optional_configuration_file=Optional configuration file
#
#
def index
+ require_parameters :id
@profile = Profile.find(params[:id])
@alerts = @profile.alerts.sort
@alert=Alert.new
+ add_breadcrumbs ProfilesController::ROOT_BREADCRUMB, Api::Utils.language_name(@profile.language), @profile.name
end
#
#
- # FILTERS
+ # RAILS FILTERS
#
def init_resource_for_user_role
init_resource_for_role :user
access_denied unless has_role?(role, @resource)
end
+
+
+ # BREADCRUMBS
+ def add_breadcrumbs(*breadcrumbs)
+ @breadcrumbs ||= []
+ @breadcrumbs.concat(breadcrumbs)
+ end
end
#
class MeasuresController < ApplicationController
+
# GET /measures/index
def index
@filter = MeasureFilter.new
def owner?(filter)
current_user && (filter.user_id==current_user.id || (filter.user_id==nil && has_role?(:admin)))
end
-
end
# the backup action is allow to non-admin users : see http://jira.codehaus.org/browse/SONAR-2039
before_filter :admin_required, :only => ['create', 'delete', 'set_as_default', 'copy', 'restore', 'change_parent', 'set_projects', 'rename_form', 'rename']
+ ROOT_BREADCRUMB = {:name => Api::Utils.message('quality_profiles.page'), :url => {:controller => 'profiles', :action => 'index'}}
+
# GET /profiles/index
def index
+ add_breadcrumbs ROOT_BREADCRUMB
@profiles = Profile.find(:all)
Api::Utils.insensitive_sort!(@profiles){|profile| profile.name}
end
- # GET /profiles/show/<id>
- def show
- require_parameters 'id'
- @profile = Profile.find(params[:id])
- end
-
-
# GET /profiles/create_form?language=<language>
def create_form
require_parameters 'language'
end
end
-
# POST /profiles/backup?id=<profile id>
def backup
verify_post_request
profiles=Profile.find(:all, :conditions => ['language=? and id<>? and (parent_name is null or parent_name<>?)', @profile.language, @profile.id, @profile.name], :order => 'name')
@select_parent = [[message('none'), nil]] + profiles.collect { |profile| [profile.name, profile.name] }
+
+ set_profile_breadcrumbs
end
# GET /profiles/changelog?id=<profile id>
@select_versions = versions.map { |u| [message(u.profile_version == last_version ? 'quality_profiles.last_version_x_with_date' : 'quality_profiles.version_x_with_date', :params => [u.profile_version.to_s, l(u.change_date)]), u.profile_version] } | [[message('quality_profiles.no_version'), 0]];
end
+
+ set_profile_breadcrumbs
end
def permalinks
require_parameters 'id'
@profile = Profile.find(params[:id])
+ set_profile_breadcrumbs
end
def projects
require_parameters 'id'
@profile = Profile.find(params[:id])
+ set_profile_breadcrumbs
end
end
end
-
# GET /profiles/compare?id1=<profile1 id>&id2=<profile2 id>
def compare
@profiles = Profile.find(:all, :order => 'language asc, name')
end
end
end
+ add_breadcrumbs ROOT_BREADCRUMB, Api::Utils.message('compare')
end
DIFF_IN1=1
flash[:notice]=messages.getInfos().to_a[0...4].join('<br/>')
end
end
+
+ def set_profile_breadcrumbs
+ add_breadcrumbs ROOT_BREADCRUMB, Api::Utils.language_name(@profile.language), @profile.name
+ end
end
before_filter :admin_required, :except => ['index', 'export']
def index
- if params[:id].to_i<=0
- redirect_to :controller => 'profiles'
- return
- end
- begin
- @profile = Profile.find(params[:id].to_i)
- rescue
- redirect_to :controller => 'profiles'
- return
- end
+ require_parameters :id
+
+ @profile = Profile.find(params[:id])
+ add_breadcrumbs ProfilesController::ROOT_BREADCRUMB, Api::Utils.language_name(@profile.language), @profile.name
init_params()
end
def self.language_name(key)
- language(key) ? language(key).name : key
+ l = language(key)
+ l ? l.name : key
end
end
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %></h1>
<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Alerts'} %>
<% if is_admin? %>
%>
<div id="crumbs">
<% if !@review %>
- <ul id="crumbs-ops">
- <li><a href="<%= url_for(:overwrite_params => {:id => displayed_resource.key})-%>"><img src="<%= ApplicationController.root_context -%>/images/permalink.png" width="16" height="16" title="<%= message('permalink') -%>"/></a></li>
- </ul>
+ <ul id="crumbs-ops">
+ <li>
+ <a href="<%= url_for(:overwrite_params => {:id => displayed_resource.key}) -%>"><img src="<%= ApplicationController.root_context -%>/images/permalink.png" width="16" height="16" title="<%= message('permalink') -%>"/></a>
+ </li>
+ </ul>
<% end %>
<ul id="bc">
<%
%>
</ul>
</div>
+<% elsif @breadcrumbs %>
+ <div id="crumbs">
+ <ul id="bc">
+ <%
+ @breadcrumbs.each_with_index do |breadcrumb, index|
+ %>
+ <li<%= ' class=first' if index==0 -%>>
+ <% if breadcrumb.is_a?(String) %>
+ <span><%= h breadcrumb -%></span>
+ <%
+ elsif breadcrumb.is_a?(Hash)
+ name = breadcrumb[:name]
+ url = breadcrumb[:url]
+ icon = breadcrumb[:icon]
+ %>
+ <%= image_tag icon if icon %>
+ <%= link_to_if url, name, url -%>
+ <% elsif breadcrumb.respond_to?(:html) %>
+ <%= breadcrumb.html -%>
+ <% end %>
+ </li>
+ <% end %>
+ </ul>
+ </div>
<% end %>
\ No newline at end of file
<a href="<%= ApplicationController.root_context -%>/measures"><%= message('layout.measures') -%></a>
</li>
<li>
- <a href="<%= ApplicationController.root_context -%>/profiles"><%= message('layout.tools.quality_profiles') -%></a>
+ <a href="<%= ApplicationController.root_context -%>/profiles"><%= message('quality_profiles.page') -%></a>
</li>
<%= render 'layouts/tools' -%>
</ul>
</div>
<div id="searchResourcesResults" class="autocomplete" style="display:none"></div>
</div>
-<%= render 'layouts/breadcrumb' if selected_section==Navigation::SECTION_RESOURCE -%>
+<%= render 'layouts/breadcrumb' if @breadcrumbs || selected_section==Navigation::SECTION_RESOURCE -%>
<div id="body">
<% if selected_section || @sidebar %>
<div id="sb">
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %></h1>
<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'changelog'} %>
<div class="tabs-panel marginbottom10">
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> /
- <%= message('compare') -%></h1>
-
<form method="GET" class="marginbottom10">
<select name="id1" class="small">
<option value=""></option>
</li>
<% end %>
</ul>
- <h1 class="marginbottom10"><%= message('quality_profiles.page') -%></h1>
</div>
<%
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %></h1>
<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'inheritance'} %>
<div class="tabs-panel marginbottom10">
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %></h1>
<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Permalinks'} %>
<div class="tabs-panel marginbottom10 ">
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %></h1>
<%= render :partial => 'profiles/tabs', :locals => {:selected_tab => 'Projects'} %>
<div class="tabs-panel">
+++ /dev/null
-<p>
- <b>message('name'):</b>
- <%=h @profile.name %>
-</p>
-
-<p>
- <b>message('active'):</b>
- <%=h @profile.active %>
-</p>
-
-
-<%= link_to message('edit'), edit_profile_path(@profile) %> |
-<%= link_to message('back'), profiles_path %>
}
</script>
-<h1 class="marginbottom10"><%= link_to message('quality_profiles.quality_profiles'), :controller => 'profiles', :action => 'index' -%> / <%= h @profile.language -%> / <%= h @profile.name %></h1>
-
<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Coding rules'} %>
<% enable_modification = is_admin? %>
margin: 0;
background: #EFEFEF url("../images/bc-gray.png") no-repeat left;
border-bottom: 1px solid #CCC;
- padding: 0 10px 0 20px;
+ padding: 0 10px 0 25px;
}
#bc li.first {