FIX: Double clicking quote expansion shouldn't break stuff.

This commit is contained in:
Robin Ward 2014-08-27 14:04:00 -04:00
parent 09ea159afc
commit aab8eaac03
1 changed files with 11 additions and 2 deletions

View File

@ -108,7 +108,16 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
}, },
_toggleQuote: function($aside) { _toggleQuote: function($aside) {
if (this.get('expanding')) { return; }
this.set('expanding', true);
$aside.data('expanded', !$aside.data('expanded')); $aside.data('expanded', !$aside.data('expanded'));
var self = this,
finished = function() {
self.set('expanding', false);
};
if ($aside.data('expanded')) { if ($aside.data('expanded')) {
this._updateQuoteElements($aside, 'chevron-up'); this._updateQuoteElements($aside, 'chevron-up');
// Show expanded quote // Show expanded quote
@ -128,12 +137,12 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
Discourse.ajax("/posts/by_number/" + topicId + "/" + postId).then(function (result) { Discourse.ajax("/posts/by_number/" + topicId + "/" + postId).then(function (result) {
var parsed = $(result.cooked); var parsed = $(result.cooked);
parsed.replaceText(originalText, "<span class='highlighted'>" + originalText + "</span>"); parsed.replaceText(originalText, "<span class='highlighted'>" + originalText + "</span>");
$blockQuote.showHtml(parsed); $blockQuote.showHtml(parsed, 'fast', finished);
}); });
} else { } else {
// Hide expanded quote // Hide expanded quote
this._updateQuoteElements($aside, 'chevron-down'); this._updateQuoteElements($aside, 'chevron-down');
$('blockquote', $aside).showHtml($aside.data('original-contents')); $('blockquote', $aside).showHtml($aside.data('original-contents'), 'fast', finished);
} }
return false; return false;
}, },