REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS

This change is discussed here: https://meta.discourse.org/t/deprecating-es6-compatibility-layer/35821

Prior to this change we were not booting correctly with DISCOURSE_NO_CONSTANTS
This commit is contained in:
Sam
2015-11-21 00:14:50 +11:00
parent f5b34d5f53
commit c0b277d273
98 changed files with 380 additions and 379 deletions

View File

@@ -1,3 +1,5 @@
import AdminUser from 'admin/models/admin-user';
export default Ember.Component.extend({
classNames: ["ip-lookup"],
@@ -42,7 +44,7 @@ export default Ember.Component.extend({
self.set("totalOthersWithSameIP", result.total);
});
Discourse.AdminUser.findAll("active", data).then(function (users) {
AdminUser.findAll("active", data).then(function (users) {
self.setProperties({
other_accounts: users,
otherAccountsLoading: false,

View File

@@ -1,3 +1,5 @@
import Permalink from 'admin/models/permalink';
export default Ember.Component.extend({
classNames: ['permalink-form'],
formSubmitted: false,
@@ -21,12 +23,12 @@ export default Ember.Component.extend({
if (!this.get('formSubmitted')) {
const self = this;
self.set('formSubmitted', true);
const permalink = Discourse.Permalink.create({url: self.get('url'), permalink_type: self.get('permalinkType'), permalink_type_value: self.get('permalink_type_value')});
const permalink = Permalink.create({url: self.get('url'), permalink_type: self.get('permalinkType'), permalink_type_value: self.get('permalink_type_value')});
permalink.save().then(function(result) {
self.set('url', '');
self.set('permalink_type_value', '');
self.set('formSubmitted', false);
self.sendAction('action', Discourse.Permalink.create(result.permalink));
self.sendAction('action', Permalink.create(result.permalink));
Em.run.schedule('afterRender', function() { self.$('.permalink-url').focus(); });
}, function(e) {
self.set('formSubmitted', false);

View File

@@ -10,7 +10,7 @@
uploadText="UPLOAD"
}}
**/
Discourse.ResumableUploadComponent = Ember.Component.extend(Discourse.StringBuffer, {
const ResumableUploadComponent = Ember.Component.extend(Discourse.StringBuffer, {
tagName: "button",
classNames: ["btn", "ru"],
classNameBindings: ["isUploading"],
@@ -118,3 +118,5 @@ Discourse.ResumableUploadComponent = Ember.Component.extend(Discourse.StringBuff
}.on("willDestroyElement")
});
export default ResumableUploadComponent;

View File

@@ -1,3 +1,4 @@
import ScreenedIpAddress from 'admin/models/screened_ip_address';
/**
A form to create an IP address that will be blocked or whitelisted.
Example usage:
@@ -13,7 +14,7 @@
@namespace Discourse
@module Discourse
**/
Discourse.ScreenedIpAddressFormComponent = Ember.Component.extend({
const ScreenedIpAddressFormComponent = Ember.Component.extend({
classNames: ['screened-ip-address-form'],
formSubmitted: false,
actionName: 'block',
@@ -42,11 +43,11 @@ Discourse.ScreenedIpAddressFormComponent = Ember.Component.extend({
if (!this.get('formSubmitted')) {
var self = this;
this.set('formSubmitted', true);
var screenedIpAddress = Discourse.ScreenedIpAddress.create({ip_address: this.get('ip_address'), action_name: this.get('actionName')});
var screenedIpAddress = ScreenedIpAddress.create({ip_address: this.get('ip_address'), action_name: this.get('actionName')});
screenedIpAddress.save().then(function(result) {
self.set('ip_address', '');
self.set('formSubmitted', false);
self.sendAction('action', Discourse.ScreenedIpAddress.create(result.screened_ip_address));
self.sendAction('action', ScreenedIpAddress.create(result.screened_ip_address));
Em.run.schedule('afterRender', function() { self.$('.ip-address-input').focus(); });
}, function(e) {
self.set('formSubmitted', false);
@@ -74,3 +75,5 @@ Discourse.ScreenedIpAddressFormComponent = Ember.Component.extend({
});
}
});
export default ScreenedIpAddressFormComponent;