From: Fabrice Bellingard Date: Fri, 26 Aug 2011 12:21:21 +0000 (+0200) Subject: SONAR-2734 Provide a new "Deletion" service for each project X-Git-Tag: 2.11^2~124 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97a58214d83c500121ff2e9e5ddd98730e4e48fd;p=sonarqube.git SONAR-2734 Provide a new "Deletion" service for each project --- 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/deletion.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb new file mode 100644 index 00000000000..a145f9eb4db --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb @@ -0,0 +1,10 @@ +<% if @snapshot.root? %> +

    Delete project

    +
    +
    +
    + This operation can not be undone. + <%= button_to( "Delete project", { :action => "delete", :id => @project.id }, :class => 'action red-button', :confirm => "Are you sure you want to delete this project?", :method => :delete) %> +
    +
    +<% end %> \ No newline at end of file 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/_delete_project.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_delete_project.html.erb deleted file mode 100644 index 282a23c7627..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_delete_project.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<% if @snapshot.root? %> -

    Delete project

    -
    -
    - This operation can not be undone. - <%= button_to( "Delete project", { :action => "delete", :id => @project.id }, :class => 'action red-button', :confirm => "Are you sure you want to delete this project?", :method => :delete) %> -
    -
    -<% end %> \ 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