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
#------------------------------------------------------------------------------
<% 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) {