[IMP] chatter widget: some work on the compose message form (with now some javascript to show/hide advanced options).

bzr revid: tde@openerp.com-20120615153515-cicbz4m8kxsx5q53
This commit is contained in:
Thibault Delavallée 2012-06-15 17:35:15 +02:00
parent f3755ac0a4
commit a7c3132d78
2 changed files with 27 additions and 13 deletions

View File

@ -62,22 +62,32 @@ openerp.mail = function(session) {
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

View File

@ -57,14 +57,18 @@
<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