This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/views/modal/flag_view.js
2014-02-12 12:57:55 -05:00

29 lines
772 B
JavaScript

/**
This view handles the modal for flagging posts
@class FlagView
@extends Discourse.ModalBodyView
@namespace Discourse
@module Discourse
**/
Discourse.FlagView = Discourse.ModalBodyView.extend({
templateName: 'modal/flag',
title: function() {
return this.get('controller.flagTopic') ? I18n.t('flagging_topic.title') : I18n.t('flagging.title');
}.property('controller.flagTopic'),
selectedChanged: function() {
var flagView = this;
Em.run.next(function() {
flagView.$("input[type='radio']").prop('checked', false);
var nameKey = flagView.get('controller.selected.name_key');
if (!nameKey) return;
flagView.$('#radio_' + nameKey).prop('checked', 'true');
});
}.observes('controller.selected.name_key')
});