]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2734 Provide a new "Deletion" service for each project
authorFabrice Bellingard <bellingard@gmail.com>
Fri, 26 Aug 2011 12:21:21 +0000 (14:21 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Fri, 26 Aug 2011 12:21:21 +0000 (14:21 +0200)
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/project/deletion.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/project/settings.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_delete_project.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/project/settings/_plugins.html.erb [deleted file]

index 97560a509c034b70c528b521647b65f1e1586eda..4fa26ccaed7db5d2cad8fe794a43d682f4b8594b 100644 (file)
@@ -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
index fe22aa979cdd84444e35765c13048b343ffe038a..127e6816f6845fbada120e7533fa452dfd9f7659 100644 (file)
@@ -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])
index 587c367f4caddc79cf630217bf8ea3f62e6a8f87..d90df8671efc2e194d763eebf6873e51c78bd937 100644 (file)
@@ -63,6 +63,9 @@
             <% if (@project.project? || @project.view? || @project.subview?) %>
               <li class="<%= 'selected' if request.request_uri.include?('/project_roles') -%>"><a href="<%= ApplicationController.root_context -%>/project_roles/index?resource=<%= @project.id -%>"><%= message('project_roles.page') -%></a></li>
             <% end %>
+            <% if (@project.project?) %>
+              <li class="<%= 'selected' if request.request_uri.include?('/project/deletion') -%>"><a href="<%= ApplicationController.root_context -%>/project/deletion/<%= @project.id -%>"><%= message('project_deletion.page') -%></a></li>
+            <% 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 (file)
index 0000000..a145f9e
--- /dev/null
@@ -0,0 +1,10 @@
+<% if @snapshot.root? %>
+<h1>Delete project</h1>
+<br/>
+<div class="yui-g widget" id="widget_delete_project">
+  <div class="warning">
+    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) %>
+  </div>
+</div>
+<% end %>
\ No newline at end of file
index c361a478aeb8f72a91b45716264d14a0f4866689..cb5e508f23b8e045f4f8b48c7fc1e89887fc6e44 100644 (file)
@@ -1,9 +1,9 @@
 <div name="settings">
 
-<%= render :partial => 'project/settings/plugins' %>
-<% if @project.project? %>
-<br/>
-<%= render :partial => 'project/settings/delete_project' %>
-<% end %>
+  <h1 class="marginbottom10">Settings</h1>
+  
+  <div class="yui-g widget" id="widget_plugins">
+    <%= render :partial => 'settings/plugins', :locals => {:project=>@project} %>
+  </div>
 
 </div>
\ 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 (file)
index 282a23c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<% if @snapshot.root? %>
-<h1>Delete project</h1>
-<div class="yui-g widget" id="widget_delete_project">
-  <div class="warning">
-    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) %>
-  </div>
-</div>
-<% 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 (file)
index 7582ee2..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<h1 class="marginbottom10">Settings</h1>
-<div class="yui-g widget" id="widget_plugins">
-<%= render :partial => 'settings/plugins', :locals => {:project=>@project} %>
-</div>
\ No newline at end of file