mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Don't reload the page when auto close time is changed
This commit is contained in:
parent
b7cdee4d5c
commit
6d47d4854e
2 changed files with 6 additions and 1 deletions
|
@ -29,13 +29,14 @@ Discourse.EditTopicAutoCloseView = Discourse.ModalBodyView.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setAutoClose: function(days) {
|
setAutoClose: function(days) {
|
||||||
|
var view = this;
|
||||||
Discourse.ajax({
|
Discourse.ajax({
|
||||||
url: "/t/" + this.get('topic.id') + "/autoclose",
|
url: "/t/" + this.get('topic.id') + "/autoclose",
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { auto_close_days: days > 0 ? days : null }
|
data: { auto_close_days: days > 0 ? days : null }
|
||||||
}).then(function(){
|
}).then(function(){
|
||||||
window.location.reload();
|
view.get('topic').set('auto_close_at', Date.create(days + ' days from now').toJSON());
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
bootbox.alert(Em.String.i18n('generic_error'));
|
bootbox.alert(Em.String.i18n('generic_error'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,10 @@ Discourse.TopicClosingView = Discourse.View.extend({
|
||||||
elementId: 'topic-closing-info',
|
elementId: 'topic-closing-info',
|
||||||
templateName: 'topic_closing',
|
templateName: 'topic_closing',
|
||||||
|
|
||||||
|
contentChanged: function() {
|
||||||
|
this.rerender();
|
||||||
|
}.observes('topic.auto_close_at'),
|
||||||
|
|
||||||
render: function(buffer) {
|
render: function(buffer) {
|
||||||
if (!this.present('topic.auto_close_at')) return;
|
if (!this.present('topic.auto_close_at')) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue