Fix rerender of topic close message when you navigate away from a closing topic

This commit is contained in:
Neil Lalonde 2013-05-13 16:17:16 -04:00
parent 6d47d4854e
commit 957d95c1cc
2 changed files with 9 additions and 2 deletions

View file

@ -10,6 +10,7 @@
Discourse.TopicClosingView = Discourse.View.extend({ Discourse.TopicClosingView = Discourse.View.extend({
elementId: 'topic-closing-info', elementId: 'topic-closing-info',
templateName: 'topic_closing', templateName: 'topic_closing',
delayedRerender: null,
contentChanged: function() { contentChanged: function() {
this.rerender(); this.rerender();
@ -46,6 +47,12 @@ Discourse.TopicClosingView = Discourse.View.extend({
buffer.push( Em.String.i18n('topic.auto_close_notice', {timeLeft: timeLeftString}) ); buffer.push( Em.String.i18n('topic.auto_close_notice', {timeLeft: timeLeftString}) );
buffer.push('</h3>'); buffer.push('</h3>');
this.rerender.bind(this).delay(reRenderDelay); this.delayedRerender = this.rerender.bind(this).delay(reRenderDelay);
},
willDestroyElement: function() {
if( this.delayedRerender ) {
this.delayedRerender.cancel();
}
} }
}); });

View file

@ -496,7 +496,7 @@ en:
jump_reply_down: jump to later reply jump_reply_down: jump to later reply
deleted: "The topic has been deleted" deleted: "The topic has been deleted"
auto_close_notice: "This topic will automatically close %{timeLeft}" auto_close_notice: "This topic will automatically close %{timeLeft}."
auto_close_title: 'Auto-Close Settings' auto_close_title: 'Auto-Close Settings'
auto_close_save: "Save" auto_close_save: "Save"
auto_close_cancel: "Cancel" auto_close_cancel: "Cancel"