Commit 9de0cccc by David Ormsbee

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

Hotfix/arjun/fix integer disc ids
parents 41df538d 71c46ff3
...@@ -156,7 +156,11 @@ if Backbone? ...@@ -156,7 +156,11 @@ if Backbone?
@$(".post-list").append(view.el) @$(".post-list").append(view.el)
threadSelected: (e) => 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) @setActiveThread(thread_id)
@trigger("thread:selected", thread_id) # This triggers a callback in the DiscussionRouter which calls the line above... @trigger("thread:selected", thread_id) # This triggers a callback in the DiscussionRouter which calls the line above...
false false
......
<script type="text/template" id="thread-template"> <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> <div class="thread-content-wrapper"></div>
<ol class="responses"> <ol class="responses">
<li class="loading"><div class="loading-animation"></div></li> <li class="loading"><div class="loading-animation"></div></li>
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<div class="post-status-closed bottom-post-status" style="display: none"> <div class="post-status-closed bottom-post-status" style="display: none">
This thread is closed. This thread is closed.
</div> </div>
<form class="discussion-reply-new" data-id="${'<%- id.toString() %>'}"> <form class="discussion-reply-new" data-id="${'<%- id %>'}">
<h4>Post a response:</h4> <h4>Post a response:</h4>
<ul class="discussion-errors"></ul> <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"> <div class="reply-post-control">
<a class="discussion-submit-post control-button" href="#">Submit</a> <a class="discussion-submit-post control-button" href="#">Submit</a>
</div> </div>
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
</script> </script>
<script type="text/template" id="response-comment-show-template"> <script type="text/template" id="response-comment-show-template">
<div id="comment_${'<%- id.toString() %>'}"> <div id="comment_${'<%- id %>'}">
<div class="response-body">${'<%- body %>'}</div> <div class="response-body">${'<%- body %>'}</div>
<p class="posted-details">&ndash;posted <span class="timeago" title="${'<%- created_at %>'}">${'<%- created_at %>'}</span> by <p class="posted-details">&ndash;posted <span class="timeago" title="${'<%- created_at %>'}">${'<%- created_at %>'}</span> by
${"<% if (obj.username) { %>"} ${"<% if (obj.username) { %>"}
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</script> </script>
<script type="text/template" id="thread-list-item-template"> <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> <span class="title">${"<%- title %>"}</span>
${"<% if (unread_comments_count > 0) { %>"} ${"<% 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> <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