[IMP] website snippet: dom_filter and remove title snippet

bzr revid: chm@openerp.com-20130917074847-oxlvppxpmbwijtmp
This commit is contained in:
Christophe Matthieu 2013-09-17 09:48:47 +02:00
parent c09e7544c3
commit f525382474
2 changed files with 19 additions and 25 deletions

View File

@ -73,17 +73,21 @@
$("body").on('DOMNodeInserted', hack_to_add_snippet_id);
},
dom_filter: function (dom) {
var sdom = dom.split(',');
var exclude = ":not(#oe_manipulators):not(#website-top-navbar)";
dom = "";
_.each(sdom, function (val) {
val = val.replace(/^\s+|\s+$/g, '');
dom += "body > " + exclude + " " + val + ", ";
val = val.split(" ");
dom += "body > "+ val.shift() + exclude + val.join(" ") + ", ";
});
dom = dom.replace(/,\s*$/g, '');
return $(dom);
if (typeof dom === "string") {
var exclude = ":not(#oe_manipulators):not(#website-top-navbar)";
var sdom = dom.split(',');
dom = "";
_.each(sdom, function (val) {
val = val.replace(/^\s+|\s+$/g, '');
dom += "body > " + exclude + " " + val + ", ";
val = val.split(" ");
dom += "body > "+ val.shift() + exclude + val.join(" ") + ", ";
});
dom = dom.replace(/,\s*$/g, '');
return $(dom);
} else {
return $(dom).parents("#oe_manipulators, #website-top-navbar").length ? $() : $(dom);
}
},
start: function() {
var self = this;

View File

@ -139,18 +139,6 @@
<div class='oe_snippet_thumbnail oe_label' style='background-image:radial-gradient(red,orange,yellow,green,blue);'>Surprise!</div>
</div>
<div t-name="website.snippets.title" data-snippet-id='title' data-category='structure' data-selector-children='.oe_structure, [data-oe-type=html]'>
<div class='oe_snippet_thumbnail oe_label'>Title</div>
<section class="oe_snippet_body container">
<div class="row">
<div class="col-md-12 text-center">
<h1>Your Great Title</h1>
<h2 class="text-muted">a slogan reinforcing the title</h2>
</div>
</div>
</section>
</div>
<div t-name="website.snippets.text-image" data-snippet-id='text-image' data-category='structure' data-selector-children='.oe_structure, [data-oe-type=html]'>
<div class='oe_snippet_thumbnail oe_label'>Text-Image</div>
<section class="oe_snippet_body dark">
@ -227,8 +215,10 @@
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb32">
<h2>OpenERP Project Management</h2>
<h3 class="text-muted">Infinitely flexible. Incredibly easy to use.</h3>
<h1>
OpenERP Project Management<br/>
<small>Infinitely flexible. Incredibly easy to use.</small>
</h1>
</div>
<div class="col-md-12 mb16 mt16">
<p>