Add an ENV variable to enable the stricter, plugin-incompatible ES6
behaviour for development.
This commit is contained in:
parent
b5239be2fa
commit
ad90d9710d
app/assets/javascripts/discourse
lib/es6_module_transpiler/tilt
|
@ -6,7 +6,7 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.PosterExpansionController = Discourse.ObjectController.extend({
|
export default Discourse.ObjectController.extend({
|
||||||
needs: ['topic'],
|
needs: ['topic'],
|
||||||
visible: false,
|
visible: false,
|
||||||
user: null,
|
user: null,
|
|
@ -6,7 +6,7 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.PreferencesAboutController = Discourse.ObjectController.extend({
|
export default Discourse.ObjectController.extend({
|
||||||
saving: false,
|
saving: false,
|
||||||
|
|
||||||
saveButtonText: function() {
|
saveButtonText: function() {
|
||||||
|
@ -14,4 +14,4 @@ Discourse.PreferencesAboutController = Discourse.ObjectController.extend({
|
||||||
return I18n.t("user.change");
|
return I18n.t("user.change");
|
||||||
}.property('saving')
|
}.property('saving')
|
||||||
|
|
||||||
});
|
});
|
|
@ -86,10 +86,10 @@ Discourse.PreferencesAboutRoute = Discourse.RestrictedUserRoute.extend({
|
||||||
this.render('preferences', { into: 'user', outlet: 'userOutlet', controller: 'preferences' });
|
this.render('preferences', { into: 'user', outlet: 'userOutlet', controller: 'preferences' });
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
actions: {
|
||||||
changeAbout: function() {
|
changeAbout: function() {
|
||||||
var route = this;
|
var route = this;
|
||||||
var controller = route.controllerFor('preferencesAbout');
|
var controller = route.controllerFor('preferences/about');
|
||||||
|
|
||||||
controller.setProperties({ saving: true });
|
controller.setProperties({ saving: true });
|
||||||
return controller.get('model').save().then(function() {
|
return controller.get('model').save().then(function() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ Discourse.TopicRoute = Discourse.Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
// Modals that can pop up within a topic
|
// Modals that can pop up within a topic
|
||||||
showPosterExpansion: function(post) {
|
showPosterExpansion: function(post) {
|
||||||
this.controllerFor('posterExpansion').show(post);
|
this.controllerFor('poster-expansion').show(post);
|
||||||
},
|
},
|
||||||
|
|
||||||
composePrivateMessage: function(user) {
|
composePrivateMessage: function(user) {
|
||||||
|
@ -137,7 +137,7 @@ Discourse.TopicRoute = Discourse.Route.extend({
|
||||||
|
|
||||||
// Clear the search context
|
// Clear the search context
|
||||||
this.controllerFor('search').set('searchContext', null);
|
this.controllerFor('search').set('searchContext', null);
|
||||||
this.controllerFor('posterExpansion').set('visible', false);
|
this.controllerFor('poster-expansion').set('visible', false);
|
||||||
|
|
||||||
var topicController = this.controllerFor('topic'),
|
var topicController = this.controllerFor('topic'),
|
||||||
postStream = topicController.get('postStream');
|
postStream = topicController.get('postStream');
|
||||||
|
|
|
@ -68,7 +68,7 @@ module Tilt
|
||||||
# For backwards compatibility with plugins, for now export the Global format too.
|
# 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
|
# We should eventually have an upgrade system for plugins to use ES6 or some other
|
||||||
# resolve based API.
|
# 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
|
class_name = Regexp.last_match[1].gsub(/[\-\/]/, '_').classify
|
||||||
@output << "\n\nDiscourse.#{class_name}Controller = require('#{scope.logical_path}').default"
|
@output << "\n\nDiscourse.#{class_name}Controller = require('#{scope.logical_path}').default"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue