[oe-commits] [bitbake] 10/15: toaster: layerdetails Update implementation of delete imported layer

git at git.openembedded.org git at git.openembedded.org
Wed Sep 28 14:05:05 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 0b8d3ac48b5a0984963d664ff5630e3b02c4ecd1
Author: Michael Wood <michael.g.wood at intel.com>
AuthorDate: Mon Sep 26 13:59:37 2016 +0300

    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.
    
    Signed-off-by: Michael Wood <michael.g.wood at intel.com>
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/toastergui/api.py                      | 2 +-
 lib/toaster/toastergui/static/js/layerdetails.js   | 7 +++++--
 lib/toaster/toastergui/templates/layerdetails.html | 9 ++++++---
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/toaster/toastergui/api.py b/lib/toaster/toastergui/api.py
index 149abf7..3a05d66 100644
--- a/lib/toaster/toastergui/api.py
+++ b/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/lib/toaster/toastergui/static/js/layerdetails.js b/lib/toaster/toastergui/static/js/layerdetails.js
index 8165bad..4c0d042 100644
--- a/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/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 = $('<span>You have deleted <strong>1</strong> layer from your project: <strong id="deleted-layer-name"></strong>');
+    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/lib/toaster/toastergui/templates/layerdetails.html b/lib/toaster/toastergui/templates/layerdetails.html
index 0594b55..f1569bd 100644
--- a/lib/toaster/toastergui/templates/layerdetails.html
+++ b/lib/toaster/toastergui/templates/layerdetails.html
@@ -6,14 +6,16 @@
 {% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %}
 {% block pagecontent %}
 
-<div id="delete-layer-modal" class="modal fade" tabindex="-1" role="dialog">
+<div id="delete-layer-modal" class="modal fade" tabindex="-1" role="dialog"
+    data-keyboard="false" data-backdrop="static">
   <div class="modal-dialog" role="document">
     <div class="modal-content">
       <div class="modal-body">
 		  Are you sure you want to delete the <strong>{{layerversion.layer.name}}</strong> layer?
       </div>
       <div class="modal-footer">
-        <button type="button" id="layer-delete-confirmed" class="btn btn-primary">Delete</button>
+        <button type="button" id="layer-delete-confirmed" class="btn
+            btn-primary">Delete layer</button>
         <button type="button" class="btn btn-default btn-link" data-dismiss="modal">Cancel</button>
       </div>
     </div>
@@ -358,7 +360,8 @@
           {# Only show delete link for imported layers #}
           {% if layerversion.layer_source == layer_source.TYPE_IMPORTED %}
           <i class="icon-trash text-danger"></i>
-          <a href="#delete-layer-modal"  role="button" class="text-danger" data-toggle="modal" data-target="#delete-layer-modal">Delete {{layerversion.layer.name}}</a>
+          <a href="#delete-layer-modal"  role="button" class="text-danger"
+              data-toggle="modal" data-target="#delete-layer-modal">Delete layer</a>
           {% endif %}
         </div>
       </div>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list