summaryrefslogtreecommitdiff
path: root/addons/website_quote/static/src/js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2014-08-06 16:47:11 +0200
committerChristophe Matthieu <chm@odoo.com>2014-08-07 18:39:35 +0200
commit009cc5278e2fba1e744f50674ccc898ab79d6477 (patch)
treef6a8d4e7ee080bac9d590e0cb401169cb9dd262b /addons/website_quote/static/src/js
parent2e5412fc1d63516c8b4aefcb0bacd79d85b2d498 (diff)
[FIX] website_quote: scroll spy is crazy if the user change quote template. Must remove id created by the javascript of scroll spy.
Diffstat (limited to 'addons/website_quote/static/src/js')
-rw-r--r--addons/website_quote/static/src/js/website_quotation.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/website_quote/static/src/js/website_quotation.js b/addons/website_quote/static/src/js/website_quotation.js
index 646cbe25375..1e9203b5df6 100644
--- a/addons/website_quote/static/src/js/website_quotation.js
+++ b/addons/website_quote/static/src/js/website_quotation.js
@@ -65,24 +65,26 @@ $(document).ready(function () {
});
// automatically generate a menu from h1 and h2 tag in content
- var ul = $('[data-id="quote_sidebar"]');
+ var $container = $('body[data-target=".navspy"]');
+ var ul = $('[data-id="quote_sidebar"]', $container);
var sub_li = null;
var sub_ul = null;
- $("section h1, section h2").each(function() {
+ $("[id^=quote_header_], [id^=quote_]", $container).attr("id", "");
+ $("h1, h2", $container).each(function() {
switch (this.tagName.toLowerCase()) {
case "h1":
- id = _.uniqueId('quote_header_')
+ id = _.uniqueId('quote_header_');
$(this.parentNode).attr('id',id);
sub_li = $("<li>").html('<a href="#'+id+'">'+$(this).text()+'</a>').appendTo(ul);
sub_ul = null;
break;
case "h2":
- id = _.uniqueId('quote_')
+ id = _.uniqueId('quote_');
if (sub_li) {
if (!sub_ul) {
sub_ul = $("<ul class='nav'>").appendTo(sub_li);
}
- $(this.parentNode).attr('id',id)
+ $(this.parentNode).attr('id',id);
$("<li>").html('<a href="#'+id+'">'+$(this).text()+'</a>').appendTo(sub_ul);
}
break;