Commit f5f1e858 by David Ormsbee

Merge pull request #874 from MITx/hotfix/arjun/fix_integer_disc_ids

Hotfix/arjun/fix integer disc ids
parents 73bbfe8c c28c3f99
......@@ -156,7 +156,11 @@ if Backbone?
@$(".post-list").append(view.el)
threadSelected: (e) =>
thread_id = $(e.target).closest("a").data("id")
# Use .attr('data-id') rather than .data('id') because .data does type
# coercion. Usually, this is fine, but when Mongo gives an object id with
# no letters, it casts it to a Number.
thread_id = $(e.target).closest("a").attr("data-id")
@setActiveThread(thread_id)
@trigger("thread:selected", thread_id) # This triggers a callback in the DiscussionRouter which calls the line above...
false
......
<script type="text/template" id="thread-template">
<article class="discussion-article" data-id="${'<%- id.toString() %>'}">
<article class="discussion-article" data-id="${'<%- id %>'}">
<div class="thread-content-wrapper"></div>
<ol class="responses">
<li class="loading"><div class="loading-animation"></div></li>
......@@ -7,10 +7,10 @@
<div class="post-status-closed bottom-post-status" style="display: none">
This thread is closed.
</div>
<form class="discussion-reply-new" data-id="${'<%- id.toString() %>'}">
<form class="discussion-reply-new" data-id="${'<%- id %>'}">
<h4>Post a response:</h4>
<ul class="discussion-errors"></ul>
<div class="reply-body" data-id="${'<%- id.toString() %>'}"></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>
......@@ -117,7 +117,7 @@
</script>
<script type="text/template" id="response-comment-show-template">
<div id="comment_${'<%- id.toString() %>'}">
<div id="comment_${'<%- id %>'}">
<div class="response-body">${'<%- body %>'}</div>
<p class="posted-details">&ndash;posted <span class="timeago" title="${'<%- created_at %>'}">${'<%- created_at %>'}</span> by
${"<% if (obj.username) { %>"}
......@@ -128,7 +128,7 @@
</script>
<script type="text/template" id="thread-list-item-template">
<a href="${'<%- id.toString() %>'}" data-id="${'<%- id.toString() %>'}">
<a href="${'<%- id %>'}" data-id="${'<%- id %>'}">
<span class="title">${"<%- title %>"}</span>
${"<% if (unread_comments_count > 0) { %>"}
<span class="comments-count unread" data-tooltip="${"<%- unread_comments_count %>"} new comment${"<%- unread_comments_count > 1 ? 's' : '' %>"}">${"<%- comments_count %>"}</span>
......
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