From 381fe9514bd3fb0ae7f8952efd959d80971df996 Mon Sep 17 00:00:00 2001 From: Rocky Duan Date: Thu, 2 Aug 2012 15:12:55 -0400 Subject: [PATCH] make cancel/submit work and hide watch discussion --- lms/static/coffee/src/discussion.coffee | 12 ++++++++---- lms/templates/discussion/_thread.html | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lms/static/coffee/src/discussion.coffee b/lms/static/coffee/src/discussion.coffee index d65aaefb09..d6afbdbd39 100644 --- a/lms/static/coffee/src/discussion.coffee +++ b/lms/static/coffee/src/discussion.coffee @@ -221,7 +221,7 @@ Discussion = if $$user_info? $local(".comment").each(initializeVote) $local(".thread").each(initializeVote).each(initializeWatchThreads) - initializeWatchDiscussion(discussion) + #initializeWatchDiscussion(discussion) TODO move this somewhere else $local(".new-post-tags").tagsInput autocomplete_url: Discussion.urlFor('tags_autocomplete') @@ -262,8 +262,8 @@ Discussion = } $discussionContent.append Mustache.render Discussion.replyTemplate, view Markdown.makeWmdEditor $local(".reply-body"), "-reply-body-#{id}", Discussion.urlFor('upload') - $local(".discussion-submit-reply").click handleSubmitReply - $local(".discussion-cancel-reply").click handleCancelReply + $local(".discussion-submit-post").click handleSubmitReply + $local(".discussion-cancel-post").click handleCancelReply $local(".discussion-link").hide() $discussionContent.attr("status", "reply") @@ -430,10 +430,13 @@ Discussion = $local(".thread-title").click handleShowSingleThread $local(".discussion-show-comments").click handleShowSingleThread - $local(".discussion-reply").click -> + $local(".discussion-reply-thread").click -> handleShowSingleThread($local(".thread-title")) handleReply(this) + $local(".discussion-reply-comment").click -> + handleReply(this) + $local(".discussion-cancel-reply").click -> handleCancelReply(this) @@ -494,6 +497,7 @@ Discussion = , 'json' handleCancelNewPost = (elem) -> + console.log "canceling" $local(".new-post-form").hide() $local(".discussion-new-post").show() diff --git a/lms/templates/discussion/_thread.html b/lms/templates/discussion/_thread.html index 8ea341edaf..69672244d7 100644 --- a/lms/templates/discussion/_thread.html +++ b/lms/templates/discussion/_thread.html @@ -70,7 +70,7 @@ <%def name="render_bottom_bar(content, type, **kwargs)">
${render_info(content)} - ${render_link("discussion-link discussion-reply", "Reply")} + ${render_link("discussion-link discussion-reply discussion-reply-" + type, "Reply")} % if type == "thread" and kwargs['edit_thread'] or type == "comment": ${render_link("discussion-link discussion-edit", "Edit")} % endif