summaryrefslogtreecommitdiff
path: root/addons/website_mail/static/src/js/website_email_designer.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/website_mail/static/src/js/website_email_designer.js')
-rw-r--r--addons/website_mail/static/src/js/website_email_designer.js35
1 files changed, 18 insertions, 17 deletions
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 264fe33288e..9f0692b17ce 100644
--- a/addons/website_mail/static/src/js/website_email_designer.js
+++ b/addons/website_mail/static/src/js/website_email_designer.js
@@ -1,25 +1,26 @@
-$(function () {
+(function () {
'use strict';
- if ($("#email_designer").length) {
- openerp.website.snippet.BuildingBlock.include({
+ var website = openerp.website;
+
+ 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) {
- $('#email_designer').show();
- $('#email_template').hide();
- $(".js_content", $(this).parent()).children().clone().appendTo('#email_body');
- $(".js_content", $(this).parent()).children().clone().appendTo('#email_body_html');
- $('#email_body').addClass('oe_dirty');
- $('#email_body_html').addClass('oe_dirty');
+ $('.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');
+ $(".js_content", $(this).parent()).children().clone().appendTo('#email_body_html');
+ $('#email_body').addClass('oe_dirty');
+ $('#email_body_html').addClass('oe_dirty');
- openerp.website.editor_bar.edit();
- event.preventDefault();
- });
+ openerp.website.editor_bar.edit();
+ event.preventDefault();
});
- }
-});
+ });
+
+})();