dependencies.page=Dependencies
resource_deletion.page={0} Deletion
update_key.page=Update Key
+project_quality_profile.page=Quality Profile
# GWT pages
update_key.are_you_sure_to_rename_x=Are you sure you want to rename "{0}", as well as all its modules and resources ?
update_key.are_you_sure_to_bulk_rename_x_into_x=Are you sure you want to rename "<b>{0}</b>{1}" into "<b>{2}</b>{1}", as well as all its modules and resources ?
+
+#------------------------------------------------------------------------------
+#
+# PROJECT QUALITY PROFILE PAGE
+#
+#------------------------------------------------------------------------------
+project_quality_profile.current_profile_for_x=Current quality profile for "{0}":
+project_quality_profile.project_cannot_be_update_with_profile_x=The current project can not be updated with the following profile: "{0}".
+project_quality_profile.profile_successfully_updated=Quality profile successfully updated.
+
+
#------------------------------------------------------------------------------
#
# PROJECT (RESOURCE) DELETION PAGE
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
#
class ProjectController < ApplicationController
- verify :method => :post, :only => [:set_links, :set_exclusions, :delete_exclusions, :update_key, :perform_key_bulk_update],
+ verify :method => :post, :only => [:set_links, :set_exclusions, :delete_exclusions, :update_key, :perform_key_bulk_update, :update_quality_profile],
:redirect_to => {:action => :index}
verify :method => :delete, :only => [:delete], :redirect_to => {:action => :index}
redirect_to_default
end
+ def quality_profile
+ @project = get_current_project(params[:id])
+ @profiles = Profile.find(:all, :conditions => {:language => @project.language, :enabled => true})
+ end
+
+ def update_quality_profile
+ project = get_current_project(params[:id])
+
+ selected_profile = Profile.find(:first, :conditions => {:id => params[:quality_profile]})
+ if selected_profile && selected_profile.language == project.language
+ project.profile = selected_profile
+ project.save!
+ flash[:notice] = message('project_quality_profile.profile_successfully_updated')
+ else
+ selected_profile_name = selected_profile ? selected_profile.name + "(" + selected_profile.language + ")" : "Unknown profile"
+ flash[:error] = message('project_quality_profile.project_cannot_be_update_with_profile_x', :params => selected_profile_name)
+ end
+
+ redirect_to :action => 'quality_profile', :id => project.id
+ end
+
def key
@project = get_current_project(params[:id])
<% end %>
<% if has_role?(:admin, @project) %>
<li class="h2"><%= message('sidebar.project_settings') -%></li>
+ <% if (@project.project?) %>
+ <li class="<%= 'selected' if request.request_uri.include?('/project/quality_profile') -%>">
+ <a href="<%= ApplicationController.root_context -%>/project/quality_profile/<%= @project.id -%>"><%= message('project_quality_profile.page') -%></a></li>
+ <% end %>
<li class="<%= 'selected' if request.request_uri.include?('/manual_measures') -%>">
<a href="<%= ApplicationController.root_context -%>/manual_measures/index/<%= @project.id -%>"><%= message('manual_measures.page') -%></a></li>
<% if (@project.project?) %>
--- /dev/null
+<h1><%= message('project_quality_profile.page') -%></h1>
+<br/>
+<%
+ form_tag( {:action => 'update_quality_profile', :id => @project.id }) do
+ project_profile = @project.profile
+%>
+
+ <span style= "padding-right: 10px"><%= message('project_quality_profile.current_profile_for_x', :params => @project.name) -%></span>
+
+ <select name="quality_profile" id="quality_profile">
+ <% @profiles.each do |profile| %>
+ <option <%= 'selected' if (project_profile && project_profile==profile) || (!project_profile && profile.default_profile) -%>
+ value="<%= profile.id -%>"><%= profile.name -%></option>
+ <% end %>
+ </select>
+
+ <%= submit_tag message('update_verb'), :id => 'update_profile' %>
+
+<% end %>