[IMP] Chatter: Post and Log a note dead; now choice is done before posting, 2 links before opening the compose box.

bzr revid: tde@openerp.com-20130222143953-u89kmui5314zh09g
This commit is contained in:
Thibault Delavallée 2013-02-22 15:39:53 +01:00
parent 0193a29335
commit 86720d6c1e
3 changed files with 30 additions and 22 deletions

View File

@ -231,14 +231,15 @@
height: 24px;
width: 100%;
padding: 2px 4px;
border: 1px solid #CCC;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background: white;
font-size: 14px;
/*border: 1px solid #CCC;*/
/*-moz-border-radius: 3px;*/
/*-webkit-border-radius: 3px;*/
/*border-radius: 3px;*/
/*background: white;*/
font-size: 13px;
color: #AAA;
font-style: italic;
font-style: bold;
text-align: center;
word-spacing: 3px;
cursor: text;
}

View File

@ -403,6 +403,7 @@ openerp.mail = function (session) {
this._super(parent, datasets, options);
this.show_compact_message = false;
this.show_delete_attachment = true;
this.is_log = false;
this.recipients = [];
this.recipient_ids = [];
},
@ -505,11 +506,11 @@ openerp.mail = function (session) {
bind_events: function () {
var self = this;
this.$('.oe_compact').on('click', _.bind( this.on_toggle_quick_composer, this));
this.$('.oe_compose_post').on('click', self.on_toggle_quick_composer);
this.$('.oe_compose_log').on('click', self.on_toggle_quick_composer);
this.$('input.oe_form_binary_file').on('change', _.bind( this.on_attachment_change, this));
this.$('.oe_cancel').on('click', _.bind( this.on_cancel, this));
this.$('.oe_post').on('click', _.bind( this.on_message_post, this));
this.$('.oe_log').on('click', _.bind( this.on_message_post, this));
this.$('.oe_post').on('click', self.on_message_post);
this.$('.oe_full').on('click', _.bind( this.on_compose_fullmail, this, this.id ? 'reply' : 'comment'));
/* stack for don't close the compose form if the user click on a button */
this.$('.oe_msg_left, .oe_msg_center').on('mousedown', _.bind( function () { this.stay_open = true; }, this));
@ -520,7 +521,7 @@ openerp.mail = function (session) {
this.$('textarea').autosize();
// auto close
this.$('textarea').on('blur', _.bind( this.on_toggle_quick_composer, this));
this.$('textarea').on('blur', self.on_toggle_quick_composer);
// event: delete child attachments off the oe_msg_attachment_list box
this.$(".oe_msg_attachment_list").on('click', '.oe_delete', this.on_attachment_delete);
@ -686,15 +687,13 @@ openerp.mail = function (session) {
on_message_post: function (event) {
var self = this;
var is_log = $(event.target).data('is_log');
console.log(is_log);
if (this.do_check_attachment_upload() && (this.attachment_ids.length || this.$('textarea').val().match(/\S+/))) {
if (is_log) {
self.do_send_message_post([], is_log);
if (this.is_log) {
this.do_send_message_post([], this.is_log);
}
else {
this.check_recipient_partners().done(function (partner_ids) {
self.do_send_message_post(partner_ids, is_log);
self.do_send_message_post(partner_ids, self.is_log);
});
}
}
@ -743,6 +742,7 @@ openerp.mail = function (session) {
*/
on_toggle_quick_composer: function (event) {
var self = this;
var $input = $(event.target);
this.compute_emails_from();
var email_addresses = _.pluck(this.recipients, 'email_address');
var suggested_partners = $.Deferred();
@ -754,6 +754,7 @@ openerp.mail = function (session) {
// if clicked: call for suggested recipients
if (event.type == 'click') {
this.is_log = $input.hasClass('oe_compose_log');
suggested_partners = this.parent_thread.ds_thread.call('message_get_suggested_recipients', [[this.context.default_res_id]]).done(function (additional_recipients) {
var thread_recipients = additional_recipients[self.context.default_res_id];
console.log('message_get_suggested_recipients:', thread_recipients);

View File

@ -32,17 +32,23 @@
</div>
<div class="oe_msg_footer">
<div class="oe_msg_attachment_list"></div>
<button class="oe_post">Send to followers</button>
or <button class="oe_log" data-is_log="true">Log a note</button>
<button class="oe_post">
<t t-if="!widget.is_log">Post</t>
<t t-if="widget.is_log">Log a note</t>
</button>
<t t-call="mail.compose_message.add_attachment"/>
</div>
</div>
</div>
<div t-if="widget.show_compact_message and !widget.show_composer and !widget.options.readonly" t-attf-class="oe_msg oe_msg_composer_compact #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''}">
<div class="field_text oe_compact">
<t t-if="widget.options.compose_placeholder" t-raw="widget.options.compose_placeholder"/>
<t t-if="!widget.options.compose_placeholder and !widget.options.view_mailbox">Write to the followers of this document...</t>
<t t-if="!widget.options.compose_placeholder and widget.options.view_mailbox">Share with my followers...</t>
<a class="oe_compose_post">
<t t-if="widget.options.compose_placeholder" t-raw="widget.options.compose_placeholder"/>
<t t-if="!widget.options.compose_placeholder and !widget.options.view_mailbox">Share a message</t>
<t t-if="!widget.options.compose_placeholder and widget.options.view_mailbox">Share with my followers</t>
</a>
<span class="oe_grey">or</span>
<a class="oe_compose_log">Log a note</a>
</div>
</div>
<span t-if="!(widget.show_compact_message and !widget.show_composer) and !widget.show_composer" class="oe_placeholder_compose"></span>
@ -129,7 +135,7 @@
<a class="oe_more_hidden">&lt;&lt;&lt;</a>
</t>
</div>
<div class="oe_recipients">
<div class="oe_recipients" t-if="!widget.is_log">
<t t-foreach='widget.recipients' t-as='recipient'>
<label title="Add as recipient and follower">
<input type="checkbox" t-att-checked="recipient.checked ? 'checked' : undefined" t-att-data="recipient.email_address"/>