From 89391aba6ca7a49a24fd402f92d5875d51138397 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Wed, 24 Aug 2011 15:00:07 +0200 Subject: [PATCH] SONAR-2702 New "Exclusions" service in the "CONFIGURATION" section --- .../resources/org/sonar/l10n/core.properties | 2 ++ .../app/controllers/project_controller.rb | 27 ++++++++++++++++--- .../app/views/layouts/_layout.html.erb | 6 +++++ ...xclusions.html.erb => exclusions.html.erb} | 1 + .../_links.html.erb => links.html.erb} | 1 + .../app/views/project/settings.html.erb | 4 --- 6 files changed, 34 insertions(+), 7 deletions(-) rename sonar-server/src/main/webapp/WEB-INF/app/views/project/{settings/_exclusions.html.erb => exclusions.html.erb} (99%) rename sonar-server/src/main/webapp/WEB-INF/app/views/project/{settings/_links.html.erb => links.html.erb} (99%) diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index a61de34dc63..c0754fd8e2f 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -278,6 +278,8 @@ manual_measures.page=Manual Measures my_profile.page=My Profile project_roles.page=Project Roles project_settings.page=Settings +project_links.page=Links +project_exclusions.page=Exclusions quality_profiles.page=Quality Profiles reviews.page=Reviews settings.page=General Settings diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb index 1ad83db4518..fe22aa979cd 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb @@ -37,6 +37,16 @@ class ProjectController < ApplicationController redirect_to_default end + def links + @project=Project.by_key(params[:id]) + return access_denied unless is_admin?(@project) + + @snapshot=@project.last_snapshot + if !@project.project? + redirect_to :action => 'index', :id => params[:id] + end + end + def set_links project = Project.by_key(params[:project_id]) return access_denied unless is_admin?(project) @@ -60,9 +70,10 @@ class ProjectController < ApplicationController project.save! flash[:notice] = 'Links updated.' - redirect_to :action => 'settings', :id => project.id + redirect_to :action => 'links', :id => project.id end + def settings @project=Project.by_key(params[:id]) return access_denied unless is_admin?(@project) @@ -102,6 +113,16 @@ class ProjectController < ApplicationController end + def exclusions + @project=Project.by_key(params[:id]) + return access_denied unless is_admin?(@project) + + @snapshot=@project.last_snapshot + if !@project.project? && !@project.module? + redirect_to :action => 'index', :id => params[:id] + end + end + def set_exclusions @project = Project.find(params[:id]) return access_denied unless is_admin?(@project) @@ -114,7 +135,7 @@ class ProjectController < ApplicationController Property.set('sonar.exclusions', patterns.collect{|x| x.strip}.join(','), @project.id) end flash[:notice]='Filters added' - redirect_to :action => 'settings', :id => @project.id + redirect_to :action => 'exclusions', :id => @project.id end def delete_exclusions @@ -123,7 +144,7 @@ class ProjectController < ApplicationController Property.clear('sonar.exclusions', @project.id) flash[:notice]='Filters deleted' - redirect_to :action => 'settings', :id => @project.id + redirect_to :action => 'exclusions', :id => @project.id end protected diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index 871641fa03a..587c367f4ca 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -54,6 +54,12 @@ <% if (@project.project? || @project.module?) %>
  • <%= message('project_settings.page') -%>
  • <% end %> + <% if (@project.project? || @project.module?) %> +
  • <%= message('project_exclusions.page') -%>
  • + <% end %> + <% if (@project.project?) %> +
  • <%= message('project_links.page') -%>
  • + <% end %> <% if (@project.project? || @project.view? || @project.subview?) %>
  • <%= message('project_roles.page') -%>
  • <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_exclusions.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/exclusions.html.erb similarity index 99% rename from sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_exclusions.html.erb rename to sonar-server/src/main/webapp/WEB-INF/app/views/project/exclusions.html.erb index b2208db0f2b..19161bb8b50 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_exclusions.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/exclusions.html.erb @@ -1,4 +1,5 @@

    Exclude sources from code analysis

    +
    diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_links.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb similarity index 99% rename from sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_links.html.erb rename to sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb index 8f79d83807e..727687e91d9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_links.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb @@ -1,4 +1,5 @@

    Project links

    +