From 9178dcd3f618dc770736778ee010b0e44190b6af Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 17 Sep 2014 13:22:44 +0200 Subject: [PATCH 1/4] [FIX] website_mail & calendar: demo data break the layout of mail design --- addons/calendar/calendar_data.xml | 662 ++++++++++++++---------------- 1 file changed, 319 insertions(+), 343 deletions(-) diff --git a/addons/calendar/calendar_data.xml b/addons/calendar/calendar_data.xml index e13edaf6312..47568f6ab31 100644 --- a/addons/calendar/calendar_data.xml +++ b/addons/calendar/calendar_data.xml @@ -103,122 +103,114 @@ - - - ${object.event_id.name} - - - -
-
- ${object.event_id.name} -
-
- Dear ${object.cn} ,

${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.

-
-
- - - - + +
-
${object.event_id.get_interval(object.event_id.start, 'dayname')}
-
- ${object.event_id.get_interval(object.event_id.start,'day')} -
-
${object.event_id.get_interval(object.event_id.start, 'month')}
-
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
-
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
- % if object.event_id.location: -
- Where -
- % endif -
- % if object.event_id.location: -
- : ${object.event_id.location} - (View Map) - -
- % endif -
- % if object.event_id.description : -
- What -
- % endif -
- % if object.event_id.description : -
- : ${object.event_id.description} -
- % endif -
- % if not object.event_id.allday and object.event_id.duration: -
- Duration -
- % endif -
- % if not object.event_id.allday and object.event_id.duration: -
- : ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))} -
- % endif -
-
- Attendees + +
+
+ ${object.event_id.name} +
+
+ Dear ${object.cn} ,

${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.

+
+
+ + + + - -
+
${object.event_id.get_interval(object.event_id.start, 'dayname')}
+
+ ${object.event_id.get_interval(object.event_id.start,'day')} +
+
${object.event_id.get_interval(object.event_id.start, 'month')}
+
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
+
+ + + - - -
+ % if object.event_id.location: +
+ Where
-
- : - % for attendee in object.event_id.attendee_ids: -
- % if attendee.cn != object.cn: - ${attendee.cn} - % else: - You - % endif - % endfor -
-
-
-
- Accept - Decline - View -
-
- - + % endif +
+ % if object.event_id.location: +
+ : ${object.event_id.location} + (View Map) + +
+ % endif +
+ % if object.event_id.description : +
+ What +
+ % endif +
+ % if object.event_id.description : +
+ : ${object.event_id.description} +
+ % endif +
+ % if not object.event_id.allday and object.event_id.duration: +
+ Duration +
+ % endif +
+ % if not object.event_id.allday and object.event_id.duration: +
+ : ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))} +
+ % endif +
+
+ Attendees +
+
+ : + % for attendee in object.event_id.attendee_ids: +
+ % if attendee.cn != object.cn: + ${attendee.cn} + % else: + You + % endif + % endfor +
+
+
+
+ Accept + Decline + View +
+
]]>
@@ -234,124 +226,116 @@ - - - ${object.event_id.name} - - - -
-
- ${object.event_id.name} -
-
- Dear ${object.cn} ,
-

The date of the meeting has been changed...
- The meeting created by ${object.event_id.user_id.partner_id.name} is now scheduled for : ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.

-
-
- - - - + +
-
${object.event_id.get_interval(object.event_id.start, 'dayname')}
-
- ${object.event_id.get_interval(object.event_id.start,'day')} -
-
${object.event_id.get_interval(object.event_id.start, 'month')}
-
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
-
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
- % if object.event_id.location: -
- Where -
- % endif -
- % if object.event_id.location: -
- : ${object.event_id.location} - (View Map) - -
- % endif -
- % if object.event_id.description : -
- What -
- % endif -
- % if object.event_id.description : -
- : ${object.event_id.description} -
- % endif -
- % if not object.event_id.allday and object.event_id.duration: -
- Duration -
- % endif -
- % if not object.event_id.allday and object.event_id.duration: -
- : ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))} -
- % endif -
-
- Attendees + +
+
+ ${object.event_id.name} +
+
+ Dear ${object.cn} ,
+

The date of the meeting has been changed...
+ The meeting created by ${object.event_id.user_id.partner_id.name} is now scheduled for : ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.

