kaiwa/clientapp/views/mucListItem.js

40 lines
938 B
JavaScript
Raw Normal View History

2013-09-16 19:12:00 -04:00
/*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: ''
2013-09-16 19:12:00 -04:00
},
textBindings: {
displayName: '.name',
displayUnreadCount: '.unread'
2013-09-16 19:12:00 -04:00
},
events: {
'click .name': 'handleClick',
'click .joinRoom': 'handleJoinRoom',
'click .leaveRoom': 'handleLeaveRoom'
2013-09-16 19:12:00 -04:00
},
render: function () {
this.renderAndBind({contact: this.model});
return this;
},
handleClick: function (e) {
2013-09-16 19:12:00 -04:00
app.navigate('groupchat/' + this.model.jid);
},
handleJoinRoom: function (e) {
this.model.join();
},
handleLeaveRoom: function (e) {
this.model.leave();
2013-09-16 19:12:00 -04:00
}
});