diff options
Diffstat (limited to 'lib/toaster/toastergui/static/js/projectpage.js')
-rw-r--r-- | lib/toaster/toastergui/static/js/projectpage.js | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/toaster/toastergui/static/js/projectpage.js b/lib/toaster/toastergui/static/js/projectpage.js index 3bf3cbaf2..7f19c0d7a 100644 --- a/lib/toaster/toastergui/static/js/projectpage.js +++ b/lib/toaster/toastergui/static/js/projectpage.js @@ -45,6 +45,9 @@ function projectPageInit(ctx) { /* Now we're really ready show the page */ $("#project-page").show(); + + /* Set the project name in the delete modal */ + $("#delete-project-modal .project-name").text(prjInfo.name); }); (function notificationRequest(){ @@ -328,7 +331,32 @@ function projectPageInit(ctx) { $("#delete-project-confirmed").click(function(e){ e.preventDefault(); - + libtoaster.disableAjaxLoadingTimer(); + $(this).find('[data-role="submit-state"]').hide(); + $(this).find('[data-role="loading-state"]').show(); + $(this).attr("disabled", "disabled"); + $('#delete-project-modal [data-dismiss="modal"]').hide(); + + $.ajax({ + type: 'DELETE', + url: libtoaster.ctx.xhrProjectUrl, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (data) { + if (data.error !== "ok") { + console.warn(data.error); + } else { + var msg = $('<span>You have deleted <strong>1</strong> project: <strong id="project-deleted"></strong></span>'); + + msg.find("#project-deleted").text(libtoaster.ctx.projectName); + libtoaster.setNotification("project-deleted", msg.html()); + + window.location.replace(data.gotoUrl); + } + }, + error: function (data) { + console.warn(data); + } + }); }); } |