diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/projectpage.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/projectpage.js | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js index 3bf3cbaf2b..7f19c0d7aa 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectpage.js | |||
@@ -45,6 +45,9 @@ function projectPageInit(ctx) { | |||
45 | 45 | ||
46 | /* Now we're really ready show the page */ | 46 | /* Now we're really ready show the page */ |
47 | $("#project-page").show(); | 47 | $("#project-page").show(); |
48 | |||
49 | /* Set the project name in the delete modal */ | ||
50 | $("#delete-project-modal .project-name").text(prjInfo.name); | ||
48 | }); | 51 | }); |
49 | 52 | ||
50 | (function notificationRequest(){ | 53 | (function notificationRequest(){ |
@@ -328,7 +331,32 @@ function projectPageInit(ctx) { | |||
328 | 331 | ||
329 | $("#delete-project-confirmed").click(function(e){ | 332 | $("#delete-project-confirmed").click(function(e){ |
330 | e.preventDefault(); | 333 | e.preventDefault(); |
331 | 334 | libtoaster.disableAjaxLoadingTimer(); | |
335 | $(this).find('[data-role="submit-state"]').hide(); | ||
336 | $(this).find('[data-role="loading-state"]').show(); | ||
337 | $(this).attr("disabled", "disabled"); | ||
338 | $('#delete-project-modal [data-dismiss="modal"]').hide(); | ||
339 | |||
340 | $.ajax({ | ||
341 | type: 'DELETE', | ||
342 | url: libtoaster.ctx.xhrProjectUrl, | ||
343 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | ||
344 | success: function (data) { | ||
345 | if (data.error !== "ok") { | ||
346 | console.warn(data.error); | ||
347 | } else { | ||
348 | var msg = $('<span>You have deleted <strong>1</strong> project: <strong id="project-deleted"></strong></span>'); | ||
349 | |||
350 | msg.find("#project-deleted").text(libtoaster.ctx.projectName); | ||
351 | libtoaster.setNotification("project-deleted", msg.html()); | ||
352 | |||
353 | window.location.replace(data.gotoUrl); | ||
354 | } | ||
355 | }, | ||
356 | error: function (data) { | ||
357 | console.warn(data); | ||
358 | } | ||
359 | }); | ||
332 | }); | 360 | }); |
333 | 361 | ||
334 | } | 362 | } |