discourse/app/assets/javascripts/discourse/views/flag.js.es6
2015-05-11 11:20:45 -04:00

27 lines
839 B
JavaScript

import ModalBodyView from "discourse/views/modal-body";
export default ModalBodyView.extend({
templateName: 'modal/flag',
title: function() {
return this.get('controller.flagTopic') ? I18n.t('flagging_topic.title') : I18n.t('flagging.title');
}.property('controller.flagTopic'),
_selectRadio: function() {
this.$("input[type='radio']").prop('checked', false);
const nameKey = this.get('controller.selected.name_key');
if (!nameKey) { return; }
this.$('#radio_' + nameKey).prop('checked', 'true');
},
selectedChanged: function() {
Ember.run.next(this, this._selectRadio);
}.observes('controller.selected.name_key'),
// See: https://github.com/emberjs/ember.js/issues/10869
_selectedHack: function() {
this.removeObserver('controller.selected.name_key');
}.on('willDestroyElement')
});