redirect_to :overwrite_params => {:controller => :dashboard, :action => 'index'}
end
+ def delete_form
+ access_denied unless (is_admin?(@project))
+ @project = get_current_project(params[:id])
+ render :partial => 'delete_form'
+ end
+
+ def delete
+ access_denied unless (is_admin?(@project))
+ @project = get_current_project(params[:id])
+
+ # Ask the resource deletion manager to start the migration
+ # => this is an asynchronous AJAX call
+ ResourceDeletionManager.instance.delete_resources([@project.id])
+
+ # and return some text that will actually never be displayed
+ render :text => ResourceDeletionManager.instance.message
+ end
+
def deletion
@project = get_current_project(params[:id])
if java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'deletable')
deletion_manager = ResourceDeletionManager.instance
if deletion_manager.currently_deleting_resources? ||
- (!deletion_manager.currently_deleting_resources? && deletion_manager.deletion_failures_occured?)
+ (!deletion_manager.currently_deleting_resources? && deletion_manager.deletion_failures_occured?)
# a deletion is happening or it has just finished with errors => display the message from the Resource Deletion Manager
render :template => 'project/pending_deletion'
else
end
end
- def delete
- @project = get_current_project(params[:id])
-
- # Ask the resource deletion manager to start the migration
- # => this is an asynchronous AJAX call
- ResourceDeletionManager.instance.delete_resources([@project.id])
-
- # and return some text that will actually never be displayed
- render :text => ResourceDeletionManager.instance.message
- end
-
def pending_deletion
deletion_manager = ResourceDeletionManager.instance
--- /dev/null
+<% resource_qualifier = message('qualifier.' + @project.qualifier) %>
+<form id="delete-project-form" method="post" action="<%= ApplicationController.root_context -%>/project/delete">
+ <fieldset>
+ <div class="modal-head">
+ <h2><%= message('project_deletion.page', :params => resource_qualifier) -%></h2>
+ </div>
+ <div class="modal-body">
+ <div class="info">
+ <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/>
+ <%= message('project_deletion.delete_resource_confirmation', :params => resource_qualifier) %>
+ </div>
+ </div>
+ <div class="modal-foot">
+ <span id="delete-project-loading-image" class="loading-image hidden"><%= image_tag 'loading.gif' %></span>
+ <input type="submit" value="<%= message('delete') -%>" id="delete-project-submit" onclick="return displayLoadingImage()"/>
+ <a href="#" onclick="return closeModalWindow()" id="delete-project-cancel"><%= message('cancel') -%></a>
+ </div>
+ </fieldset>
+</form>
+<script>
+ $j("#delete-project-form").modalForm({
+ success: function () {
+ $j.ajax({
+ url: "<%= ApplicationController.root_context-%>/project/delete/<%= h(@project.id) -%>",
+ success: function (request) {
+ window.location = '<%= url_for(:action => 'pending_deletion',:id => @project.id)-%>';
+ },
+ data: $j(this).serialize(),
+ type: 'delete'
+ });
+ }
+ });
+
+ function displayLoadingImage() {
+ $j('#delete-project-loading-image').removeClass("hidden");
+ }
+</script>
<%
- if !@snapshot || @snapshot.root?
- resource_qualifier = message('qualifier.' + @project.qualifier)
- delete_resource_message = message('project_deletion.page', :params => resource_qualifier)
+ if !@snapshot || @snapshot.root?
+ resource_qualifier = message('qualifier.' + @project.qualifier)
+ delete_resource_message = message('project_deletion.page', :params => resource_qualifier)
%>
-<h1 class="admin-page-title"><%= delete_resource_message -%></h1>
-<p class="admin-page-description"><%= message('project_deletion.page.description') -%></p>
-<br/>
-<div class="yui-g widget" id="widget_delete_project">
- <div class="warning">
- <form onsubmit="
- $j.ajax({
- url:'<%= url_for(:action => 'delete',:id => @project.id)-%>',
- success:function(request) {
- window.location='<%= url_for(:action => 'pending_deletion',:id => @project.id)-%>';
- },
- data:$j(this).serialize(),
- type:'delete'
- });
- return false;"
- method="delete"
- action="<%= url_for(:action => 'delete',:id => @project.id)-%>">
-
- <%= message('project_deletion.operation_cannot_be_undone') -%>
- <br/>
- <%= submit_tag delete_resource_message, :id => 'delete_resource', :class => 'action red-button',
- :confirm => message('project_deletion.delete_resource_confirmation', :params => resource_qualifier) %>
- </form>
+ <h1 class="admin-page-title"><%= delete_resource_message -%></h1>
+ <p class="admin-page-description"><%= message('project_deletion.page.description') -%></p>
+ <div class="yui-g widget" id="widget_delete_project">
+ <div class="warning">
+ <%= message('project_deletion.operation_cannot_be_undone') -%><br/>
+ <a id="delete_resource" class="open-modal button button-red"
+ href="<%= ApplicationController.root_context -%>/project/delete_form/<%= h(@project.id) -%>"><%= delete_resource_message -%></a>
+ </div>
</div>
-</div>
<% end %>