[FIX] website: snippet content; + add method dom_filter instead of change selector

bzr revid: chm@openerp.com-20130916122942-szdvqcg4tszrgeo3
This commit is contained in:
Christophe Matthieu 2013-09-16 14:29:42 +02:00
parent 7dfad6c3ba
commit b6022c5724
4 changed files with 16 additions and 17 deletions

View File

@ -265,7 +265,6 @@ table.editorbar-panel td.selected {
}
.oe_overlay.oe_selected, .oe_overlay.oe_active {
opacity: 1;
background: transparent;
border-style: dashed;
border-width: 1px;
box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.3), 0px 0px 0px 1px rgba(255, 255, 255, 0.3) inset;

View File

@ -230,7 +230,7 @@ table.editorbar-panel
.oe_overlay
display: block
position: absolute
background: transparent //rgba(153, 0, 255, 0.05)
background: transparent
border-radius: 3px
opacity: 0
transition: opacity 100ms linear
@ -241,7 +241,6 @@ table.editorbar-panel
cursor: pointer
&.oe_selected, &.oe_active
opacity: 1
background: transparent
border-style: dashed
border-width: 1px
box-shadow: 0px 0px 0px 1px rgba(255,255,255,0.3), 0px 0px 0px 1px rgba(255,255,255,0.3) inset

View File

@ -65,9 +65,14 @@
$("<div id='oe_manipulators'></div>").appendTo('body');
}
this.$active_snipped_id = false;
this.parent_of_editable_box = "body > :not(:has(#website-top-view)):not(#oe_manipulators):not(#oe_snippets) ";
hack_to_add_snippet_id();
},
dom_filter: function (dom) {
var $errordom = $("#oe_manipulators, #website-top-navbar");
return $(dom).filter(function () {
return $.contains($errordom, this) || $.inArray(this, $errordom);
});
},
start: function() {
var self = this;
@ -310,13 +315,13 @@
activate_insertion_zones: function(selector){
var self = this;
var child_selector = selector.childs;
var sibling_selector = selector.siblings ? this.parent_of_editable_box + (selector.siblings).split(",").join(this.parent_of_editable_box) : false;
var vertical_child_selector = selector.vertical_childs ? this.parent_of_editable_box + (selector.vertical_childs).split(",").join(this.parent_of_editable_box) : false;
var sibling_selector = selector.siblings;
var vertical_child_selector = selector.vertical_childs;
var zone_template = "<div class='oe_drop_zone oe_insert'></div>";
if(child_selector){
$(child_selector).each(function (){
self.dom_filter(child_selector).each(function (){
var $zone = $(this);
$zone.find('> *:not(.oe_drop_zone):visible').after(zone_template);
$zone.prepend(zone_template);
@ -324,7 +329,7 @@
}
if(vertical_child_selector){
$(vertical_child_selector).each(function (){
self.dom_filter(vertical_child_selector).each(function (){
var $zone = $(this);
var $template = $(zone_template).addClass("oe_vertical").css('height', $zone.outerHeight()+'px');
$zone.find('> *:not(.oe_drop_zone):visible').after($template);
@ -333,7 +338,7 @@
}
if(sibling_selector){
$(sibling_selector).each(function (){
self.dom_filter(sibling_selector).each(function (){
var $zone = $(this);
if($zone.prev('.oe_drop_zone:visible').length === 0){
$zone.before(zone_template);
@ -382,11 +387,7 @@
// generate drop zones covering the elements selected by the selector
// we generate overlay drop zones only to get an idea of where the snippet are, the drop
activate_overlay_zones: function(selector){
selector = selector || '[data-snippet-id]';
if (typeof selector === 'string')
selector = this.parent_of_editable_box + selector.split(",").join(", " + this.parent_of_editable_box);
var $targets = $(selector);
var $targets = this.dom_filter(selector || '[data-snippet-id]');
var self = this;
function is_visible($el){

View File

@ -99,7 +99,7 @@
<div class='oe_snippet_thumbnail oe_label'>Darken</div>
</div>
<div t-name="website.snippets.well" data-snippet-id='well' data-category='content' data-selector-siblings='div p h1 h2 h3 blockquote'>
<div t-name="website.snippets.well" data-snippet-id='well' data-category='content' data-selector-siblings='div, p, h1, h2, h3, blockquote'>
<div class='oe_snippet_thumbnail oe_label'>Well</div>
<div class="oe_snippet_body well">
Manage your sales funnel with no effort with OpenERP CRM. Attract
@ -108,7 +108,7 @@
</div>
</div>
<div t-name="website.snippets.quote" data-snippet-id='quote' data-category='content' data-selector-siblings='div p h1 h2 h3 blockquote'>
<div t-name="website.snippets.quote" data-snippet-id='quote' data-category='content' data-selector-siblings='div, p, h1, h2, h3, blockquote'>
<div class='oe_snippet_thumbnail oe_label'>Quote</div>
<blockquote class="oe_snippet_body">
<p>
@ -119,7 +119,7 @@
</blockquote>
</div>
<div t-name="website.snippets.panel" data-snippet-id='panel' data-category='content' data-selector-siblings='div p h1 h2 h3 blockquote'>
<div t-name="website.snippets.panel" data-snippet-id='panel' data-category='content' data-selector-siblings='div, p, h1, h2, h3, blockquote'>
<div class='oe_snippet_thumbnail oe_label'>Panel</div>
<div class="oe_snippet_body panel panel-default">
<div class="panel-heading">