diff --git a/app/assets/javascripts/admin/controllers/admin_customize_controller.js b/app/assets/javascripts/admin/controllers/admin_customize_controller.js index ae06ea52212..ea758d099f0 100644 --- a/app/assets/javascripts/admin/controllers/admin_customize_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_customize_controller.js @@ -1,25 +1,30 @@ (function() { + /** + This controller supports interface for creating custom CSS skins in Discourse. + + @class AdminCustomizeController + @extends Ember.Controller + @namespace Discourse + @module Discourse + **/ window.Discourse.AdminCustomizeController = Ember.Controller.extend({ newCustomization: function() { - var item; - item = Discourse.SiteCustomization.create({ - name: 'New Style' - }); + var item = Discourse.SiteCustomization.create({name: 'New Style'}); this.get('content').pushObject(item); - return this.set('content.selectedItem', item); + this.set('content.selectedItem', item); }, selectStyle: function(style) { - return this.set('content.selectedItem', style); + this.set('content.selectedItem', style); }, save: function() { - return this.get('content.selectedItem').save(); + this.get('content.selectedItem').save(); }, - "delete": function() { + destroy: function() { var _this = this; return bootbox.confirm(Em.String.i18n("admin.customize.delete_confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) { var selected; @@ -31,7 +36,7 @@ } }); } - + }); }).call(this); diff --git a/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js b/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js index 142b9e18f5a..cb11e1dff83 100644 --- a/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js @@ -1,5 +1,13 @@ (function() { + /** + This controller supports the default interface when you enter the admin section. + + @class AdminDashboardController + @extends Ember.Controller + @namespace Discourse + @module Discourse + **/ window.Discourse.AdminDashboardController = Ember.Controller.extend({ loading: true, versionCheck: null, @@ -7,9 +15,8 @@ upToDate: (function() { if (this.versionCheck) { return this.versionCheck.latest_version === this.versionCheck.installed_version; - } else { - return true; } + return true; }).property('versionCheck'), updateIconClasses: (function() { @@ -26,11 +33,10 @@ priorityClass: (function() { if (this.get('versionCheck.critical_updates')) { return 'version-check critical'; - } else { - return 'version-check normal'; } + return 'version-check normal'; }).property('versionCheck') - + }); }).call(this); diff --git a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js index a8ce5f92220..23a450aca46 100644 --- a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js @@ -1,5 +1,13 @@ (function() { + /** + This controller supports the interface for reviewing email logs. + + @class AdminEmailLogsController + @extends Ember.ArrayController + @namespace Discourse + @module Discourse + **/ window.Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Presence, { sendTestEmailDisabled: (function() { @@ -8,13 +16,11 @@ sendTestEmail: function() { var _this = this; - this.set('sentTestEmail', false); + _this.set('sentTestEmail', false); jQuery.ajax({ url: '/admin/email_logs/test', type: 'POST', - data: { - email_address: this.get('testEmailAddress') - }, + data: { email_address: this.get('testEmailAddress') }, success: function() { return _this.set('sentTestEmail', true); } diff --git a/app/assets/javascripts/admin/controllers/admin_flags_controller.js b/app/assets/javascripts/admin/controllers/admin_flags_controller.js index de20e2fd4df..5fec9adb22c 100644 --- a/app/assets/javascripts/admin/controllers/admin_flags_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_flags_controller.js @@ -1,22 +1,30 @@ (function() { + /** + This controller supports the interface for dealing with flags in the admin section. + + @class AdminFlagsController + @extends Ember.Controller + @namespace Discourse + @module Discourse + **/ window.Discourse.AdminFlagsController = Ember.Controller.extend({ clearFlags: function(item) { var _this = this; - return item.clearFlags().then((function() { - return _this.content.removeObject(item); + item.clearFlags().then((function() { + _this.content.removeObject(item); }), (function() { - return bootbox.alert("something went wrong"); + bootbox.alert("something went wrong"); })); }, deletePost: function(item) { var _this = this; - return item.deletePost().then((function() { - return _this.content.removeObject(item); + item.deletePost().then((function() { + _this.content.removeObject(item); }), (function() { - return bootbox.alert("something went wrong"); + bootbox.alert("something went wrong"); })); }, diff --git a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js index fdf8100fe29..7f2ef2e7dd0 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js @@ -1,5 +1,13 @@ (function() { + /** + This controller supports the interface for SiteSettings. + + @class AdminSiteSettingsController + @extends Ember.ArrayController + @namespace Discourse + @module Discourse + **/ window.Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.Presence, { filter: null, onlyOverridden: false, @@ -7,44 +15,35 @@ filteredContent: (function() { var filter, _this = this; - if (!this.present('content')) { - return null; - } + if (!this.present('content')) return null; if (this.get('filter')) { filter = this.get('filter').toLowerCase(); } + return this.get('content').filter(function(item, index, enumerable) { - if (_this.get('onlyOverridden') && !item.get('overridden')) { - return false; - } + if (_this.get('onlyOverridden') && !item.get('overridden')) return false; if (filter) { - if (item.get('setting').toLowerCase().indexOf(filter) > -1) { - return true; - } - if (item.get('description').toLowerCase().indexOf(filter) > -1) { - return true; - } - if (item.get('value').toLowerCase().indexOf(filter) > -1) { - return true; - } + if (item.get('setting').toLowerCase().indexOf(filter) > -1) return true; + if (item.get('description').toLowerCase().indexOf(filter) > -1) return true; + if (item.get('value').toLowerCase().indexOf(filter) > -1) return true; return false; - } else { - return true; } + + return true; }); }).property('filter', 'content.@each', 'onlyOverridden'), resetDefault: function(setting) { setting.set('value', setting.get('default')); - return setting.save(); + setting.save(); }, save: function(setting) { - return setting.save(); + setting.save(); }, cancel: function(setting) { - return setting.resetValue(); + setting.resetValue(); } }); diff --git a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js index 1cbd5d9b61b..08f345c0679 100644 --- a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js @@ -1,5 +1,13 @@ (function() { + /** + This controller supports the interface for listing users in the admin section. + + @class AdminUsersListController + @extends Ember.ArrayController + @namespace Discourse + @module Discourse + **/ window.Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Presence, { username: null, query: null, @@ -8,35 +16,27 @@ selectAllChanged: (function() { var _this = this; - return this.get('content').each(function(user) { - return user.set('selected', _this.get('selectAll')); + this.get('content').each(function(user) { + user.set('selected', _this.get('selectAll')); }); }).observes('selectAll'), filterUsers: Discourse.debounce(function() { - return this.refreshUsers(); + this.refreshUsers(); }, 250).observes('username'), orderChanged: (function() { - return this.refreshUsers(); + this.refreshUsers(); }).observes('query'), showApproval: (function() { - if (!Discourse.SiteSettings.must_approve_users) { - return false; - } - if (this.get('query') === 'new') { - return true; - } - if (this.get('query') === 'pending') { - return true; - } + if (!Discourse.SiteSettings.must_approve_users) return false; + if (this.get('query') === 'new') return true; + if (this.get('query') === 'pending') return true; }).property('query'), selectedCount: (function() { - if (this.blank('content')) { - return 0; - } + if (this.blank('content')) return 0; return this.get('content').filterProperty('selected').length; }).property('content.@each.selected'), @@ -45,19 +45,20 @@ }).property('selectedCount'), refreshUsers: function() { - return this.set('content', Discourse.AdminUser.findAll(this.get('query'), this.get('username'))); + this.set('content', Discourse.AdminUser.findAll(this.get('query'), this.get('username'))); }, show: function(term) { if (this.get('query') === term) { - return this.refreshUsers(); - } else { - return this.set('query', term); + this.refreshUsers(); + return; } + + this.set('query', term); }, approveUsers: function() { - return Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected')); + Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected')); } }); diff --git a/app/assets/javascripts/admin/models/version_check.js b/app/assets/javascripts/admin/models/version_check.js index 893d7d24c71..79ac1365079 100644 --- a/app/assets/javascripts/admin/models/version_check.js +++ b/app/assets/javascripts/admin/models/version_check.js @@ -1,11 +1,6 @@ (function() { - window.Discourse.VersionCheck = Discourse.Model.extend({ - hasInstalledSha: function() { - console.log( 'hello??' ); - return( this.get('installed_sha') && this.get('installed_sha') != 'unknown' ); - }.property('installed_sha') - }); + window.Discourse.VersionCheck = Discourse.Model.extend({}); Discourse.VersionCheck.reopenClass({ find: function() { diff --git a/app/assets/javascripts/admin/templates/customize.js.handlebars b/app/assets/javascripts/admin/templates/customize.js.handlebars index f9359dee02b..40cceeba5d0 100644 --- a/app/assets/javascripts/admin/templates/customize.js.handlebars +++ b/app/assets/javascripts/admin/templates/customize.js.handlebars @@ -46,7 +46,7 @@ <div class='buttons'> <button {{action save target="controller"}} {{bindAttr disabled="content.selectedItem.disableSave"}} class='btn btn-primary'>{{i18n admin.customize.save}}</button> - <a {{action delete target="controller"}} class='delete-link'>{{i18n admin.customize.delete}}</a> + <a {{action destroy target="controller"}} class='delete-link'>{{i18n admin.customize.delete}}</a> <span class='saving'>{{content.savingStatus}}</span> </div> diff --git a/app/assets/javascripts/docs/yuidoc.json b/app/assets/javascripts/docs/yuidoc.json new file mode 100644 index 00000000000..4c6e9aff7ff --- /dev/null +++ b/app/assets/javascripts/docs/yuidoc.json @@ -0,0 +1,9 @@ +{ + "name": "Discourse Client", + "description": "This is the EmberJS client to access a Discourse Server", + "url": "http://www.discourse.org/", + "options": { + "exclude": "external,external_production", + "outdir": "./build" + } +} \ No newline at end of file