From fc4e21d4c4d5df2b83d22c03d534094cee2a0acc Mon Sep 17 00:00:00 2001 From: Rocky Duan Date: Thu, 26 Jul 2012 17:35:09 -0400 Subject: [PATCH] use wmd editor for comments --- lms/static/coffee/src/customwmd.coffee | 13 ++++++++++++- lms/static/coffee/src/discussion.coffee | 20 +++++++++++++++----- lms/static/sass/_discussion.scss | 2 +- lms/templates/discussion/inline.html | 10 +++------- lms/templates/discussion/thread.html | 19 +++++++++++-------- 5 files changed, 42 insertions(+), 22 deletions(-) diff --git a/lms/static/coffee/src/customwmd.coffee b/lms/static/coffee/src/customwmd.coffee index e8012d8f42..8a3a2d7c97 100644 --- a/lms/static/coffee/src/customwmd.coffee +++ b/lms/static/coffee/src/customwmd.coffee @@ -109,7 +109,18 @@ $ -> converter.hooks.chain "postConversion", processor.replaceMath converter - Markdown.makeWmdEditor = (appended_id) -> + Markdown.makeWmdEditor = (elem, appended_id) -> + $elem = $(elem) + if not $elem.length + console.log "warning: elem for makeWmdEditor doesn't exist" + return + if not $elem.find(".wmd-panel").length + _append = appended_id || "" + $wmdPanel = $("
").addClass("wmd-panel") + .append($("
").attr("id", "wmd-button-bar#{_append}")) + .append($(" +
+
New Post -
-
- -
-
+
% for thread in threads: diff --git a/lms/templates/discussion/thread.html b/lms/templates/discussion/thread.html index 5997b1b70c..52eb17c107 100644 --- a/lms/templates/discussion/thread.html +++ b/lms/templates/discussion/thread.html @@ -41,14 +41,17 @@ % for comment in comments:
- ${render_vote(comment)} -
-
- ${comment['body']} -
- ${render_info(comment)} - ${render_reply()} - ${render_edit()} +
+ ${render_vote(comment)} +
+
+ ${comment['body']} +
+ ${render_info(comment)} + ${render_reply()} + ${render_edit()} +
+