mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: Remove Discourse.Ajax
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
export default Ember.ArrayController.extend({
|
||||
needs: ["adminBackups"],
|
||||
status: Ember.computed.alias("controllers.adminBackups"),
|
||||
@@ -39,7 +40,7 @@ export default Ember.ArrayController.extend({
|
||||
|
||||
_toggleReadOnlyMode(enable) {
|
||||
var site = this.site;
|
||||
Discourse.ajax("/admin/backups/readonly", {
|
||||
ajax("/admin/backups/readonly", {
|
||||
type: "PUT",
|
||||
data: { enable: enable }
|
||||
}).then(function() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
export default Ember.Controller.extend({
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,7 @@ export default Ember.Controller.extend({
|
||||
});
|
||||
|
||||
var self = this;
|
||||
Discourse.ajax("/admin/email/test", {
|
||||
ajax("/admin/email/test", {
|
||||
type: 'POST',
|
||||
data: { email_address: this.get('testEmailAddress') }
|
||||
}).then(function () {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
export default Ember.ArrayController.extend({
|
||||
sortProperties: ["name"],
|
||||
|
||||
@@ -15,7 +16,7 @@ export default Ember.ArrayController.extend({
|
||||
I18n.t("yes_value"),
|
||||
function(destroy) {
|
||||
if (destroy) {
|
||||
return Discourse.ajax("/admin/customize/emojis/" + emoji.get("name"), { type: "DELETE" }).then(function() {
|
||||
return ajax("/admin/customize/emojis/" + emoji.get("name"), { type: "DELETE" }).then(function() {
|
||||
self.removeObject(emoji);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
|
||||
@@ -20,7 +21,7 @@ export default Ember.Controller.extend({
|
||||
.reject(x => x.length === 0);
|
||||
|
||||
this.set('saving', true);
|
||||
Discourse.ajax('/admin/groups/bulk', {
|
||||
ajax('/admin/groups/bulk', {
|
||||
data: { users, group_id: this.get('groupId') },
|
||||
method: 'PUT'
|
||||
}).then(() => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
export default Ember.ArrayController.extend({
|
||||
sortProperties: ['name'],
|
||||
refreshingAutoGroups: false,
|
||||
@@ -9,7 +10,7 @@ export default Ember.ArrayController.extend({
|
||||
refreshAutoGroups: function(){
|
||||
var self = this;
|
||||
this.set('refreshingAutoGroups', true);
|
||||
Discourse.ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'}).then(function() {
|
||||
ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'}).then(function() {
|
||||
self.transitionToRoute("adminGroupsType", "automatic").then(function() {
|
||||
self.set('refreshingAutoGroups', false);
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
||||
import { propertyNotEqual, setting } from 'discourse/lib/computed';
|
||||
|
||||
@@ -38,7 +39,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
saveTitle() {
|
||||
const self = this;
|
||||
|
||||
return Discourse.ajax("/users/" + this.get('model.username').toLowerCase(), {
|
||||
return ajax("/users/" + this.get('model.username').toLowerCase(), {
|
||||
data: {title: this.get('userTitleValue')},
|
||||
type: 'PUT'
|
||||
}).catch(function(e) {
|
||||
@@ -68,7 +69,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
savePrimaryGroup() {
|
||||
const self = this;
|
||||
|
||||
return Discourse.ajax("/admin/users/" + this.get('model.id') + "/primary_group", {
|
||||
return ajax("/admin/users/" + this.get('model.id') + "/primary_group", {
|
||||
type: 'PUT',
|
||||
data: {primary_group_id: this.get('model.primary_group_id')}
|
||||
}).then(function () {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['modal'],
|
||||
|
||||
@@ -57,7 +58,7 @@ export default Ember.Controller.extend({
|
||||
const groupIds = items.map(function(i){return i.get("id") || -1;});
|
||||
const names = items.map(function(i){return i.get("name");});
|
||||
|
||||
Discourse.ajax('/admin/badges/badge_groupings',{
|
||||
ajax('/admin/badges/badge_groupings',{
|
||||
data: {ids: groupIds, names: names},
|
||||
method: 'POST'
|
||||
}).then(function(data){
|
||||
|
||||
Reference in New Issue
Block a user