From 97a58214d83c500121ff2e9e5ddd98730e4e48fd Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Fri, 26 Aug 2011 14:21:21 +0200 Subject: [PATCH] SONAR-2734 Provide a new "Deletion" service for each project --- .../src/main/resources/org/sonar/l10n/core.properties | 1 + .../WEB-INF/app/controllers/project_controller.rb | 10 ++++++++++ .../webapp/WEB-INF/app/views/layouts/_layout.html.erb | 3 +++ .../_delete_project.html.erb => deletion.html.erb} | 1 + .../webapp/WEB-INF/app/views/project/settings.html.erb | 10 +++++----- .../app/views/project/settings/_plugins.html.erb | 4 ---- 6 files changed, 20 insertions(+), 9 deletions(-) rename sonar-server/src/main/webapp/WEB-INF/app/views/project/{settings/_delete_project.html.erb => deletion.html.erb} (96%) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_plugins.html.erb 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 97560a509c0..4fa26ccaed7 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 @@ -280,6 +280,7 @@ project_roles.page=Project Roles project_settings.page=Settings project_links.page=Links project_exclusions.page=Exclusions +project_deletion.page=Deletion 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 fe22aa979cd..127e6816f68 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 @@ -27,6 +27,16 @@ class ProjectController < ApplicationController redirect_to :overwrite_params => {:controller => :dashboard, :action => 'index'} end + def deletion + @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 delete if params[:id] @project = Project.by_key(params[:id]) 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 587c367f4ca..d90df8671ef 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 @@ -63,6 +63,9 @@ <% if (@project.project? || @project.view? || @project.subview?) %>
  • <%= message('project_roles.page') -%>
  • <% end %> + <% if (@project.project?) %> +
  • <%= message('project_deletion.page') -%>
  • + <% end %> <% end %> <% elsif selected_section==Navigation::SECTION_CONFIGURATION %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_delete_project.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb similarity index 96% rename from sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_delete_project.html.erb rename to sonar-server/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb index 282a23c7627..a145f9eb4db 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_delete_project.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb @@ -1,5 +1,6 @@ <% if @snapshot.root? %>

    Delete project

    +
    This operation can not be undone. diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings.html.erb index c361a478aeb..cb5e508f23b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings.html.erb @@ -1,9 +1,9 @@
    -<%= render :partial => 'project/settings/plugins' %> -<% if @project.project? %> -
    -<%= render :partial => 'project/settings/delete_project' %> -<% end %> +

    Settings

    + +
    + <%= render :partial => 'settings/plugins', :locals => {:project=>@project} %> +
    \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_plugins.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_plugins.html.erb deleted file mode 100644 index 7582ee2d3d4..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_plugins.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -

    Settings

    -
    -<%= render :partial => 'settings/plugins', :locals => {:project=>@project} %> -
    \ No newline at end of file -- 2.39.5