     @
 
   createChannel: (event)->
+    console.log("createChannel called", event);
     channelName = prompt("What's the channel name?", "New channel")
     channelName = channelName.replace(/^\s+|\s+$/g, '')
     if channelName

      console.log "create channel: #{channelName}"

  deleteChannel: (event)->
    channelIndex = $(event.target).parent().prevAll().length
    console.log "request for deletion", channelIndex
    Kandan.Helpers.Channels.deleteChannelByTabIndex(channelIndex) if channelIndex != 0

  template: JST['chatarea']
  # className: 'channels'

  # events:
  #   "click .close_channel" : "deleteChannel"
  #   "click .create_channel": "createChannel"

  render: ->
    $('.header .logo').after(@template({channels: @options.channels}))
    $('.close_channel').click(@deleteChannel);
    $('.create_channel').click(@createChannel);
    for channel in @options.channels.models
      view = new Kandan.Views.ChannelPane({channel: channel})
      $(@el).append(view.render().el)
