Fixes many Ember 1.9.0 deprecations

This commit is contained in:
Robin Ward
2014-12-12 13:28:20 -05:00
parent 331bba4b6d
commit f3babdb319
48 changed files with 417 additions and 436 deletions
@@ -9,16 +9,13 @@ Discourse.SiteSetting = Discourse.Model.extend({
**/
enabled: function(key, value) {
if (arguments.length === 1) {
// get the boolean value of the setting
if (this.blank('value')) return false;
return this.get('value') === 'true';
} else {
// set the boolean value of the setting
if (arguments.length > 1) {
this.set('value', value ? 'true' : 'false');
}
if (this.blank('value')) return false;
return this.get('value') === 'true';
}.property('value'),
/**
@@ -1,8 +1,3 @@
var _fieldTypes = [
Ember.Object.create({id: 'text', name: I18n.t('admin.user_fields.field_types.text') }),
Ember.Object.create({id: 'confirm', name: I18n.t('admin.user_fields.field_types.confirm') })
];
var UserField = Ember.Object.extend({
destroy: function() {
var self = this;
@@ -43,11 +38,18 @@ UserField.reopenClass({
},
fieldTypes: function() {
return _fieldTypes;
if (!this._fieldTypes) {
this._fieldTypes = [
Ember.Object.create({id: 'text', name: I18n.t('admin.user_fields.field_types.text') }),
Ember.Object.create({id: 'confirm', name: I18n.t('admin.user_fields.field_types.confirm') })
];
}
return this._fieldTypes;
},
fieldTypeById: function(id) {
return _fieldTypes.findBy('id', id);
return this.fieldTypes().findBy('id', id);
}
});