Commit 0e6b7d77 by Rocky Duan

only bind delete events to threads but not responses

parent f93e09d3
......@@ -62,5 +62,15 @@ class @DiscussionContentView extends Backbone.View
if @attrRenderer[attr]
@attrRenderer[attr].apply(@, [value])
$: (selector) ->
@$local.find(selector)
initLocal: ->
@$local = @$el.children(".local")
if not @$local.length
@$local = @$el
@$delegateElement = @$local
initialize: ->
@initLocal()
@model.bind('change', @renderPartialAttrs, @)
......@@ -75,7 +75,6 @@ class @DiscussionThreadListView extends Backbone.View
@trigger "threads:rendered"
renderThreadListItem: (thread) =>
console.log "rendering"
view = new ThreadListItemView(model: thread)
view.on "thread:selected", @threadSelected
view.on "thread:removed", @threadRemoved
......
<script type="text/template" id="thread-template">
<article class="discussion-article" data-id="${'<%- id %>'}">
<a href="javascript:void(0)" class="dogear action-follow"></a>
<div class="discussion-post">
<div class="local"><a href="javascript:void(0)" class="dogear action-follow"></a></div>
<div class="discussion-post local">
<header>
<a href="#" class="vote-btn discussion-vote discussion-vote-up" data-role="discussion-vote"><span class="plus-icon">+</span> <span class='votes-count-number'>${'<%- votes["up_count"] %>'}</span></a>
<h1>${'<%- title %>'}</h1>
......@@ -30,10 +30,10 @@
<ol class="responses">
<li class="loading"><div class="loading-animation"></div></li>
</ol>
<div class="post-status-closed bottom-post-status" style="display: none">
<div class="local post-status-closed bottom-post-status" style="display: none">
This thread is closed.
</div>
<form class="discussion-reply-new" data-id="${'<%- id %>'}">
<form class="local discussion-reply-new" data-id="${'<%- id %>'}">
<h4>Post a response:</h4>
<ul class="discussion-errors"></ul>
<div class="reply-body"></div>
......
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