[bitbake-devel] [PATCH 10/10] toaster: layerdetails Update implementation of delete imported layer
Ed Bartosh
ed.bartosh at linux.intel.com
Mon Sep 26 10:59:37 UTC 2016
From: Michael Wood <michael.g.wood at intel.com>
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>
---
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>
--
2.6.6
More information about the bitbake-devel
mailing list