diff options
| author | Fabien Meghazi <fme@openerp.com> | 2014-09-17 10:03:33 +0200 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2014-09-17 14:50:12 +0200 |
| commit | 8d08e067584587e9cd06a738258f2771534d6000 (patch) | |
| tree | 320536040c08b5f2cb949bc4250446c7712d861d | |
| parent | 5bfad4dd52cc96ff6a290a69b5f85d7d48ef6c8f (diff) | |
[FIX] Bundlification remains (Fixes #2463)
| -rw-r--r-- | addons/website/static/src/js/website.js | 18 | ||||
| -rw-r--r-- | addons/website_event/views/website_event.xml | 2 | ||||
| -rw-r--r-- | addons/website_event_track/static/src/css/website_event_track.css | 30 | ||||
| -rw-r--r-- | addons/website_event_track/views/website_event.xml | 17 | ||||
| -rw-r--r-- | addons/website_mail/static/src/js/website_email_designer.js | 14 | ||||
| -rw-r--r-- | addons/website_mail/views/website_email_designer.xml | 3 | ||||
| -rw-r--r-- | addons/website_mail/views/website_mail.xml | 8 | ||||
| -rw-r--r-- | addons/website_quote/static/src/css/website_quotation.css | 22 | ||||
| -rw-r--r-- | addons/website_quote/static/src/js/website_quotation.js | 13 | ||||
| -rw-r--r-- | addons/website_quote/views/website_quotation.xml | 24 | ||||
| -rw-r--r-- | addons/website_sale/views/templates.xml | 7 |
11 files changed, 86 insertions, 72 deletions
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index f6185201035..76756c08e47 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -255,6 +255,22 @@ if($.fn.placeholder) $('input, textarea').placeholder(); }); + /** + * Execute a function if the dom contains at least one element matched + * through the given jQuery selector. Will first wait for the dom to be ready. + * + * @param {String} selector A jQuery selector used to match the element(s) + * @param {Function} fn Callback to execute if at least one element has been matched + */ + website.if_dom_contains = function(selector, fn) { + website.dom_ready.then(function () { + var elems = $(selector); + if (elems.length) { + fn(elems); + } + }); + }; + var all_ready = null; /** * Returns a deferred resolved when the templates are loaded @@ -282,7 +298,7 @@ website.inject_tour = function() { // if a tour is active inject tour js - } + }; website.dom_ready.then(function () { /* ----- PUBLISHING STUFF ---- */ diff --git a/addons/website_event/views/website_event.xml b/addons/website_event/views/website_event.xml index bdc92cdd69e..74846554ff3 100644 --- a/addons/website_event/views/website_event.xml +++ b/addons/website_event/views/website_event.xml @@ -197,7 +197,7 @@ <template id="layout"> <t t-call="website.layout"> - <div id="wrap" class="js_event"> + <div id="wrap" class="js_event o_website_event"> <div class="container"> <div class="row mt8"> <div class="col-sm-7" id="event_menu"> diff --git a/addons/website_event_track/static/src/css/website_event_track.css b/addons/website_event_track/static/src/css/website_event_track.css index f6c01f8f19e..b61f790a550 100644 --- a/addons/website_event_track/static/src/css/website_event_track.css +++ b/addons/website_event_track/static/src/css/website_event_track.css @@ -1,4 +1,4 @@ -.ribbon-wrapper { +.o_website_event .ribbon-wrapper { width: 60px; height: 60px; z-index: 5; @@ -8,7 +8,7 @@ right: 0; } -.ribbon { +.o_website_event .ribbon { font: bold 13px Sans-Serif; color: #404040; text-align: center; @@ -26,7 +26,7 @@ box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3); } -.ribbon.ribbon_Gold { +.o_website_event .ribbon.ribbon_Gold { background-color: #FDE21B; background-image: -webkit-gradient(linear, left top, left bottom, from(#E9CE0C), to(#FDE21B)); background-image: -webkit-linear-gradient(top, #E9CE0C, #FDE21B); @@ -35,7 +35,7 @@ background-image: -o-linear-gradient(top, #E9CE0C, #FDE21B); } -.ribbon.ribbon_Silver { +.o_website_event .ribbon.ribbon_Silver { background-color: #CCCCCC; background-image: -webkit-gradient(linear, left top, left bottom, from(#BBBBBB), to(#CCCCCC)); background-image: -webkit-linear-gradient(top, #BBBBBB, #CCCCCC); @@ -44,7 +44,7 @@ background-image: -o-linear-gradient(top, #BBBBBB, #CCCCCC); } -.ribbon.ribbon_Bronze { +.o_website_event .ribbon.ribbon_Bronze { background-color: #DB9141; background-image: -webkit-gradient(linear, left top, left bottom, from(#C2792A), to(#DB9141)); background-image: -webkit-linear-gradient(top, #C2792A, #DB9141); @@ -52,43 +52,43 @@ background-image: -ms-linear-gradient(top, #C2792A, #DB9141); background-image: -o-linear-gradient(top, #C2792A, #DB9141); } -.event_color_0 { +.o_website_event .event_color_0 { background-color: white; color: #5a5a5a; } -.event_color_1 { +.o_website_event .event_color_1 { background-color: #cccccc; color: #424242; } -.event_color_2 { +.o_website_event .event_color_2 { background-color: #ffc7c7; color: #7a3737; } -.event_color_3 { +.o_website_event .event_color_3 { background-color: #fff1c7; color: #756832; } -.event_color_4 { +.o_website_event .event_color_4 { background-color: #e3ffc7; color: #5d6937; } -.event_color_5 { +.o_website_event .event_color_5 { background-color: #c7ffd5; color: #1a7759; } -.event_color_6 { +.o_website_event .event_color_6 { background-color: #c7ffff; color: #1a5d83; } -.event_color_7 { +.o_website_event .event_color_7 { background-color: #c7d5ff; color: #3b3e75; } -.event_color_8 { +.o_website_event .event_color_8 { background-color: #e3c7ff; color: #4c3668; } -.event_color_9 { +.o_website_event .event_color_9 { background-color: #ffc7f1; color: #6d2c70; } diff --git a/addons/website_event_track/views/website_event.xml b/addons/website_event_track/views/website_event.xml index 597710c90ca..c1f3f9407b7 100644 --- a/addons/website_event_track/views/website_event.xml +++ b/addons/website_event_track/views/website_event.xml @@ -2,13 +2,14 @@ <openerp> <data> -<template name="Sponsors" id="event_sponsor" customize_show="True" inherit_id="website_event.layout"> - <xpath expr="//t[@t-call='website.layout']" position="inside"> - <t t-set="head"> - <link rel='stylesheet' href='/website_event_track/static/src/css/website_event_track.css'/> - <t t-raw="head or ''"/> - </t> +<template id="assets_frontend" inherit_id="website.assets_frontend" name="Event track front end"> + <xpath expr="." position="inside"> + <link rel="stylesheet" href="/website_event_track/static/src/css/website_event_track.css"/> + <script type="text/javascript" src="/website_event_track/static/src/js/website_event_track.js"></script> </xpath> +</template> + +<template name="Sponsors" id="event_sponsor" customize_show="True" inherit_id="website_event.layout"> <xpath expr="//div[@id='wrap']" position="inside"> <div class="container mt32 mb16 hidden-print" t-if="event.sponsor_ids"> <section data-snippet-id="title"> @@ -42,10 +43,6 @@ <template id="agenda"> <t t-call="website_event.layout"> - <t t-set="head"> - <script type="text/javascript" src="/website_event_track/static/src/js/website_event_track.js"></script> - <t t-raw="head or ''"/> - </t> <section class="container"> <h1 class="text-center" t-field="event.name"/> <div class="form-inline pull-right"> diff --git a/addons/website_mail/static/src/js/website_email_designer.js b/addons/website_mail/static/src/js/website_email_designer.js index 1ea39ae657c..9f0692b17ce 100644 --- a/addons/website_mail/static/src/js/website_email_designer.js +++ b/addons/website_mail/static/src/js/website_email_designer.js @@ -2,15 +2,15 @@ 'use strict'; var website = openerp.website; - website.snippet.BuildingBlock.include({ - _get_snippet_url: function () { - return '/website_mail/snippets'; - } - }); + website.if_dom_contains('#email_designer', function () { + website.snippet.BuildingBlock.include({ + _get_snippet_url: function () { + return '/website_mail/snippets'; + } + }); - // Copy the template to the body of the email - $(document).ready(function () { $('.js_template_set').click(function(ev) { + // Copy the template to the body of the email $('#email_designer').show(); $('#email_template').hide(); $(".js_content", $(this).parent()).children().clone().appendTo('#email_body'); diff --git a/addons/website_mail/views/website_email_designer.xml b/addons/website_mail/views/website_email_designer.xml index 31df858d50b..470e0f1f583 100644 --- a/addons/website_mail/views/website_email_designer.xml +++ b/addons/website_mail/views/website_email_designer.xml @@ -5,9 +5,6 @@ <!-- Template Choice page --> <template id="email_designer" name="Email Designer"> <t t-call="website.layout"> - <t t-set="head"> - <script type="text/javascript" src="/website_mail/static/src/js/website_email_designer.js"></script> - </t> <div id="wrap" class="container" t-ignore="True"> <div id="email_template" class="mb32" t-att-style="mode != 'email_template' and 'display: none' or ''"> <a class="mt16 btn btn-default pull-right" diff --git a/addons/website_mail/views/website_mail.xml b/addons/website_mail/views/website_mail.xml index 2b810095231..23939268019 100644 --- a/addons/website_mail/views/website_mail.xml +++ b/addons/website_mail/views/website_mail.xml @@ -21,11 +21,17 @@ </template> <template id="head" inherit_id="website.assets_frontend" name="Mail customization"> - <xpath expr="/t" position="inside"> + <xpath expr="." position="inside"> <script type="text/javascript" src="/website_mail/static/src/js/follow.js"></script> <link rel='stylesheet' href='/website_mail/static/src/css/website_mail.css'/> </xpath> </template> +<template id="editor" inherit_id="website.assets_editor" name="Editor assets for Mail customization"> + <xpath expr="." position="inside"> + <script type="text/javascript" src="/website_mail/static/src/js/website_email_designer.js"></script> + </xpath> +</template> + </data> </openerp> diff --git a/addons/website_quote/static/src/css/website_quotation.css b/addons/website_quote/static/src/css/website_quotation.css index ecf67140b40..28bcf38efc1 100644 --- a/addons/website_quote/static/src/css/website_quotation.css +++ b/addons/website_quote/static/src/css/website_quotation.css @@ -1,35 +1,35 @@ -.bs-sidebar { +.o_website_quote .bs-sidebar { position: fixed; z-index : 1; background-color: #f7f5fa; border-radius: 5px; } -.bs-sidenav { +.o_website_quote .bs-sidenav { padding-top: 10px; padding-bottom: 10px; } -.bs-sidebar .nav > li > a { +.o_website_quote .bs-sidebar .nav > li > a { display: block; color: #716b7a; padding: 5px 20px; } -.bs-sidebar .nav > .active > a, -.bs-sidebar .nav > .active:hover > a, -.bs-sidebar .nav > .active:focus > a { +.o_website_quote .bs-sidebar .nav > .active > a, +.o_website_quote .bs-sidebar .nav > .active:hover > a, +.o_website_quote .bs-sidebar .nav > .active:focus > a { font-weight: bold; color: #563d7c; background-color: transparent; border-right: 1px solid #563d7c; } -.bs-sidebar .nav .nav { +.o_website_quote .bs-sidebar .nav .nav { display: none; margin-bottom: 8px; } -.bs-sidebar .nav .nav > li > a { +.o_website_quote .bs-sidebar .nav .nav > li > a { padding-top: 3px; padding-bottom: 3px; padding-left: 30px; @@ -37,15 +37,15 @@ } @media (min-width: 992px) { - .bs-sidebar .nav > .active > ul { + .o_website_quote .bs-sidebar .nav > .active > ul { display: block; } - .bs-sidebar { + .o_website_quote .bs-sidebar { width: 213px; } } @media (min-width: 1200px) { - .bs-sidebar { + .o_website_quote .bs-sidebar { width: 263px; } } diff --git a/addons/website_quote/static/src/js/website_quotation.js b/addons/website_quote/static/src/js/website_quotation.js index 1e9203b5df6..37f5e2a9a62 100644 --- a/addons/website_quote/static/src/js/website_quotation.js +++ b/addons/website_quote/static/src/js/website_quotation.js @@ -1,4 +1,9 @@ -$(document).ready(function () { +(function () { +'use strict'; +var website = openerp.website; + +website.if_dom_contains('div.o_website_quote', function () { + $('a.js_update_line_json').on('click', function (ev) { ev.preventDefault(); var $link = $(ev.currentTarget); @@ -61,7 +66,7 @@ $(document).ready(function () { $('#modelaccept').modal('hide'); window.location.href = '/quote/'+order_id[1]+'/'+token+'?message=3'; }); - return false + return false; }); // automatically generate a menu from h1 and h2 tag in content @@ -71,6 +76,7 @@ $(document).ready(function () { var sub_ul = null; $("[id^=quote_header_], [id^=quote_]", $container).attr("id", ""); $("h1, h2", $container).each(function() { + var id; switch (this.tagName.toLowerCase()) { case "h1": id = _.uniqueId('quote_header_'); @@ -90,5 +96,6 @@ $(document).ready(function () { break; } }); - }); + +}()); diff --git a/addons/website_quote/views/website_quotation.xml b/addons/website_quote/views/website_quotation.xml index 44c90921bf9..7098289f2cc 100644 --- a/addons/website_quote/views/website_quotation.xml +++ b/addons/website_quote/views/website_quotation.xml @@ -1,6 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> + + <template id="assets_frontend" inherit_id="website.assets_frontend" name="Website Quote frontend assets"> + <xpath expr="." position="inside"> + <script type="text/javascript" src="/website_quote/static/src/js/website_quotation.js"></script> + <script type="text/javascript" src="/website_quote/static/lib/jSignature/jSignature.min.js"></script> + <link rel='stylesheet' href='/website_quote/static/src/css/website_quotation.css'/> + </xpath> + </template> + <template id="pricing" name="Price"> <section data-snippet-id="title"> <h1 class="page-header">Pricing</h1> @@ -161,14 +170,8 @@ <template id="so_quotation" name="Product Quotation"> <t t-call="website.layout"> - <t t-set="head"> - <script type="text/javascript" src="/website_quote/static/src/js/website_quotation.js"></script> - <script type="text/javascript" src="/website_quote/static/lib/jSignature/jSignature.min.js"></script> - <link rel='stylesheet' href='/website_quote/static/src/css/website_quotation.css'/> - <t t-raw="head or ''"/> - </t> <body data-spy="scroll" data-target=".navspy" data-offset="50"> - <div class="container"> + <div class="container o_website_quote"> <div class="row mt16"> <div class="col-md-3"> <div class="bs-sidebar"> @@ -457,13 +460,8 @@ <template id="so_template" name="SO Template"> <t t-call="website.layout"> - <t t-set="head"> - <script type="text/javascript" src="/website_quote/static/src/js/website_quotation.js"></script> - <link rel='stylesheet' href='/website_quote/static/src/css/website_quotation.css'/> - <t t-raw="head or ''"/> - </t> <body data-spy="scroll" data-target=".navspy" data-offset="50"> - <div class="container"> + <div class="container o_website_quote"> <div class="row mt16"> <div class="col-md-3"> <div class="bs-sidebar"> diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index ba56b973538..864f62410ca 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -124,13 +124,6 @@ <template id="products" name="Products"> <t t-call="website.layout"> - <!--t t-set="head"> - <t t-call="web.jqueryui_conflict"> - <script type="text/javascript" src="/web/static/lib/jquery.ui/js/jquery-ui-1.9.1.custom.js"></script> - </t> - <link rel='stylesheet' href="/web/static/lib/jquery.ui/css/smoothness/jquery-ui-1.9.1.custom.css"/> - <t t-raw="head or ''"/> - </t--> <t t-set="additional_title">Shop</t> <div id="wrap" class="js_sale"> <div class="oe_structure"/> |
