diff --git a/app/assets/javascripts/admin/controllers/admin-commits.js.es6 b/app/assets/javascripts/admin/controllers/admin-commits.js.es6 new file mode 100644 index 00000000000..1690f1291ff --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin-commits.js.es6 @@ -0,0 +1,7 @@ +export default Ember.ArrayController.extend({ + actions: { + goToGithub: function() { + window.open('https://github.com/discourse/discourse'); + } + } +}); diff --git a/app/assets/javascripts/admin/controllers/admin-email-all.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-all.js.es6 index 981d253ced6..5f456c108fc 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-all.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-all.js.es6 @@ -1,3 +1,3 @@ -import AdminEmailSkippedController from "admin/controllers/admin-email-skipped" +import AdminEmailSkippedController from "admin/controllers/admin-email-skipped"; -export default AdminEmailSkippedController.extend({}); +export default AdminEmailSkippedController.extend(); diff --git a/app/assets/javascripts/admin/controllers/admin-github-commits.js.es6 b/app/assets/javascripts/admin/controllers/admin-github-commits.js.es6 deleted file mode 100644 index 4703ab6f244..00000000000 --- a/app/assets/javascripts/admin/controllers/admin-github-commits.js.es6 +++ /dev/null @@ -1,13 +0,0 @@ -/** - This controller is for the widget that shows the commits to the discourse repo. - - @class AdminGithubCommitsController - @extends Ember.ArrayController - @namespace Discourse - @module Discourse -**/ -export default Ember.ArrayController.extend({ - goToGithub: function() { - window.open('https://github.com/discourse/discourse'); - } -}); diff --git a/app/assets/javascripts/admin/controllers/admin-groups.js.es6 b/app/assets/javascripts/admin/controllers/admin-groups.js.es6 index 694c3ebe65f..03de7cfe982 100644 --- a/app/assets/javascripts/admin/controllers/admin-groups.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-groups.js.es6 @@ -21,6 +21,4 @@ export default Ember.ArrayController.extend({ }); } } - }); - diff --git a/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 b/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 index 57137c366e1..5fd66c287d8 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js.es6 @@ -9,7 +9,7 @@ export default Ember.ArrayController.extend(Discourse.Presence, { loading: false, content: [], - itemController: 'adminLogsScreenedIpAddress', + itemController: 'admin-log-screened-ip-address', show: function() { var self = this; diff --git a/app/assets/javascripts/admin/controllers/admin-reports.js.es6 b/app/assets/javascripts/admin/controllers/admin-reports.js.es6 index f28ac3cf314..9a8a4555c88 100644 --- a/app/assets/javascripts/admin/controllers/admin-reports.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-reports.js.es6 @@ -1,6 +1,5 @@ export default Ember.ObjectController.extend({ viewMode: 'table', - viewingTable: Em.computed.equal('viewMode', 'table'), viewingBarChart: Em.computed.equal('viewMode', 'barChart'), diff --git a/app/assets/javascripts/admin/controllers/admin-site-contents.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-contents.js.es6 index 484c810b5c7..24c4c051390 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-contents.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-contents.js.es6 @@ -1 +1 @@ -export default Ember.ArrayController.extend({}); +export default Ember.ArrayController.extend(); diff --git a/app/assets/javascripts/admin/controllers/admin-staff-action-log-details.js.es6 b/app/assets/javascripts/admin/controllers/admin-staff-action-log-details.js.es6 index a81b8051ae7..583516c3feb 100644 --- a/app/assets/javascripts/admin/controllers/admin-staff-action-log-details.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-staff-action-log-details.js.es6 @@ -7,4 +7,4 @@ @uses Discourse.ModalFunctionality @module Discourse **/ -export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {}); +export default Discourse.ObjectController.extend(Discourse.ModalFunctionality); diff --git a/app/assets/javascripts/admin/controllers/admin-user.js.es6 b/app/assets/javascripts/admin/controllers/admin-user.js.es6 index cd3ce98ddb2..6a196f98686 100644 --- a/app/assets/javascripts/admin/controllers/admin-user.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user.js.es6 @@ -7,4 +7,4 @@ @namespace Discourse @module Discourse **/ -export default Discourse.ObjectController.extend({}); +export default Discourse.ObjectController.extend(); diff --git a/app/assets/javascripts/admin/controllers/change-site-customization-details.js.es6 b/app/assets/javascripts/admin/controllers/change-site-customization-details.js.es6 index e5df492ca5b..b7e60c92eb1 100644 --- a/app/assets/javascripts/admin/controllers/change-site-customization-details.js.es6 +++ b/app/assets/javascripts/admin/controllers/change-site-customization-details.js.es6 @@ -1,13 +1,3 @@ -/** - The modal for viewing the details of a staff action log record - for when a site customization is created or changed. - - @class ChangeSiteCustomizationDetailsController - @extends Discourse.Controller - @namespace Discourse - @uses Discourse.ModalFunctionality - @module Discourse -**/ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, { previousSelected: Ember.computed.equal('selectedTab', 'previous'), newSelected: Ember.computed.equal('selectedTab', 'new'), diff --git a/app/assets/javascripts/admin/controllers/delete-site-customization-details.js.es6 b/app/assets/javascripts/admin/controllers/delete-site-customization-details.js.es6 index 049a362fa89..07100e681b7 100644 --- a/app/assets/javascripts/admin/controllers/delete-site-customization-details.js.es6 +++ b/app/assets/javascripts/admin/controllers/delete-site-customization-details.js.es6 @@ -8,7 +8,7 @@ @uses Discourse.ModalFunctionality @module Discourse **/ -import ChangeSiteCustomizationDetailsController from "admin/controllers/change-site-customization-details-controller"; +import ChangeSiteCustomizationDetailsController from "admin/controllers/change-site-customization-details"; export default ChangeSiteCustomizationDetailsController.extend({ onShow: function() { diff --git a/app/assets/javascripts/admin/routes/admin_user_badges_route.js b/app/assets/javascripts/admin/routes/admin_user_badges_route.js index de4224f523d..f681e6f9192 100644 --- a/app/assets/javascripts/admin/routes/admin_user_badges_route.js +++ b/app/assets/javascripts/admin/routes/admin_user_badges_route.js @@ -9,7 +9,7 @@ **/ Discourse.AdminUserBadgesRoute = Discourse.Route.extend({ model: function() { - var username = this.controllerFor('adminUser').get('username'); + var username = this.modelFor('adminUser').get('username'); return Discourse.UserBadge.findByUsername(username); }, diff --git a/app/assets/javascripts/discourse/ember/resolver.js b/app/assets/javascripts/discourse/ember/resolver.js index 30f032a0070..84e6bd319a3 100644 --- a/app/assets/javascripts/discourse/ember/resolver.js +++ b/app/assets/javascripts/discourse/ember/resolver.js @@ -12,22 +12,22 @@ var classify = Ember.String.classify; var get = Ember.get; function parseName(fullName) { - /*jshint validthis:true */ + /*jshint validthis:true */ - var nameParts = fullName.split(":"), - type = nameParts[0], fullNameWithoutType = nameParts[1], - name = fullNameWithoutType, - namespace = get(this, 'namespace'), - root = namespace; + var nameParts = fullName.split(":"), + type = nameParts[0], fullNameWithoutType = nameParts[1], + name = fullNameWithoutType, + namespace = get(this, 'namespace'), + root = namespace; - return { - fullName: fullName, - type: type, - fullNameWithoutType: fullNameWithoutType, - name: name, - root: root, - resolveMethodName: "resolve" + classify(type) - }; + return { + fullName: fullName, + type: type, + fullNameWithoutType: fullNameWithoutType, + name: name, + root: root, + resolveMethodName: "resolve" + classify(type) + }; } Discourse.Resolver = Ember.DefaultResolver.extend({ @@ -40,6 +40,9 @@ Discourse.Resolver = Ember.DefaultResolver.extend({ var discourseBase = 'discourse/' + split[0] + 's/'; var adminBase = 'admin/' + split[0] + 's/'; + // Allow render 'admin/templates/xyz' too + split[1] = split[1].replace('.templates', '').replace('/templates', ''); + // Try slashes var dashed = Ember.String.dasherize(split[1].replace(/\./g, '/')); if (requirejs.entries[discourseBase + dashed] || requirejs.entries[adminBase + dashed]) { diff --git a/app/assets/javascripts/main_include_admin.js b/app/assets/javascripts/main_include_admin.js index 5e1943fba4b..3c9d429d3e8 100644 --- a/app/assets/javascripts/main_include_admin.js +++ b/app/assets/javascripts/main_include_admin.js @@ -1,3 +1,5 @@ +//= require admin/controllers/admin-email-skipped +//= require admin/controllers/change-site-customization-details //= require_tree ./admin //= require resumable.js diff --git a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb index 8afe502ce05..23aeac8cddf 100644 --- a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb +++ b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb @@ -70,9 +70,9 @@ module Tilt # For backwards compatibility with plugins, for now export the Global format too. # We should eventually have an upgrade system for plugins to use ES6 or some other # resolve based API. - if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /discourse\/(controllers|components|views|routes)\/(.*)/ - type = Regexp.last_match[1] - file_name = Regexp.last_match[2].gsub(/[\-\/]/, '_') + if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /(discourse|admin)\/(controllers|components|views|routes)\/(.*)/ + type = Regexp.last_match[2] + file_name = Regexp.last_match[3].gsub(/[\-\/]/, '_') class_name = file_name.classify # Rails removes pluralization when calling classify