+
+
+ + + + - -
+
${object.event_id.get_interval(object.event_id.start, 'dayname')}
+
+ ${object.event_id.get_interval(object.event_id.start,'day')} +
+
${object.event_id.get_interval(object.event_id.start, 'month')}
+
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
+
+ + + - - -
+ % if object.event_id.location: +
+ Where
-
- : - % for attendee in object.event_id.attendee_ids: -
- % if attendee.cn != object.cn: - ${attendee.cn} - % else: - You - % endif - % endfor -
-
-
-
- Accept - Decline - View -
-
- - + % endif +
+ % if object.event_id.location: +
+ : ${object.event_id.location} + (View Map) + +
+ % endif +
+ % if object.event_id.description : +
+ What +
+ % endif +
+ % if object.event_id.description : +
+ : ${object.event_id.description} +
+ % endif +
+ % if not object.event_id.allday and object.event_id.duration: +
+ Duration +
+ % endif +
+ % if not object.event_id.allday and object.event_id.duration: +
+ : ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))} +
+ % endif +
+
+ Attendees +
+
+ : + % for attendee in object.event_id.attendee_ids: +
+ % if attendee.cn != object.cn: + ${attendee.cn} + % else: + You + % endif + % endfor +
+
+
+
+ Accept + Decline + View +
+
]]>
@@ -367,118 +351,110 @@ - - - ${object.event_id.name} - - - -
-
- ${object.event_id.name} -
-
- Dear ${object.cn} ,
-

That is a reminder for the event below :

-
-
- - - - + +
-
${object.event_id.get_interval(object.event_id.start, 'dayname')}
-
- ${object.event_id.get_interval(object.event_id.start,'day')} -
-
${object.event_id.get_interval(object.event_id.start, 'month')}
-
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
-
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
- % if object.event_id.location: -
- Where -
- % endif -
- % if object.event_id.location: -
- : ${object.event_id.location} - (View Map) - -
- % endif -
- % if object.event_id.description : -
- What -
- % endif -
- % if object.event_id.description : -
- : ${object.event_id.description} -
- % endif -
- % if not object.event_id.allday and object.event_id.duration: -
- Duration -
- % endif -
- % if not object.event_id.allday and object.event_id.duration: -
- : ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))} -
- % endif -
-
- Attendees + +
+
+ ${object.event_id.name} +
+
+ Dear ${object.cn} ,
+

That is a reminder for the event below :

+
+
+ + + + - -
+
${object.event_id.get_interval(object.event_id.start, 'dayname')}
+
+ ${object.event_id.get_interval(object.event_id.start,'day')} +
+
${object.event_id.get_interval(object.event_id.start, 'month')}
+
${not object.event_id.allday and object.event_id.get_interval(object.event_id.start, 'time', tz=object.partner_id.tz) or ''}
+
+ + + - - -
+ % if object.event_id.location: +
+ Where
-
- : - % for attendee in object.event_id.attendee_ids: -
- % if attendee.cn != object.cn: - ${attendee.cn} - % else: - You - % endif - % endfor -
-
-
-
- - + % endif +
+ % if object.event_id.location: +
+ : ${object.event_id.location} + (View Map) + +
+ % endif +
+ % if object.event_id.description : +
+ What +
+ % endif +
+ % if object.event_id.description : +
+ : ${object.event_id.description} +
+ % endif +
+ % if not object.event_id.allday and object.event_id.duration: +
+ Duration +
+ % endif +
+ % if not object.event_id.allday and object.event_id.duration: +
+ : ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))} +
+ % endif +
+
+ Attendees +
+
+ : + % for attendee in object.event_id.attendee_ids: +
+ % if attendee.cn != object.cn: + ${attendee.cn} + % else: + You + % endif + % endfor +
+
+
+
]]>
From 1f964d2693f4f1d775a9631f122e5bc3a9eb19ca Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 17 Sep 2014 11:59:26 +0200 Subject: [PATCH 2/4] [FIX] website_mail: can't be edit the mail template, javascript must be added into the asset --- .../static/src/js/website_email_designer.js | 45 +++++++++---------- addons/website_mail/views/snippets.xml | 4 +- .../views/website_email_designer.xml | 9 ++-- 3 files changed, 30 insertions(+), 28 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 1ea39ae657c..264fe33288e 100644 --- a/addons/website_mail/static/src/js/website_email_designer.js +++ b/addons/website_mail/static/src/js/website_email_designer.js @@ -1,26 +1,25 @@ -(function () { +$(function () { 'use strict'; - var website = openerp.website; - - 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'); - - openerp.website.editor_bar.edit(); - event.preventDefault(); + if ($("#email_designer").length) { + openerp.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'); + + openerp.website.editor_bar.edit(); + event.preventDefault(); + }); + }); + } +}); diff --git a/addons/website_mail/views/snippets.xml b/addons/website_mail/views/snippets.xml index 12892f50434..c8b51930e42 100644 --- a/addons/website_mail/views/snippets.xml +++ b/addons/website_mail/views/snippets.xml @@ -10,7 +10,7 @@
-
+
@@ -259,7 +259,7 @@
-
+
diff --git a/addons/website_mail/views/website_email_designer.xml b/addons/website_mail/views/website_email_designer.xml index 31df858d50b..1a0969d54f7 100644 --- a/addons/website_mail/views/website_email_designer.xml +++ b/addons/website_mail/views/website_email_designer.xml @@ -2,12 +2,15 @@ + +