diff --git a/app/assets/javascripts/admin/helpers/report_helpers.js b/app/assets/javascripts/admin/helpers/report_helpers.js deleted file mode 100644 index 5d0ee1ac4..000000000 --- a/app/assets/javascripts/admin/helpers/report_helpers.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - Return the count of users at the given trust level. - - @method valueAtTrustLevel - @for Handlebars -**/ -Handlebars.registerHelper('valueAtTrustLevel', function(property, trustLevel) { - var data = Ember.Handlebars.get(this, property); - if( data ) { - var item = data.find( function(d) { return parseInt(d.x,10) === parseInt(trustLevel,10); } ); - if( item ) { - return item.y; - } else { - return 0; - } - } -}); diff --git a/app/assets/javascripts/admin/helpers/value-at-tl.js.es6 b/app/assets/javascripts/admin/helpers/value-at-tl.js.es6 new file mode 100644 index 000000000..8fdc4e5d2 --- /dev/null +++ b/app/assets/javascripts/admin/helpers/value-at-tl.js.es6 @@ -0,0 +1,13 @@ +import registerUnbound from 'discourse/helpers/register-unbound'; + +registerUnbound('value-at-tl', function(data, params) { + var tl = parseInt(params.level, 10); + if (data) { + var item = data.find( function(d) { return parseInt(d.x, 10) === tl; } ); + if (item) { + return item.y; + } else { + return 0; + } + } +}); diff --git a/app/assets/javascripts/admin/models/site_setting.js b/app/assets/javascripts/admin/models/site_setting.js index aa43219b4..0c32fcbab 100644 --- a/app/assets/javascripts/admin/models/site_setting.js +++ b/app/assets/javascripts/admin/models/site_setting.js @@ -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'), /** diff --git a/app/assets/javascripts/admin/models/user-field.js.es6 b/app/assets/javascripts/admin/models/user-field.js.es6 index 56218d8d8..e5c3348ef 100644 --- a/app/assets/javascripts/admin/models/user-field.js.es6 +++ b/app/assets/javascripts/admin/models/user-field.js.es6 @@ -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); } }); diff --git a/app/assets/javascripts/admin/routes/admin_email_index_route.js b/app/assets/javascripts/admin/routes/admin_email_index_route.js index 718afa426..479d59117 100644 --- a/app/assets/javascripts/admin/routes/admin_email_index_route.js +++ b/app/assets/javascripts/admin/routes/admin_email_index_route.js @@ -1,13 +1,4 @@ -/** - Handles email routes - - @class AdminEmailRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ Discourse.AdminEmailIndexRoute = Discourse.Route.extend({ - model: function() { return Discourse.EmailSettings.find(); }, diff --git a/app/assets/javascripts/admin/templates/api.hbs b/app/assets/javascripts/admin/templates/api.hbs index 13267da91..c37c468db 100644 --- a/app/assets/javascripts/admin/templates/api.hbs +++ b/app/assets/javascripts/admin/templates/api.hbs @@ -5,21 +5,21 @@ {{i18n 'admin.api.user'}}   - {{#each model}} + {{#each k in model}} - {{key}} + {{k.key}} - {{#if user}} - {{#link-to 'adminUser' user}} - {{avatar user imageSize="small"}} + {{#if k.user}} + {{#link-to 'adminUser' k.user}} + {{avatar k.user imageSize="small"}} {{/link-to}} {{else}} {{i18n 'admin.api.all_users'}} {{/if}} - - + + {{/each}} diff --git a/app/assets/javascripts/admin/templates/badges-show.hbs b/app/assets/javascripts/admin/templates/badges-show.hbs index 79b2589ff..2a6b74f16 100644 --- a/app/assets/javascripts/admin/templates/badges-show.hbs +++ b/app/assets/javascripts/admin/templates/badges-show.hbs @@ -26,21 +26,21 @@
- {{view Ember.Select name="badge_type_id" - value=buffered.badge_type_id - content=badgeTypes - optionValuePath="content.id" - optionLabelPath="content.name" - disabled=readOnly}} + {{view "select" name="badge_type_id" + value=buffered.badge_type_id + content=badgeTypes + optionValuePath="content.id" + optionLabelPath="content.name" + disabled=readOnly}}
- {{view Ember.Select name="badge_grouping_id" - value=buffered.badge_grouping_id - content=badgeGroupings - optionValuePath="content.id" - optionLabelPath="content.name"}} + {{view "select" name="badge_grouping_id" + value=buffered.badge_grouping_id + content=badgeGroupings + optionValuePath="content.id" + optionLabelPath="content.name"}}  
@@ -83,12 +83,12 @@
- {{view Ember.Select name="trigger" - value=buffered.trigger - content=badgeTriggers - optionValuePath="content.id" - optionLabelPath="content.name" - disabled=readOnly}} + {{view "select" name="trigger" + value=buffered.trigger + content=badgeTriggers + optionValuePath="content.id" + optionLabelPath="content.name" + disabled=readOnly}}
{{/if}} diff --git a/app/assets/javascripts/admin/templates/badges.hbs b/app/assets/javascripts/admin/templates/badges.hbs index efee80a60..c128c6fb9 100644 --- a/app/assets/javascripts/admin/templates/badges.hbs +++ b/app/assets/javascripts/admin/templates/badges.hbs @@ -3,11 +3,11 @@

{{i18n 'admin.badges.title'}}