var main_node = this.$element;
return $.when(this.form_view.appendTo(main_node)).pipe(function() {
+ self.bind_events();
self.form_view.do_show();
- //self.form_view.on_button_cancel = function() {
- //console.log('cacaprout');
- //};
+ });
+ },
+
+ /**
+ * Bind events in the widget. Each event is slighty described
+ * in the function. */
+ bind_events: function() {
+ var self = this;
+ // event: click on 'Send a Message' link that toggles the
+ // 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();
});
},
destroy: function(parent, params) {
this._super.apply(this, arguments);
},
-
- //on_button_cancel: function() {
- //console.log('boudin noir');
- //},
}),
+
/**
* ------------------------------------------------------------
* Thread Widget
<field name="priority">1</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Compose Email" version="7.0">
+ <form string="Compose Email" version="7.0" >
<group col="4">
- <field name="subject" colspan="4" nolabel="1" placeholder="Subject..."/>
- <field name="body_text" colspan="4" nolabel="1" placeholder="What are you working on ?"/>
- <field name="destination_partners" colspan="4" nolabel="1" widget="many2many_tags"/>
- <newline/>
+ <field name="subject" colspan="4" nolabel="1" placeholder="Subject..."
+ class="mail_compose_message_subject"/>
+ <field name="body_text" colspan="4" nolabel="1" placeholder="What are you working on ?"
+ class="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"/>
+ <field name="destination_partner_ids" colspan="4" nolabel="1" widget="many2many_tags"
+ class="mail_compose_message_partner_ids"/>
<button icon="gtk-ok" name="send_mail" string="Post" type="object"/>
- <p> or <a href="#">Send a Message</a></p>
+ <p> or <a href="#" class="mail_compose_message_toggle">Send a Message</a></p>
<button icon="gtk-close" string="Cancel" special="cancel" />
<p>
Checklist . Attach