Skip to content

Commit

Permalink
[FIX] Bundlification remains (Fixes odoo#2463)
Browse files Browse the repository at this point in the history
  • Loading branch information
amigrave committed Sep 17, 2014
1 parent 5bfad4d commit 8d08e06
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 72 deletions.
18 changes: 17 additions & 1 deletion addons/website/static/src/js/website.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -282,7 +298,7 @@

website.inject_tour = function() {
// if a tour is active inject tour js
}
};

website.dom_ready.then(function () {
/* ----- PUBLISHING STUFF ---- */
Expand Down
2 changes: 1 addition & 1 deletion addons/website_event/views/website_event.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
30 changes: 15 additions & 15 deletions addons/website_event_track/static/src/css/website_event_track.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.ribbon-wrapper {
.o_website_event .ribbon-wrapper {
width: 60px;
height: 60px;
z-index: 5;
Expand All @@ -8,7 +8,7 @@
right: 0;
}

.ribbon {
.o_website_event .ribbon {
font: bold 13px Sans-Serif;
color: #404040;
text-align: center;
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -44,51 +44,51 @@
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);
background-image: -moz-linear-gradient(top, #C2792A, #DB9141);
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;
}
17 changes: 7 additions & 10 deletions addons/website_event_track/views/website_event.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down
14 changes: 7 additions & 7 deletions addons/website_mail/static/src/js/website_email_designer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 0 additions & 3 deletions addons/website_mail/views/website_email_designer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion addons/website_mail/views/website_mail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
22 changes: 11 additions & 11 deletions addons/website_quote/static/src/css/website_quotation.css
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
.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;
font-size: 90%;
}

@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;
}
}
Expand Down
13 changes: 10 additions & 3 deletions addons/website_quote/static/src/js/website_quotation.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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_');
Expand All @@ -90,5 +96,6 @@ $(document).ready(function () {
break;
}
});

});

}());
24 changes: 11 additions & 13 deletions addons/website_quote/views/website_quotation.xml
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down
7 changes: 0 additions & 7 deletions addons/website_sale/views/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down

0 comments on commit 8d08e06

Please sign in to comment.