Top level discussions

This commit is contained in:
Arjun Singh
2012-09-03 23:02:14 -07:00
parent 99ad4c0b55
commit 098b90ebac
3 changed files with 18 additions and 17 deletions

View File

@@ -9,6 +9,7 @@ class @NewPostView extends Backbone.View
@topicId = @$(".topic").first().data("discussion_id")
@topicText = @getFullTopicName(@$(".topic").first())
@maxNameWidth = 100
@setSelectedTopic()
events:
@@ -31,7 +32,6 @@ class @NewPostView extends Backbone.View
@showTopicDropdown()
showTopicDropdown: () ->
console.log "showing"
@menuOpen = true
@dropdownButton.addClass('dropped')
@topicMenu.show()
@@ -58,13 +58,9 @@ class @NewPostView extends Backbone.View
@topicText = @getFullTopicName($target)
@topicId = $target.data('discussion_id')
@setSelectedTopic()
else
console.log "NOTHING IN "
console.log $target
setSelectedTopic: ->
if @topicText
@dropdownButton.html(@fitName(@topicText) + ' <span class="drop-arrow">▾</span>')
@dropdownButton.html(@fitName(@topicText) + ' <span class="drop-arrow">▾</span>')
getFullTopicName: (topicElement) ->
name = topicElement.html()
@@ -87,7 +83,6 @@ class @NewPostView extends Backbone.View
return width
fitName: (name) ->
console.log name
width = @getNameWidth(name)
if width < @maxNameWidth
return name
@@ -138,7 +133,6 @@ class @NewPostView extends Backbone.View
auto_subscribe: follow
error: DiscussionUtil.formErrorHandler(@$(".new-post-form-errors"))
success: (response, textStatus) =>
console.log response
thread = new Thread response['content']
DiscussionUtil.clearFormErrors(@$(".new-post-form-errors"))
@$el.hide()