summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-09-01 14:06:15 +0200
committerqsm-odoo <qsm@odoo.com>2017-09-05 12:13:55 +0200
commit24ea61163d30f5357e3cd8a6e6d84cf39f89d3fc (patch)
treee8e57ce677c420ca060560db816d4532bb28e465 /addons/mail/static/src/js
parent12b818d3759fc9eba19fa8a8ae8d050fe0c5fdc1 (diff)
[REF] mail: review new chatter design
- Use classes instead of repeated mixins - Add real user avatar instead of fake one - Reorganize LESS rules
Diffstat (limited to 'addons/mail/static/src/js')
-rw-r--r--addons/mail/static/src/js/activity.js15
-rw-r--r--addons/mail/static/src/js/chatter.js10
-rw-r--r--addons/mail/static/src/js/chatter_composer.js3
-rw-r--r--addons/mail/static/src/js/client_action.js14
-rw-r--r--addons/mail/static/src/js/composer.js12
-rw-r--r--addons/mail/static/src/js/extended_chat_window.js2
6 files changed, 29 insertions, 27 deletions
diff --git a/addons/mail/static/src/js/activity.js b/addons/mail/static/src/js/activity.js
index 85e05cf5646..1b2b57e784f 100644
--- a/addons/mail/static/src/js/activity.js
+++ b/addons/mail/static/src/js/activity.js
@@ -127,9 +127,18 @@ var Activity = AbstractActivityField.extend({
activity.note = utils.parse_and_transform(activity.note, utils.add_link);
}
});
- self.$el.html(QWeb.render('mail.activity_items', {
- activities: setDelayLabel(self.activities),
- }));
+ var activities = setDelayLabel(self.activities);
+ if (activities.length) {
+ var nbActivities = _.countBy(activities, 'state');
+ self.$el.html(QWeb.render('mail.activity_items', {
+ activities: activities,
+ nbPlannedActivities: nbActivities.planned,
+ nbTodayActivities: nbActivities.today,
+ nbOverdueActivities: nbActivities.overdue,
+ }));
+ } else {
+ self.$el.empty();
+ }
});
},
_reset: function (record) {
diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js
index f02eaadd42e..5f8226e5ff0 100644
--- a/addons/mail/static/src/js/chatter.js
+++ b/addons/mail/static/src/js/chatter.js
@@ -126,16 +126,8 @@ var Chatter = Widget.extend(chat_mixin, {
this.$('.o_chatter_button_new_message, .o_chatter_button_log_note').removeClass('o_active');
this.composer.do_hide();
this.composer.clear_composer();
- this._muteNewMessageButton(false);
}
},
- _muteNewMessageButton: function (mute) {
- // TOCHECK: If this function exist for design pourposes only, it can be removed
-
- // this.$('.o_chatter_button_new_message')
- // .toggleClass('btn-primary', !mute)
- // .toggleClass('btn-default', mute);
- },
_openComposer: function (options) {
var self = this;
var old_composer = this.composer;
@@ -173,13 +165,11 @@ var Chatter = Widget.extend(chat_mixin, {
self.composer.on('need_refresh', self, self.trigger_up.bind(self, 'reload'));
self.composer.on('close_composer', null, self._closeComposer.bind(self, true));
- // TOCHECK: Toggle active chatter classes. It may be inproved?
self.$el.addClass('o_chatter_composer_active');
self.$('.o_chatter_button_new_message, .o_chatter_button_log_note').removeClass('o_active');
self.$('.o_chatter_button_new_message').toggleClass('o_active', !self.composer.options.is_log);
self.$('.o_chatter_button_log_note').toggleClass('o_active', self.composer.options.is_log);
});
- this._muteNewMessageButton(true);
},
_render: function (def) {
// the rendering of the chatter is aynchronous: relational data of its fields needs to be
diff --git a/addons/mail/static/src/js/chatter_composer.js b/addons/mail/static/src/js/chatter_composer.js
index cd36e12768c..77c8834252f 100644
--- a/addons/mail/static/src/js/chatter_composer.js
+++ b/addons/mail/static/src/js/chatter_composer.js
@@ -33,6 +33,7 @@ var ChatterComposer = composer.BasicComposer.extend({
this.events = _.extend(this.events, {
'click .o_composer_button_full_composer': 'on_open_full_composer',
});
+ this.notInline = true;
},
should_send: function () {
@@ -241,4 +242,4 @@ var ChatterComposer = composer.BasicComposer.extend({
return ChatterComposer;
-}); \ No newline at end of file
+});
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js
index ac1f337415c..85acb3118f7 100644
--- a/addons/mail/static/src/js/client_action.js
+++ b/addons/mail/static/src/js/client_action.js
@@ -280,26 +280,24 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
},
select_message: function(message_id) {
- var self = this;
-
this.$el.addClass('o_mail_selection_mode');
var message = chat_manager.get_message(message_id);
this.selected_message = message;
var subject = "Re: " + message.record_name;
this.extended_composer.set_subject(subject);
- this.basic_composer.$el.toggleClass('o_hidden', self.channel.type !== 'static');
- this.extended_composer.$el.addClass('o_hidden');
+ if (this.channel.type !== 'static') {
+ this.basic_composer.do_hide();
+ }
+ this.extended_composer.do_show();
this.thread.scroll_to({id: message_id, duration: 200, only_if_necessary: true});
this.extended_composer.focus('body');
},
unselect_message: function() {
- var self = this;
-
- this.basic_composer.$el.toggleClass('o_hidden', !(self.channel.type !== 'static' && !self.channel.mass_mailing));
- this.extended_composer.$el.toggleClass('o_hidden', !(self.channel.type !== 'static' && self.channel.mass_mailing));
+ this.basic_composer.do_toggle(this.channel.type !== 'static' && !this.channel.mass_mailing);
+ this.extended_composer.do_toggle(this.channel.type !== 'static' && this.channel.mass_mailing);
if (!config.device.touch) {
var composer = this.channel.mass_mailing ? this.extended_composer : this.basic_composer;
diff --git a/addons/mail/static/src/js/composer.js b/addons/mail/static/src/js/composer.js
index 5af38b2b24b..29806a08e51 100644
--- a/addons/mail/static/src/js/composer.js
+++ b/addons/mail/static/src/js/composer.js
@@ -417,6 +417,14 @@ var BasicComposer = Widget.extend(chat_mixin, {
// Emojis
this.emoji_container_classname = 'o_composer_emoji';
+
+ this.isMini = options.isMini;
+
+ this.avatarURL = session.uid > 0 ? session.url('/web/image', {
+ model: 'res.users',
+ field: 'image_small',
+ id: session.uid,
+ }) : '/web/static/src/img/user_menu_avatar.png';
},
start: function () {
@@ -463,10 +471,6 @@ var BasicComposer = Widget.extend(chat_mixin, {
return this._super.apply(this, arguments);
},
- toggle: function(state) {
- this.$el.toggle(state);
- },
-
preprocess_message: function () {
// Return a deferred as this function is extended with asynchronous
// behavior for the chatter composer
diff --git a/addons/mail/static/src/js/extended_chat_window.js b/addons/mail/static/src/js/extended_chat_window.js
index c206ae0d701..2163c28dd92 100644
--- a/addons/mail/static/src/js/extended_chat_window.js
+++ b/addons/mail/static/src/js/extended_chat_window.js
@@ -28,7 +28,7 @@ return ChatWindow.extend({
})
.focus();
} else if (!self.options.input_less) {
- var basic_composer = new composer.BasicComposer(self, {mention_partners_restricted: true});
+ var basic_composer = new composer.BasicComposer(self, {mention_partners_restricted: true, isMini: true});
basic_composer.on('post_message', self, function (message) {
this.trigger('post_message', message, this.channel_id);
});