[IMP] website snippet: add alert for drop error

bzr revid: chm@openerp.com-20130919135001-cfrzyq69ewftu16s
This commit is contained in:
Christophe Matthieu
2013-09-19 15:50:01 +02:00
parent b8086bc9a6
commit 20b391d6c8
4 changed files with 43 additions and 1 deletions
+9
View File
@@ -140,6 +140,15 @@ table.editorbar-panel td.selected {
}
/* ---- SNIPPET EDITOR ---- */
#oe_droperror .modal-header {
border-bottom: 0;
}
#oe_droperror .modal-footer {
border-top: 0;
margin: 0;
padding: 0;
}
#oe_snippets {
position: fixed;
left: 0px;
@@ -129,6 +129,13 @@ table.editorbar-panel
/* ---- SNIPPET EDITOR ---- */
#oe_droperror
.modal-header
border-bottom: 0
.modal-footer
border-top: 0
margin: 0
padding: 0
#oe_snippets
position: fixed
@@ -118,6 +118,9 @@
this.scrollspy();
this.$el.addClass("hidden");
this.$modal = $(openerp.qweb.render('website.snippets_modal'));
this.$modal.appendTo("body");
},
fetch_snippet_templates: function () {
var self = this;
@@ -291,6 +294,7 @@
var self = this;
var $toInsert = false;
var $tumb = $snippet.find(".oe_snippet_thumbnail");
var dropped = false;
$snippet.draggable({
helper: 'clone',
@@ -304,7 +308,7 @@
},
start: function(){
self.hide();
dropped = false;
var snipped_id = $snippet.data('snippet-id');
var action = $snippet.find('.oe_snippet_body').size() ? 'insert' : 'mutate';
if( action === 'insert'){
@@ -361,6 +365,8 @@
return false;
}
dropped = true;
var $target = false;
if(action === 'insert'){
$target = $toInsert;
@@ -390,6 +396,10 @@
},
stop: function(){
$('.oe_drop_zone').droppable('destroy').remove();
if (!dropped) {
self.$modal.modal('toggle');
setTimeout(function () {self.$modal.fadeOut();}, 3000);
}
},
});
},
@@ -15,6 +15,22 @@
</div>
</li>
</t>
<t t-name="website.snippets_modal">
<div class="modal" id="oe_droperror" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&amp;times;</button>
<h4 class="modal-title">
Nothing Added<br/>
<small>Please drop in a valid zone</small>
</h4>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
</t>
<t t-name="website.snippets">
<div id='oe_snippets'>