Skip to content

Commit

Permalink
Switching channels working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
David committed Jan 5, 2012
1 parent d471f0a commit 2c518e9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions assets/css/subway.css
@@ -1,5 +1,7 @@
.sidebar > h2 {
text-align: center;
line-height: 0.9em;
margin-top: 0.3em;
}

#overview{
Expand Down
1 change: 0 additions & 1 deletion assets/js/collections.js
Expand Up @@ -39,7 +39,6 @@ var WindowList = Backbone.Collection.extend({

selected.set({active: true});
selected.view.render();
selected.trigger('setActive', selected);
},

getChannels: function() {
Expand Down
5 changes: 5 additions & 0 deletions assets/js/views/channel_list.js
Expand Up @@ -12,6 +12,11 @@ var ChannelListView = Backbone.View.extend({
chat.channelTab = ich.channel({name:chat.get('name')});
$(this.el).append(chat.channelTab);
this.setActiveChannel(chat);
chat.channelTab.click({chat: chat, clv: this}, function(ev){
chat = ev.data.chat;
irc.chatWindows.setActive(chat);
ev.data.clv.setActiveChannel(chat);
});
},

setActiveChannel: function(chat) {
Expand Down
5 changes: 0 additions & 5 deletions assets/js/views/chat.js
@@ -1,16 +1,11 @@
var ChatView = Backbone.View.extend({
initialize: function() {
irc.chatWindows.bind('setActive', this.setActiveChannel, this);
this.el = ich.chat();
this.render();
},

render: function() {
$('.content').html(this.el);
return this;
},

setActiveChannel: function(channel) {
this.render();
}
});
2 changes: 1 addition & 1 deletion assets/js/views/chat_application.js
Expand Up @@ -18,7 +18,7 @@ var ChatApplicationView = Backbone.View.extend({

addMessage: function(msg) {
var view = new MessageView({model: msg});
this.channel.view.el.$('#chat-contents').append(view.el);
this.channel.view.$('#chat-contents').append(view.el);
console.log('message added!');
this.channel.view.$('#chat-contents').scrollTop( $('#chat-contents').scrollTop() + 100 );
},
Expand Down
2 changes: 2 additions & 0 deletions views/templates.jade
Expand Up @@ -3,6 +3,8 @@ script(id="chat_application", type="text/html")
#logo
img(src='/assets/images/subway.png')
h2 Subway
br
small IRC client
#channels
.content

Expand Down

0 comments on commit 2c518e9

Please sign in to comment.