1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-12-01 05:32:17 -05:00
kaiwa/clientapp/views/mucListItem.js
2015-02-09 16:30:11 +01:00

40 lines
951 B
JavaScript

/*global $, app, me*/
"use strict";
var _ = require('underscore');
var HumanView = require('human-view');
var templates = require('../templates');
module.exports = HumanView.extend({
template: templates.includes.mucListItem,
classBindings: {
activeContact: '',
hasUnread: '',
joined: '',
persistent: ''
},
textBindings: {
displayName: '.name',
displayUnreadCount: '.unread'
},
events: {
'click .name': 'handleClick',
'click .join': 'handleJoinRoom',
'click .remove': 'handleLeaveRoom'
},
render: function () {
this.renderAndBind({contact: this.model});
return this;
},
handleClick: function (e) {
app.navigate('groupchat/' + encodeURIComponent(this.model.jid));
},
handleJoinRoom: function (e) {
this.model.join();
},
handleLeaveRoom: function (e) {
this.model.leave();
}
});