]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2614 Improve bulk deletion page
authorFabrice Bellingard <bellingard@gmail.com>
Tue, 17 Jul 2012 12:42:52 +0000 (14:42 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Tue, 17 Jul 2012 12:42:52 +0000 (14:42 +0200)
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb

index edd1f1e4bed219340f5cb0f865c84e147605df19..806c76bc31f623d3767303896cdb23f17f38967d 100644 (file)
@@ -1280,12 +1280,13 @@ bulk_deletion.clear_selection=Clear selection of all {0} resources
 bulk_deletion.following_deletions_failed=The following resources could not be deleted. Please check the logs to know more about it.
 bulk_deletion.hide_message=Hide message
 bulk_deletion.sure_to_delete_the_resources=Are you sure you want to delete the selected resources?
+bulk_deletion.please_select_at_least_one_resource=Please select at least one resource to delete.
 bulk_deletion.deletion_manager.deleting_resources=Deleting resources...
 bulk_deletion.deletion_manager.no_resource_to_delete=No results.
 bulk_deletion.deletion_manager.currently_deleting_x_out_of_x=Currently deleting resources... ({0} out of {1})
 bulk_deletion.deletion_manager.deletion_completed=Resource deletion completed.
 bulk_deletion.deletion_manager.however_failures_occurred=However, some failures occurred.
-bulk_deletion.started_since_x=Started {0}
+bulk_deletion.started_since_x=Started {0} ago
 
 
 #------------------------------------------------------------------------------
index 0223f1fd0394147c0d290c2dda0bb3ee6c149004..37e2d4c06bd64fa7a5e68d0b68103a42e6613bb5 100644 (file)
 
     <% form_remote_tag( :url => {:action => 'delete_resources'}, :loading => "window.location='#{url_for :action => 'pending_deletions'}';") do %>
   
-    <table class="data">
+    <table class="data" id="resources-to-delete">
       <tfoot>
         <tr>
           <td colspan="2"><%= paginate @resources, {:page_size => page_size} %></td>
         </tr>
         <tr>
           <td colspan="2">
-            <%= submit_tag message('delete'), :id => 'delete_resources', :class => 'action red-button', :confirm => message('bulk_deletion.sure_to_delete_the_resources') %>
+            <input id="delete_resources" class="action red-button" type="submit" value="<%= message('delete') -%>" onclick="return checkBeforeDeleting();" name="commit">
           </td>
         </tr>
       </tfoot>
     <% end %>
   
     <script>
+      function checkBeforeDeleting() {
+        var resource_selected = false;
+        $$("#resources-to-delete input[type='checkbox']").each(function(input) {
+          if (input.checked) resource_selected =  true;
+        });
+        if (!resource_selected) {
+          alert("<%= message('bulk_deletion.please_select_at_least_one_resource') -%>");
+          return false;
+        }
+        
+        if (!confirm("<%= message('bulk_deletion.sure_to_delete_the_resources') -%>")) {
+          return false;
+        } 
+        
+        return true;
+      }
+      
       function selectOrDeselect() {
         var status = $('r-all').checked;
         $$('tbody input').each(function(input) {