chore: Create auth-method route
This commit is contained in:
7 files changed
+62
-1
No files matched your search
@@ -38,6 +38,7 @@ Router.map(function () {
|
||||
});
|
||||
this.route('auth-methods', function() {
|
||||
this.route('auth-method', { path: ':auth_method_id' }, function() {});
|
||||
this.route('new');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
this.notify.success(
|
||||
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
|
||||
);
|
||||
this.transitionTo('scopes.scope.auth-methods.auth-method');
|
||||
this.transitionTo('scopes.scope.auth-methods.auth-method', authMethod);
|
||||
} catch (error) {
|
||||
//TODO: replace with translated strings
|
||||
this.notify.error(error.message, { closeAfter: null });
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeAuthMethodsNewRoute extends Route {
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Create a new unsaved auth-method.
|
||||
* @return {AuthMethodModel}
|
||||
*/
|
||||
model() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('auth-method', { type: 'password', scopeModel });
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
<h2>{{t "resources.auth-methods"}}</h2>
|
||||
</page.header>
|
||||
|
||||
<page.actions>
|
||||
{{#if @model}}
|
||||
<Rose::LinkButton @route="scopes.scope.auth-methods.new" @style="primary">
|
||||
{{t "titles.new"}}
|
||||
</Rose::LinkButton>
|
||||
{{/if}}
|
||||
</page.actions>
|
||||
|
||||
<page.body>
|
||||
{{#if @model}}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{{title (t "titles.new")}}
|
||||
|
||||
<Rose::Layout::Page as |page|>
|
||||
<page.header>
|
||||
<h2>{{t "titles.new"}}</h2>
|
||||
</page.header>
|
||||
|
||||
<page.body>
|
||||
<Form::AuthMethod
|
||||
@model={{@model}}
|
||||
@submit={{route-action "save" @model}}
|
||||
@cancel={{route-action "cancel" @model}}
|
||||
/>
|
||||
</page.body>
|
||||
</Rose::Layout::Page>
|
||||
@@ -64,6 +64,18 @@ module('Acceptance | auth methods', function (hooks) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
test('can create new auth method', async function (assert) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
test('can cancel new auth method creation', async function (assert) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
test('saving a new auth method with invalid fields displays error messages', async function (assert) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
test('errors are displayed when save on auth method fails', async function (assert) {
|
||||
assert.expect(0);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | scopes/scope/auth-methods/new', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/auth-methods/new');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user