mirror of
https://github.com/discourse/discourse.git
synced 2025-04-09 08:44:25 +08:00
FIX: The previous flag reason was selected when opening the modal.
This commit is contained in:
parent
e73c809836
commit
112b9f9c2a
@ -9,6 +9,10 @@
|
|||||||
**/
|
**/
|
||||||
Discourse.FlagController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
Discourse.FlagController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||||
|
|
||||||
|
onShow: function() {
|
||||||
|
this.set('selected', null);
|
||||||
|
},
|
||||||
|
|
||||||
changePostActionType: function(action) {
|
changePostActionType: function(action) {
|
||||||
this.set('selected', action);
|
this.set('selected', action);
|
||||||
},
|
},
|
||||||
|
@ -11,18 +11,15 @@ Discourse.FlagView = Discourse.ModalBodyView.extend({
|
|||||||
title: I18n.t('flagging.title'),
|
title: I18n.t('flagging.title'),
|
||||||
|
|
||||||
selectedChanged: function() {
|
selectedChanged: function() {
|
||||||
var nameKey = this.get('controller.selected.name_key');
|
var flagView = this;
|
||||||
if (!nameKey) return;
|
|
||||||
Em.run.next(function() {
|
Em.run.next(function() {
|
||||||
$('#radio_' + nameKey).prop('checked', 'true');
|
flagView.$("input[type='radio']").prop('checked', false);
|
||||||
});
|
|
||||||
}.observes('controller.selected.name_key'),
|
|
||||||
|
|
||||||
didInsertElement: function() {
|
var nameKey = flagView.get('controller.selected.name_key');
|
||||||
this._super();
|
if (!nameKey) return;
|
||||||
|
|
||||||
|
flagView.$('#radio_' + nameKey).prop('checked', 'true');
|
||||||
|
});
|
||||||
|
}.observes('controller.selected.name_key')
|
||||||
|
|
||||||
// Would be nice if there were an EmberJs radio button to do this for us. Oh well, one should be coming
|
|
||||||
// in an upcoming release.
|
|
||||||
this.$("input[type='radio']").prop('checked', false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user