Skip to content
Browse files

Add separate view for channel tabs.

  • Loading branch information...
1 parent 751c55f commit fe03916c181ae97606df4b901c4b63610fcb6870 @akavlie akavlie committed Jan 14, 2012
Showing with 15 additions and 17 deletions.
  1. +14 −15 assets/js/views/channel_list.js
  2. +1 −2 views/templates.jade
View
29 assets/js/views/channel_list.js
@@ -4,28 +4,27 @@ var ChannelListView = Backbone.View.extend({
initialize: function() {
console.log('channel list init');
irc.chatWindows.bind('add', this.addChannel, this);
- irc.chatWindows.bind('setActive', this.setActiveChannel, this);
},
addChannel: function(chat) {
console.log('channel added to list');
- chat.channelTab = ich.channel({name:chat.get('name')});
- $(this.el).append(chat.channelTab);
- this.setActiveChannel(chat);
+ // chat.channelTab = ich.channel({name:chat.get('name')});
+ var view = new ChannelTabView({model: chat})
+ $(this.el).append(view.render().el);
+ irc.chatWindows.setActive(chat);
// TODO: simplify / rewrite this
// separate view for each tab would probably simplify things
- chat.channelTab.click({chat: chat, clv: this}, function(ev) {
- chat = ev.data.chat;
- irc.chatWindows.setActive(chat);
- ev.data.clv.setActiveChannel(chat);
- });
+ // chat.channelTab.click({chat: chat, clv: this}, function(ev) {
+ // chat = ev.data.chat;
+ // ev.data.clv.setActiveChannel(chat);
+ // });
},
- setActiveChannel: function(chat) {
- $('.active').removeClass('active');
- if (chat.channelTab !== undefined) {
- chat.channelTab.addClass('active');
- }
- }
+ // setActiveChannel: function(chat) {
+ // $('.active').removeClass('active');
+ // if (chat.channelTab !== undefined) {
+ // chat.channelTab.addClass('active');
+ // }
+ // }
});
View
3 views/templates.jade
@@ -62,8 +62,7 @@ script(id="chat", type="text/html")
#user-list
script(id="channel", type="text/html")
- .channel
- span(class="channel-name") {{name}}
+ span(class="channel-name") {{name}}
script(id="unread", type="text/html")
span(class="unread", title="Unread Messages") {{unread}}

0 comments on commit fe03916

Please sign in to comment.
Something went wrong with that request. Please try again.