mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 06:13:45 +08:00
Merge pull request #450 from ZogStriP/fixes-category-bug-on-cancel
fixes bug when modifying the category of a topic but cancelling the edit
This commit is contained in:
commit
8760f58f3d
|
@ -347,6 +347,11 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
},
|
},
|
||||||
|
|
||||||
cancelEdit: function() {
|
cancelEdit: function() {
|
||||||
|
// set the previous category back
|
||||||
|
this.set('controller.content.category', this.get('previousCategory'));
|
||||||
|
// clear the previous category
|
||||||
|
this.set('previousCategory', null);
|
||||||
|
// close editing mode
|
||||||
this.set('editingTopic', false);
|
this.set('editingTopic', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -358,12 +363,18 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
topic.set('title', new_val);
|
topic.set('title', new_val);
|
||||||
topic.set('fancy_title', new_val);
|
topic.set('fancy_title', new_val);
|
||||||
topic.save();
|
topic.save();
|
||||||
|
// clear the previous category
|
||||||
|
this.set('previousCategory', null);
|
||||||
|
// close editing mode
|
||||||
this.set('editingTopic', false);
|
this.set('editingTopic', false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
editTopic: function() {
|
editTopic: function() {
|
||||||
if (!this.get('topic.can_edit')) return false;
|
if (!this.get('topic.can_edit')) return false;
|
||||||
|
// save the category so we can get it back when cancelling the edit
|
||||||
|
this.set('previousCategory', this.get('controller.content.category'));
|
||||||
|
// enable editing mode
|
||||||
this.set('editingTopic', true);
|
this.set('editingTopic', true);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user