From 5b035ed9be2a79a31d25a0b527d3688a0ce6f97e Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Mon, 26 Sep 2016 13:59:37 +0300 Subject: bitbake: toaster: layerdetails Update implementation of delete imported layer Update the implementation of delete an imported layer so that it is consistent with the other delete messages and wording. Also use the new libtoaster way of setting a notification that the delete was successful. (Bitbake rev: 0b8d3ac48b5a0984963d664ff5630e3b02c4ecd1) Signed-off-by: Michael Wood Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/api.py | 2 +- bitbake/lib/toaster/toastergui/static/js/layerdetails.js | 7 +++++-- bitbake/lib/toaster/toastergui/templates/layerdetails.html | 9 ++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'bitbake/lib') diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index 149abf7a5b..3a05d66383 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py @@ -221,7 +221,7 @@ class XhrLayer(View): return JsonResponse({ "error": "ok", - "redirect": reverse('project', args=(kwargs['pid'],)) + "gotoUrl": reverse('project', args=(kwargs['pid'],)) }) diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index 8165bad5dd..4c0d0426eb 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js @@ -391,7 +391,9 @@ function layerDetailsPageInit (ctx) { }); $("#layer-delete-confirmed").click(function(){ - $.cookie("layer-deleted", ctx.layerVersion.name, { path: '/'}); + + var message = $('You have deleted 1 layer from your project: '); + message.find("#deleted-layer-name").text(ctx.layerVersion.name); $.ajax({ type: "DELETE", @@ -401,7 +403,8 @@ function layerDetailsPageInit (ctx) { if (data.error != "ok") { console.warn(data.error); } else { - window.location = data.redirect + "?notify=layer-deleted"; + libtoaster.setNotification("layer-deleted", message.html()); + window.location.replace(data.gotoUrl); } }, error: function(data) { diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index 0594b551aa..f1569bd630 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -6,14 +6,16 @@ {% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %} {% block pagecontent %} -