[IMP] mail.compose.message widget: first integration in chatter.
authorThibault Delavallée <tde@openerp.com>
Mon, 18 Jun 2012 15:06:08 +0000 (17:06 +0200)
committerThibault Delavallée <tde@openerp.com>
Mon, 18 Jun 2012 15:06:08 +0000 (17:06 +0200)
bzr revid: tde@openerp.com-20120618150608-0go3xc0l3yil14ps

addons/mail/static/src/js/mail.js
addons/mail/static/src/xml/mail.xml
addons/mail/wizard/mail_compose_message_view.xml

index ba5315e..895499a 100644 (file)
@@ -43,6 +43,8 @@ openerp.mail = function(session) {
         
         init: function(parent, params) {
             this._super(parent);
+            this.params = params || {};
+            this.params.extended_mode = params.extended_mode || false;
             this.ds_compose = new session.web.DataSetSearch(this, 'mail.compose.message');
             this.form_view = new session.web.FormView(this, this.ds_compose, false, {
                 action_buttons: false,
@@ -59,7 +61,9 @@ openerp.mail = function(session) {
         start: function(parent, params) {
             var self = this;
             this._super.apply(this, arguments);
-            var main_node = this.$element;
+            console.log(this.$element);
+            var main_node = this.$element.find('div.oe_mail_msg_content');
+            console.log(main_node);
             
             return $.when(this.form_view.appendTo(main_node)).pipe(function() {
                 self.bind_events();
@@ -76,9 +80,11 @@ openerp.mail = function(session) {
             // advanced options for writing a message
             this.$element.find('a.mail_compose_message_toggle').click(function (event) {
                 event.preventDefault();
-                self.$element.find('span.mail_compose_message_subject').toggle();
-                self.$element.find('div.mail_compose_message_body_html').toggle();
-                self.$element.find('div.mail_compose_message_partner_ids').toggle();
+                self.$element.find('span.oe_mail_compose_message_subject').toggleClass('oe_mail_compose_message_invisible');
+                self.$element.find('div.oe_mail_compose_message_body_text').toggleClass('oe_mail_compose_message_invisible');
+                self.$element.find('div.oe_mail_compose_message_body_html').toggleClass('oe_mail_compose_message_invisible');
+                self.$element.find('div.oe_mail_compose_message_partner_ids').toggleClass('oe_mail_compose_message_invisible');
+                
             });
         },
         
@@ -167,7 +173,7 @@ openerp.mail = function(session) {
             $.when(display_done).then(this.proxy('do_customize_display'));
             
             // add message composition form view
-            this.compose_message = new mail.ComposeMessage();
+            this.compose_message = new mail.ComposeMessage(this, {'extended_mode': false});
             var compose_done = this.compose_message.appendTo(this.$element.find('div.oe_mail_thread_act'));
             
             return display_done && compose_done;
index b0fa456..8f4a74e 100644 (file)
         an e-mail.
         -->
     <t t-name="mail.compose_message">
-        <div class="oe_mail_compose_message">
-            <!-- contains the composition form -->
+        <div>
+            <img class="oe_mail_msg_image oe_left" alt="User img"/>
+            <div class="oe_mail_msg_content">
+                <!-- contains the composition form -->
+            </div>
+            <div class="oe_clear"/>
         </div>
-        <div class="oe_clear"/>
     </t>
 
     <ul t-name="Thread" class="oe_mail oe_mail_thread">
         <div class="oe_mail_thread_act">
+<!--
             <img class="oe_mail_msg_image oe_left" alt="User img"/>
             <div class="oe_mail_msg_content">
                 <textarea class="oe_mail oe_mail_action_textarea" placeholder="Add your comment here..." onfocus="this.value = '';"/>
@@ -83,6 +87,7 @@
             <a href="#" class="oe_mail_compose oe_right">Send an e-mail
                 <img src='/mail/static/src/img/email_icon.png' alt='Send an e-mail'/>
             </a>
+-->
         </div>
         <div class="oe_mail_thread_display"></div>
         <div class="oe_mail_thread_more">
index e92cbdb..2d8fd2c 100644 (file)
                 <form string="Compose Email" version="7.0" >
                     <group col="4">
                         <field name="subject" colspan="4" nolabel="1" placeholder="Subject..."
-                                class="mail_compose_message_subject"/>
+                                class="oe_mail_compose_message_subject oe_mail_compose_message_invisible"/>
                         <field name="body_text" colspan="4" nolabel="1" placeholder="What are you working on ?"
-                                class="mail_compose_message_body_text"/>
+                                class="oe_mail_compose_message_body_text"/>
                         <field name="body_html" colspan="4" nolabel="1" placeholder="What are you working on ?"
-                                class="mail_compose_message_body_html" widget="text_html"/>
+                                class="oe_mail_compose_message_body_html oe_mail_compose_message_invisible" widget="text_html"/>
                         <field name="destination_partner_ids" colspan="4" nolabel="1" widget="many2many_tags"
-                                class="mail_compose_message_partner_ids"/>
+                                class="oe_mail_compose_message_partner_ids oe_mail_compose_message_invisible"/>
                         <button icon="gtk-ok" name="send_mail" string="Post" type="object"/>
                         <p> or <a href="#" class="mail_compose_message_toggle">Send a Message</a></p>
                         <button icon="gtk-close" string="Cancel" special="cancel" />