revert toString changes; use attr('data-id') instead of data('id') when mongo ids are involved
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">–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>
|
||||
|
||||
Reference in New Issue
Block a user