From fd3ceae1d651a7c422096a5bc6611e4a76f56904 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 22 Jul 2014 12:09:11 -0400 Subject: [PATCH] ES6: Enable compatibility layer for routes --- app/assets/javascripts/discourse/routes/user-badges.js.es6 | 2 +- .../tilt/es6_module_transpiler_template.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/user-badges.js.es6 b/app/assets/javascripts/discourse/routes/user-badges.js.es6 index cb2aa0c87be..8d68ae0263b 100644 --- a/app/assets/javascripts/discourse/routes/user-badges.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-badges.js.es6 @@ -1,4 +1,4 @@ -Discourse.UserBadgesRoute = Discourse.Route.extend({ +export default Discourse.Route.extend({ model: function() { return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username_lower'), {grouped: true}); }, 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 8e558ea2ca0..11e1bfed45d 100644 --- a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb +++ b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb @@ -68,7 +68,7 @@ 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)\/(.*)/ + 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(/[\-\/]/, '_') class_name = file_name.classify