FIX: Don't show quote controls when the post id is missing.

This commit is contained in:
Robin Ward 2014-04-25 15:40:48 -04:00
parent 47d000edcc
commit b91c70cac3
1 changed files with 15 additions and 13 deletions

View File

@ -64,9 +64,9 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
repliesShown: Em.computed.gt('post.replies.length', 0), repliesShown: Em.computed.gt('post.replies.length', 0),
updateQuoteElements: function($aside, desc) { updateQuoteElements: function($aside, desc) {
var navLink = ""; var navLink = "",
var quoteTitle = I18n.t("post.follow_quote"); quoteTitle = I18n.t("post.follow_quote"),
var postNumber = $aside.data('post'); postNumber = $aside.data('post');
if (postNumber) { if (postNumber) {
@ -94,7 +94,7 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
expandContract = "<i class='fa fa-" + desc + "' title='" + I18n.t("post.expand_collapse") + "'></i>"; expandContract = "<i class='fa fa-" + desc + "' title='" + I18n.t("post.expand_collapse") + "'></i>";
$aside.css('cursor', 'pointer'); $aside.css('cursor', 'pointer');
} }
$('.quote-controls', $aside).html("" + expandContract + navLink); $('.quote-controls', $aside).html(expandContract + navLink);
}, },
toggleQuote: function($aside) { toggleQuote: function($aside) {
@ -189,6 +189,7 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
var self = this; var self = this;
return this.$('aside.quote').each(function(i, e) { return this.$('aside.quote').each(function(i, e) {
var $aside = $(e); var $aside = $(e);
if ($aside.data('post')) {
self.updateQuoteElements($aside, 'chevron-down'); self.updateQuoteElements($aside, 'chevron-down');
var $title = $('.title', $aside); var $title = $('.title', $aside);
@ -200,6 +201,7 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
}); });
$title.data('has-quote-controls', true); $title.data('has-quote-controls', true);
} }
}
}); });
}, },