Commit 4dae36cd by Rocky Duan

only execude code when backbone is defined

parent 45431ae7
class @Content extends Backbone.Model
if Backbone?
class @Content extends Backbone.Model
template: -> DiscussionUtil.getTemplate('_content')
......@@ -49,7 +50,7 @@ class @Content extends Backbone.Model
@resetComments(@get('children'))
class @ContentView extends Backbone.View
class @ContentView extends Backbone.View
$: (selector) ->
@$local.find(selector)
......@@ -352,7 +353,7 @@ class @ContentView extends Backbone.View
@initBody()
@initCommentViews()
class @Thread extends @Content
class @Thread extends @Content
urlMappers:
'retrieve' : -> DiscussionUtil.urlFor('retrieve_single_thread', @discussion.id, @id)
'reply' : -> DiscussionUtil.urlFor('create_comment', @id)
......@@ -373,9 +374,9 @@ class @Thread extends @Content
discussion_id = @get('commentable_id')
return Discussion.urlFor("permanent_link_thread", discussion_id, @id)
class @ThreadView extends @ContentView
class @ThreadView extends @ContentView
class @Comment extends @Content
class @Comment extends @Content
urlMappers:
'reply': -> DiscussionUtil.urlFor('create_sub_comment', @id)
'unvote': -> DiscussionUtil.urlFor("undo_vote_for_#{@get('type')}", @id)
......@@ -396,9 +397,9 @@ class @Comment extends @Content
count += comment.getCommentsCount() + 1
count
class @CommentView extends @ContentView
class @CommentView extends @ContentView
class @Comments extends Backbone.Collection
class @Comments extends Backbone.Collection
model: Comment
......
class @Discussion extends Backbone.Collection
if Backbone?
class @Discussion extends Backbone.Collection
model: Thread
initialize: ->
......@@ -15,7 +16,7 @@ class @Discussion extends Backbone.Collection
@add model
model
class @DiscussionView extends Backbone.View
class @DiscussionView extends Backbone.View
$: (selector) ->
@$local.find(selector)
......
class @DiscussionModuleView extends Backbone.View
if Backbone?
class @DiscussionModuleView extends Backbone.View
events:
"click .discussion-show": "toggleDiscussion"
toggleDiscussion: (event) ->
......
......@@ -12,4 +12,5 @@ $ ->
discussion.reset(discussionData, {silent: false})
view = new DiscussionView(el: elem, model: discussion)
if window.$$annotated_content_info?
DiscussionUtil.bulkUpdateContentInfo(window.$$annotated_content_info)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment