Fix broken events for chatrooms panel. CSS tweaks.

This commit is contained in:
JC Brand 2012-10-26 11:41:39 +02:00
parent fd4192b7cc
commit 3ebd223cc2

View File

@ -421,7 +421,7 @@
template: _.template( template: _.template(
'<div class="chat-head chat-head-chatbox">' + '<div class="chat-head chat-head-chatbox">' +
'<a href="javascript:void(0)" class="chatbox-button close-chatbox-button">X</a>' + '<a class="close-chatbox-button">X</a>' +
'<a href="{{user_profile_url}}" class="user">' + '<a href="{{user_profile_url}}" class="user">' +
'<img src="{{portrait_url}}" alt="Avatar of {{fullname}}" class="avatar" />' + '<img src="{{portrait_url}}" alt="Avatar of {{fullname}}" class="avatar" />' +
'<div class="chat-title"> {{ fullname }} </div>' + '<div class="chat-title"> {{ fullname }} </div>' +
@ -546,32 +546,31 @@
}); });
xmppchat.RoomsPanel = Backbone.View.extend({ xmppchat.RoomsPanel = Backbone.View.extend({
el: '#chatrooms', tagName: 'div',
id: 'chatrooms',
events: { events: {
'submit form.add-chatroom': 'createChatRoom', 'submit form.add-chatroom': 'createChatRoom',
'click a.open-room': 'createChatRoom' 'click a.open-room': 'createChatRoom'
}, },
room_template: _.template( room_template: _.template(
'<dd class="chatroom">' + '<dd class="available-chatroom">' +
'<a class="open-room" room-jid="{{jid}}" title="Click to open this chatroom" href="#">' + '<a class="open-room" room-jid="{{jid}}" title="Click to open this chatroom" href="#">' +
'{{name}}</a></dd>'), '{{name}}</a></dd>'),
tab_template: _.template('<li><a class="s" href="#chatrooms">Rooms</a></li>'), tab_template: _.template('<li><a class="s" href="#chatrooms">Rooms</a></li>'),
template: _.template( template: _.template(
'<div id="chatrooms" style="display:None">'+ '<form class="add-chatroom" action="" method="post">'+
'<form class="add-chatroom" action="" method="post">'+ '<input type="text" name="chatroom" class="new-chatroom-name" placeholder="Chat room name"/>'+
'<input type="text" name="chatroom" class="new-chatroom-name" placeholder="Chat room name"/>'+ '<button type="submit">Join</button>'+
'<button type="submit">Join</button>'+ '</form>'+
'</form>'+ '<dl id="available-chatrooms">'+
'<dl id="available-chatrooms">'+ '<dt>Available chatrooms</dt>'+
'<dt>Available chatrooms</dt>'+ '</dl>'),
'</dl>'+
'</div>'),
render: function () { render: function () {
$('#controlbox-tabs').append(this.tab_template()); $('#controlbox-tabs').append(this.tab_template());
$('#controlbox-panes').append(this.template()); $('#controlbox-panes').append(this.$el.html(this.template()).hide());
return this; return this;
}, },
@ -586,7 +585,7 @@
xmppchat.connection.muc.listRooms(xmppchat.connection.muc_domain, $.proxy(function (iq) { xmppchat.connection.muc.listRooms(xmppchat.connection.muc_domain, $.proxy(function (iq) {
var room, name, jid, i, var room, name, jid, i,
rooms = $(iq).find('query').find('item'); rooms = $(iq).find('query').find('item');
this.$el.find('#available-chatrooms').find('dd.chatroom').remove(); this.$el.find('#available-chatrooms').find('dd.available-chatroom').remove();
if (rooms.length) { if (rooms.length) {
this.$el.find('#available-chatrooms dt').show(); this.$el.find('#available-chatrooms dt').show();
} else { } else {
@ -639,7 +638,7 @@
className: 'chatbox', className: 'chatbox',
id: 'controlbox', id: 'controlbox',
events: { events: {
'click a.close-controlbox-button': 'closeChat', 'click a.close-chatbox-button': 'closeChat',
'click ul#controlbox-tabs li a': 'switchTab' 'click ul#controlbox-tabs li a': 'switchTab'
}, },
@ -650,7 +649,7 @@
template: _.template( template: _.template(
'<div class="chat-head oc-chat-head">'+ '<div class="chat-head oc-chat-head">'+
'<ul id="controlbox-tabs"></ul>'+ '<ul id="controlbox-tabs"></ul>'+
'<a class="close-controlbox-button">X</a>'+ '<a class="close-chatbox-button">X</a>'+
'</div>'+ '</div>'+
'<div id="controlbox-panes"></div>' '<div id="controlbox-panes"></div>'
), ),
@ -760,7 +759,7 @@
template: _.template( template: _.template(
'<div class="chat-head chat-head-chatroom">' + '<div class="chat-head chat-head-chatroom">' +
'<a href="javascript:void(0)" class="chatbox-button close-chatbox-button">X</a>' + '<a class="close-chatbox-button">X</a>' +
'<div class="chat-title"> {{ name }} </div>' + '<div class="chat-title"> {{ name }} </div>' +
'<p class="chatroom-topic"><p/>' + '<p class="chatroom-topic"><p/>' +
'</div>' + '</div>' +