Permalink
Browse files

"fixing create and delete functionality again... "

  • Loading branch information...
1 parent 579a559 commit a2a5ebc580ab11a87e429a03d42a7962f238e31b @kevzettler kevzettler committed Apr 7, 2012
@@ -46,7 +46,7 @@ class Kandan.Helpers.Channels
$channelActivities.children().first().remove()
oldest = $channelActivities.children().first().data("activity_id")
$channelActivities.prev().data("oldest", oldest)
- @channel_pagination_el(channelId).show()
+ @channel_pagination_el(channelId).show()
@confirmAndDeleteChannel: (channel, tabIndex)->
@@ -74,14 +74,9 @@ class Kandan.Helpers.Channels
deleted = deleted || false
channelId = @getChannelIdByTabIndex(tabIndex)
throw "NO CHANNEL ID" if channelId == 'undefined'
-
channel = new Kandan.Models.Channel({id: channelId})
return @confirmAndDeleteChannel(channel, tabIndex) if not deleted
- # NOTE this is for participating users who do not require confirmation
- console.log "TAB INDEX", tabIndex
- $("#kandan").tabs("remove", tabIndex)
-
@channelExists: (channelId)->
return true if $("#channels-#{channelId}").length > 0
@@ -91,7 +86,7 @@ class Kandan.Helpers.Channels
@createChannelArea: (channel)->
channelArea = "#channels-#{channel.get('id')}"
totalTabs = $("#kandan").tabs("length")
- $createTab = $(".create_channel").parents('li').detach()
+ $createTab = $("#create_channel").parents('li').detach()
$("#kandan").tabs('add', channelArea, "#{channel.get("name")}", totalTabs)
$createTab.appendTo('ul.ui-tabs-nav')
view = new Kandan.Views.ChannelPane({channel: channel})
@@ -4,7 +4,7 @@ class Kandan.Views.ChannelTabs extends Backbone.View
events:
"click .close_channel" : "deleteChannel"
- "click .create_channel": "createChannel"
+ "click #create_channel": "createChannel"
render: ()->
@@ -21,7 +21,9 @@ class Kandan.Views.ChannelTabs extends Backbone.View
Kandan.Helpers.Channels.createChannelArea(model)
})
console.log "create channel: #{channelName}"
+ return false
deleteChannel: (event)->
- channelIndex = $(event.target).closest('li').prevAll().length
+ channelIndex = $(event.target).parents('li').prevAll().length
Kandan.Helpers.Channels.deleteChannelByTabIndex(channelIndex) if channelIndex != 0
+ return false
@@ -3,6 +3,8 @@ class Kandan.Views.ChatArea extends Backbone.View
render: ->
tabView = new Kandan.Views.ChannelTabs({channels: @options.channels})
$('.header .logo').after(tabView.render().el)
+ console.log(tabView);
+ $('#create_channel').click(tabView.createChannel)
for channel in @options.channels.models
view = new Kandan.Views.ChannelPane({channel: channel})
@@ -1,3 +1,3 @@
<li>
- <a href="#" class="create_channel">+</a>
+ <a href="#" id="create_channel">+</a>
</li>

0 comments on commit a2a5ebc

Please sign in to comment.