[FIX] im_chat : momentjs undefined on external pages. Temporary fix by replacing...
authorJérome Maes <jem@openerp.com>
Tue, 18 Nov 2014 10:35:28 +0000 (11:35 +0100)
committerJérome Maes <jem@openerp.com>
Tue, 18 Nov 2014 10:35:28 +0000 (11:35 +0100)
addons/im_chat/static/src/js/im_chat.js
addons/im_chat/static/src/xml/im_chat.xml

index dd7d92a..78ed677 100644 (file)
                 }
             });
             // render and set the content of the chatview
+            // TODO jem : when refactoring this, don't forget to pre-process date in this function before render quweb template
+            // since, moment will not be define in qweb on the website pages, because the helper (see csn) is in core.js and cannot be
+            // imported in the frontend.
             this.$('.oe_im_chatview_content_bubbles').html($(openerp.qweb.render("im_chat.Conversation_content", {"list": res})));
             this._go_bottom();
         },
index aa19b72..cc94f58 100644 (file)
@@ -29,7 +29,7 @@
 <t t-name="im_chat.Conversation_content">
     <t t-foreach="_.keys(list)" t-as="date">
         <div class="oe_im_chatview_date_separator">
-            <t t-esc="moment(date).format('LL')"/>
+            <t t-esc="window.moment(date).format('LL')"/>
         </div>
         <t t-foreach="list[date]" t-as="bubble">
             <t t-if="bubble[0].type === 'message'">
@@ -56,7 +56,7 @@
                 <div class="oe_im_chatview_bubble_item"><t t-raw="m.message"/></div>
             </t>
         </div>
-        <div class="oe_im_chatview_time"><t t-esc="moment((_.last(messages).create_date)).format('LT')"/></div>
+        <div class="oe_im_chatview_time"><t t-esc="window.moment((_.last(messages).create_date)).format('LT')"/></div>
     </div>
 </t>
 <t t-name="im_chat.Conversation_technical_bubble">
@@ -67,7 +67,7 @@
                 <div><t t-raw="m.message"/></div>
             </t>
         </div>
-        <div class="oe_im_chatview_time"><t t-esc="moment((_.last(messages).create_date)).format('LT')"/></div>
+        <div class="oe_im_chatview_time"><t t-esc="window.moment((_.last(messages).create_date)).format('LT')"/></div>
     </div>
 </t>