Revert "Revert "REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS""

This reverts commit c21457d6a7.
This commit is contained in:
Sam
2015-11-21 12:27:06 +11:00
parent d8734fc542
commit 5c899c765b
99 changed files with 394 additions and 384 deletions
@@ -1,3 +1,4 @@
export default Ember.Component.extend({
classNames: ["ip-lookup"],
@@ -42,7 +43,8 @@ export default Ember.Component.extend({
self.set("totalOthersWithSameIP", result.total);
});
Discourse.AdminUser.findAll("active", data).then(function (users) {
const AdminUser = require('admin/models/admin-user').default;
AdminUser.findAll("active", data).then(function (users) {
self.setProperties({
other_accounts: users,
otherAccountsLoading: false,
@@ -18,15 +18,17 @@ export default Ember.Component.extend({
actions: {
submit: function() {
const Permalink = require('admin/models/permalink').default;
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);
@@ -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;
@@ -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;