notification: function(message) {
throw new Error("Not implemented");
},
- defaultInputPlaceholder: null,
- userName: null,
connection: null
});
});
im_common.ConversationManager = openerp.Class.extend(openerp.PropertiesMixin, {
- init: function(parent) {
+ init: function(parent, options) {
openerp.PropertiesMixin.init.call(this, parent);
+ this.options = options;
this.set("right_offset", 0);
this.conversations = [];
this.users = {};
return im_common.connection.model("im.user").call("get_by_user_id", [uuid]);
}).then(function(my_id) {
self.my_id = my_id["id"];
- return im_common.connection.model("im.user").call("assign_name", [uuid, im_common.userName]);
+ return im_common.connection.model("im.user").call("assign_name", [uuid, self.options.userName]);
}).then(function() {
return self.ensure_users([self.my_id]);
}).then(function() {
activate_user: function(user, focus) {
var conv = this.users[user.get('id')];
if (! conv) {
- conv = new im_common.Conversation(this, user, this.me);
+ conv = new im_common.Conversation(this, user, this.me, this.options);
conv.appendTo($("body"));
conv.on("destroyed", this, function() {
this.conversations = _.without(this.conversations, conv);
"click .oe_im_chatview_close": "destroy",
"click .oe_im_chatview_header": "show_hide"
},
- init: function(parent, user, me) {
+ init: function(parent, user, me, options) {
this._super(parent);
+ this.options = options
this.me = me;
this.user = user;
this.user.add_watcher();
this.set("right_position", 0);
this.shown = true;
this.set("pending", 0);
- this.inputPlaceholder = im_common.defaultInputPlaceholder;
+ this.inputPlaceholder = this.options.defaultInputPlaceholder;
},
start: function() {
- this.$().append(openerp.qweb.render("conversation", {widget: this, to_url: im_common.to_url}));
+ this.$().append(openerp.qweb.render("im_common.conversation", {widget: this, to_url: im_common.to_url}));
var change_status = function() {
this.$().toggleClass("oe_im_chatview_disconnected_status", this.user.get("im_status") === false);
this.$(".oe_im_chatview_online").toggle(this.user.get("im_status") === true);
};
date = "" + zpad(date.getHours(), 2) + ":" + zpad(date.getMinutes(), 2);
- this.last_bubble = $(openerp.qweb.render("conversation_bubble", {"items": items, "user": user, "time": date}));
+ this.last_bubble = $(openerp.qweb.render("im_common.conversation_bubble", {"items": items, "user": user, "time": date}));
$(this.$(".oe_im_chatview_content").children()[0]).append(this.last_bubble);
this._go_bottom();
},
<?xml version="1.0" encoding="UTF-8"?>
<templates>
-<t t-name="conversation">
+<t t-name="im_common.conversation">
<div class="oe_im_chatview_header">
<img t-att-src="to_url('im/static/src/img/green.png')" class="oe_im_chatview_online"/>
<t t-esc="widget.user.get('name') || _t('You')"/>
</div>
</t>
-<t t-name="conversation_bubble">
+<t t-name="im_common.conversation_bubble">
<div class="oe_im_chatview_bubble">
<div class="oe_im_chatview_clip">
<img class="oe_im_chatview_avatar" t-att-src="user.get('image_url')"/>