Add an ENV variable to enable the stricter, plugin-incompatible ES6

behaviour for development.
This commit is contained in:
Robin Ward 2014-05-13 12:41:06 -04:00
parent b5239be2fa
commit ad90d9710d
5 changed files with 8 additions and 8 deletions

View File

@ -6,7 +6,7 @@
@namespace Discourse
@module Discourse
**/
Discourse.PosterExpansionController = Discourse.ObjectController.extend({
export default Discourse.ObjectController.extend({
needs: ['topic'],
visible: false,
user: null,

View File

@ -6,7 +6,7 @@
@namespace Discourse
@module Discourse
**/
Discourse.PreferencesAboutController = Discourse.ObjectController.extend({
export default Discourse.ObjectController.extend({
saving: false,
saveButtonText: function() {

View File

@ -86,10 +86,10 @@ Discourse.PreferencesAboutRoute = Discourse.RestrictedUserRoute.extend({
this.render('preferences', { into: 'user', outlet: 'userOutlet', controller: 'preferences' });
},
events: {
actions: {
changeAbout: function() {
var route = this;
var controller = route.controllerFor('preferencesAbout');
var controller = route.controllerFor('preferences/about');
controller.setProperties({ saving: true });
return controller.get('model').save().then(function() {

View File

@ -17,7 +17,7 @@ Discourse.TopicRoute = Discourse.Route.extend({
actions: {
// Modals that can pop up within a topic
showPosterExpansion: function(post) {
this.controllerFor('posterExpansion').show(post);
this.controllerFor('poster-expansion').show(post);
},
composePrivateMessage: function(user) {
@ -137,7 +137,7 @@ Discourse.TopicRoute = Discourse.Route.extend({
// Clear the search context
this.controllerFor('search').set('searchContext', null);
this.controllerFor('posterExpansion').set('visible', false);
this.controllerFor('poster-expansion').set('visible', false);
var topicController = this.controllerFor('topic'),
postStream = topicController.get('postStream');

View File

@ -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 scope.logical_path =~ /discourse\/controllers\/(.*)/
if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /discourse\/controllers\/(.*)/
class_name = Regexp.last_match[1].gsub(/[\-\/]/, '_').classify
@output << "\n\nDiscourse.#{class_name}Controller = require('#{scope.logical_path}').default"
end