Moved indexes routes to admin subroute
This commit is contained in:
parent
0cf17ddbc3
commit
685f38098b
25 changed files with 83 additions and 78 deletions
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>MeilisearchAdmin</title>
|
||||
<title>MeiliSearch Admin</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ export function initialize(/* application */) {
|
|||
}
|
||||
|
||||
export default {
|
||||
initialize
|
||||
initialize,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ export default class Router extends EmberRouter {
|
|||
}
|
||||
|
||||
Router.map(function () {
|
||||
this.route('indexes', function () {
|
||||
this.route('element', { path: '/:index_id' });
|
||||
this.route('admin', function () {
|
||||
this.route('indexes', function () {
|
||||
this.route('item', { path: '/:index_id' });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
3
app/routes/admin.js
Normal file
3
app/routes/admin.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class AdminRoute extends Route {}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class IndexesRoute extends Route {
|
||||
export default class AdminIndexesRoute extends Route {
|
||||
@service store;
|
||||
|
||||
async model() {
|
||||
7
app/routes/admin/indexes/item.js
Normal file
7
app/routes/admin/indexes/item.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class AdminIndexesItemRoute extends Route {
|
||||
model({ index_id }) {
|
||||
return this.modelFor('admin.indexes').find((item) => item.id === index_id);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,6 @@ export default class IndexRoute extends Route {
|
|||
@service router;
|
||||
|
||||
beforeModel() {
|
||||
this.router.transitionTo('indexes');
|
||||
this.router.transitionTo('admin.indexes');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class IndexesElementRoute extends Route {
|
||||
@service store;
|
||||
|
||||
async model({ index_id }) {
|
||||
return this.store.find('index', index_id);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
{{#each @model as |item|}}
|
||||
<li>
|
||||
<LinkTo
|
||||
@route="indexes.element"
|
||||
@route="admin.indexes.item"
|
||||
@model={{item}}
|
||||
class="flex flex-row items-center h-12 px-base"
|
||||
>
|
||||
5
app/templates/admin/indexes/item.hbs
Normal file
5
app/templates/admin/indexes/item.hbs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{{page-title "Item"}}
|
||||
|
||||
<h1>{{@model.name}}</h1>
|
||||
|
||||
{{outlet}}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
{{page-title "MeiliSearch Admin"}}
|
||||
|
||||
{{outlet}}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
{{page-title "Element"}}
|
||||
{{outlet}}
|
||||
|
|
@ -15,4 +15,4 @@ module.exports = {
|
|||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,17 +11,17 @@ module.exports = function (defaults) {
|
|||
plugins: [
|
||||
{
|
||||
module: autoprefixer,
|
||||
options: {}
|
||||
options: {},
|
||||
},
|
||||
{
|
||||
module: tailwind,
|
||||
options: {
|
||||
config: './config/tailwind.config.js'
|
||||
}
|
||||
}
|
||||
config: './config/tailwind.config.js',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return app.toTree();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | application', function(hooks) {
|
||||
module('Unit | Adapter | application', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let adapter = this.owner.lookup('adapter:application');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,23 +5,26 @@ import { module, test } from 'qunit';
|
|||
import Resolver from 'ember-resolver';
|
||||
import { run } from '@ember/runloop';
|
||||
|
||||
module('Unit | Initializer | custom-inflector-rules', function(hooks) {
|
||||
hooks.beforeEach(function() {
|
||||
this.TestApplication = class TestApplication extends Application {}
|
||||
module('Unit | Initializer | custom-inflector-rules', function (hooks) {
|
||||
hooks.beforeEach(function () {
|
||||
this.TestApplication = class TestApplication extends Application {};
|
||||
this.TestApplication.initializer({
|
||||
name: 'initializer under test',
|
||||
initialize
|
||||
initialize,
|
||||
});
|
||||
|
||||
this.application = this.TestApplication.create({ autoboot: false, Resolver });
|
||||
this.application = this.TestApplication.create({
|
||||
autoboot: false,
|
||||
Resolver,
|
||||
});
|
||||
});
|
||||
|
||||
hooks.afterEach(function() {
|
||||
hooks.afterEach(function () {
|
||||
run(this.application, 'destroy');
|
||||
});
|
||||
|
||||
// TODO: Replace this with your real tests.
|
||||
test('it works', async function(assert) {
|
||||
test('it works', async function (assert) {
|
||||
await this.application.boot();
|
||||
|
||||
assert.ok(true);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | index', function(hooks) {
|
||||
module('Unit | Model | index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('index', {});
|
||||
assert.ok(model);
|
||||
|
|
|
|||
11
tests/unit/routes/admin-test.js
Normal file
11
tests/unit/routes/admin-test.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | admin', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup('route:admin');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
11
tests/unit/routes/admin/indexes-test.js
Normal file
11
tests/unit/routes/admin/indexes-test.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | admin/indexes', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup('route:admin/indexes');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
11
tests/unit/routes/admin/indexes/item-test.js
Normal file
11
tests/unit/routes/admin/indexes/item-test.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | admin/indexes/item', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup('route:admin/indexes/item');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | application', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:application');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | index', function(hooks) {
|
||||
module('Unit | Route | index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup('route:index');
|
||||
assert.ok(route);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | indexes', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:indexes');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | indexes/element', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:indexes/element');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | application', function(hooks) {
|
||||
module('Unit | Serializer | application', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('application');
|
||||
|
||||
assert.ok(serializer);
|
||||
});
|
||||
|
||||
test('it serializes records', function(assert) {
|
||||
test('it serializes records', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('application', {});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue