REFACTOR: Replace Ember.Route with proper import

This commit is contained in:
Robin Ward 2019-10-23 12:39:32 -04:00
parent a8a76198b1
commit dd3ace5c77
31 changed files with 63 additions and 31 deletions

View File

@ -1,4 +1,6 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
beforeModel() {
this.transitionTo("adminApiKeys");
}

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import ApiKey from "admin/models/api-key";
export default Ember.Route.extend({
export default Route.extend({
model() {
return ApiKey.find();
}

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import Backup from "admin/models/backup";
export default Ember.Route.extend({
export default Route.extend({
activate() {
this.messageBus.subscribe("/admin/backups", backups =>
this.controller.set("model", backups.map(backup => Backup.create(backup)))

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import PreloadStore from "preload-store";
export default Ember.Route.extend({
export default Route.extend({
// since the logs are pushed via the message bus
// we only want to preload them (hence the beforeModel hook)
beforeModel() {

View File

@ -1,3 +1,4 @@
import Route from "@ember/routing/route";
import { emojiUrlFor } from "discourse/lib/text";
const badgeIntroLinks = [
@ -13,7 +14,7 @@ const badgeIntroLinks = [
}
];
export default Ember.Route.extend({
export default Route.extend({
setupController(controller) {
controller.setProperties({
badgeIntroLinks,

View File

@ -1,8 +1,9 @@
import Route from "@ember/routing/route";
import { ajax } from "discourse/lib/ajax";
import Badge from "discourse/models/badge";
import showModal from "discourse/lib/show-modal";
export default Ember.Route.extend({
export default Route.extend({
serialize(m) {
return { badge_id: Ember.get(m, "id") || "new" };
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model(params) {
const all = this.modelFor("adminCustomize.colors");
const model = all.findBy("id", parseInt(params.scheme_id));

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import ColorScheme from "admin/models/color-scheme";
export default Ember.Route.extend({
export default Route.extend({
model() {
return ColorScheme.findAll();
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model(params) {
return {
model: this.modelFor("adminCustomizeEmailStyle"),

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model() {
return this.store.find("email-style");
},

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import { scrollTop } from "discourse/mixins/scroll-top";
export default Ember.Route.extend({
export default Route.extend({
model(params) {
const all = this.modelFor("adminCustomizeEmailTemplates");
return all.findBy("id", params.id);

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model() {
return this.store.findAll("email-template");
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
beforeModel() {
this.transitionTo("adminCustomizeThemes");
}

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import { ajax } from "discourse/lib/ajax";
export default Ember.Route.extend({
export default Route.extend({
model() {
return ajax("/admin/customize/robots");
}

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model(params) {
const all = this.modelFor("adminCustomizeThemes");
const model = all.findBy("id", parseInt(params.theme_id));

View File

@ -1,3 +1,4 @@
import Route from "@ember/routing/route";
import { emojiUrlFor } from "discourse/lib/text";
const externalResources = [
@ -18,7 +19,7 @@ const externalResources = [
}
];
export default Ember.Route.extend({
export default Route.extend({
setupController(controller) {
this._super(...arguments);
this.controllerFor("adminCustomizeThemes").set("editingTheme", false);

View File

@ -1,7 +1,8 @@
import Route from "@ember/routing/route";
import { scrollTop } from "discourse/mixins/scroll-top";
import { THEMES, COMPONENTS } from "admin/models/theme";
export default Ember.Route.extend({
export default Route.extend({
serialize(model) {
return { theme_id: model.get("id") };
},

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import showModal from "discourse/lib/show-modal";
export default Ember.Route.extend({
export default Route.extend({
model() {
return this.store.findAll("theme");
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model() {
return this.store.find("embedding");
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model() {
return this.store.findAll("plugin");
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model(params) {
return this.store.find("site-text", params.id);
},

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import showModal from "discourse/lib/show-modal";
export default Ember.Route.extend({
export default Route.extend({
queryParams: {
q: { replace: true },
overridden: { replace: true }

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model() {
return this.store.findAll("web-hook");
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
setupController(controller) {
const accountCreated = this.controllerFor("account-created").get(
"accountCreated"

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
setupController(controller) {
controller.set(
"accountCreated",

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
setupController(controller) {
controller.set(
"email",

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import PreloadStore from "preload-store";
export default Ember.Route.extend({
export default Route.extend({
setupController(controller) {
controller.set("accountCreated", PreloadStore.get("accountCreated"));
}

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
beforeModel: function() {
this.transitionTo("group.messages.inbox");
}

View File

@ -1,6 +1,7 @@
import Route from "@ember/routing/route";
import { findWizard } from "wizard/models/wizard";
export default Ember.Route.extend({
export default Route.extend({
model() {
return findWizard();
},

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
beforeModel() {
const appModel = this.modelFor("application");
this.replaceWith("step", appModel.start);

View File

@ -1,4 +1,5 @@
export default Ember.Route.extend({
import Route from "@ember/routing/route";
export default Route.extend({
model(params) {
const allSteps = this.modelFor("application").steps;
const step = allSteps.findBy("id", params.step_id);