Commit 2d4645af by Ibrahim Awwal

Make appended_id for WMD editor a little less hacky by getting it from data-id…

Make appended_id for WMD editor a little less hacky by getting it from data-id of the 'reply-body' element instead of from _id of the wrapper.
parent b803423c
......@@ -143,8 +143,7 @@ class @DiscussionUtil
@makeWmdEditor: ($content, $local, cls_identifier) ->
elem = $local(".#{cls_identifier}")
id = $content.attr("_id")
#TODO: I think this is kind of a hack. At the least it should use data-id instead of _id
id = elem.data("id")
appended_id = "-#{cls_identifier}-#{id}"
imageUploadUrl = @urlFor('upload')
_processor = (_this) ->
......
......@@ -36,7 +36,7 @@
<form class="local discussion-reply-new" data-id="${'<%- id %>'}">
<h4>Post a response:</h4>
<ul class="discussion-errors"></ul>
<div class="reply-body"></div>
<div class="reply-body" data-id="${'<%- id %>'}"></div>
<div class="reply-post-control">
<a class="discussion-submit-post control-button" href="#">Submit</a>
</div>
......
<section class="discussion">
{{#threads}}
<article class="discussion-thread" id="thread_{{id}}" _id="{{id}}">
<article class="discussion-thread" id="thread_{{id}}">
</article>
{{/threads}}
</section>
......@@ -19,7 +19,7 @@
<form class="local discussion-reply-new" data-id="{{id}}">
<h4>Post a response:</h4>
<ul class="discussion-errors"></ul>
<div class="reply-body" _id="{{id}}"></div>
<div class="reply-body" data-id="{{id}}"></div>
<div class="reply-post-control">
<a class="discussion-submit-post control-button" href="#">Submit</a>
</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