Skip to content

Commit

Permalink
Merge branch 'ui_work'
Browse files Browse the repository at this point in the history
  • Loading branch information
HashNuke committed Mar 26, 2012
2 parents bfe38f6 + 8753ea3 commit 81a35d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
13 changes: 10 additions & 3 deletions app/assets/javascripts/backbone/helpers/channels.js.coffee
Expand Up @@ -43,11 +43,18 @@ class Kandan.Helpers.Channels
else
return $(document).data('active_channel_id')

@confirmDeletion: ()->
confirmDeletion = confirm("Really delete the channel?")
return false if confirmDeletion == false
confirmAgain = confirm("Are you damn sure?")
return confirmAgain


@deleteChannel: (channelIndex)->
channelID = @get_channel_id_from_tab_index(channelIndex)
console.log "deleting channel ID #{channelID}"
channel = Kandan.Models.Channel({id: channelID})
console.log "could create channel"
channel = new Kandan.Models.Channel({id: channelID})
return false if @confirmDeletion() == false

channel.destroy({success: ()=>
$("#channels").tabs("remove", channelIndex)
})
Expand Down
4 changes: 1 addition & 3 deletions app/assets/javascripts/backbone/models/channel.js.coffee
@@ -1,7 +1,5 @@
class Kandan.Models.Channel extends Backbone.Model
urlRoot: ()->
console.log "called urlRoot"
'/channels'
urlRoot: '/channels'

# initialize: ()->
# console.log @activities
Expand Down
4 changes: 1 addition & 3 deletions app/assets/javascripts/backbone/views/chatarea.js.coffee
Expand Up @@ -27,7 +27,5 @@ class Kandan.Views.ChatArea extends Backbone.View
console.log "create channel: #{channelName}"

deleteChannel: (event)->
console.log "deleting channel"
channelIndex = $(event.target).parent().prev().length
if channelIndex != 0
Kandan.Helpers.Channels.deleteChannel channelIndex
Kandan.Helpers.Channels.deleteChannel channelIndex if channelIndex != 0

0 comments on commit 81a35d3

Please sign in to comment.