refactor: 💡 new auth method route must be reached with a type
This commit is contained in:
6 files changed
+33
-11
No files matched your search
@@ -2,6 +2,7 @@
|
||||
<LinkTo
|
||||
...attributes
|
||||
@route={{@route}}
|
||||
@query={{@query}}
|
||||
@model={{@model}}
|
||||
class="rose-dropdown-link {{if @style (concat "rose-dropdown-link-" @style)}}"
|
||||
>
|
||||
@@ -11,6 +12,7 @@
|
||||
<LinkTo
|
||||
...attributes
|
||||
@route={{@route}}
|
||||
@query={{@query}}
|
||||
class="rose-dropdown-link {{if @style (concat "rose-dropdown-link-" @style)}}"
|
||||
>
|
||||
{{yield}}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{{component (concat "form/auth-method/" @model.type)
|
||||
model=@model
|
||||
submit=@submit
|
||||
cancel=@cancel
|
||||
}}
|
||||
{{#if @model.type}}
|
||||
{{component (concat "form/auth-method/" @model.type)
|
||||
model=@model
|
||||
submit=@submit
|
||||
cancel=@cancel
|
||||
}}
|
||||
{{/if}}
|
||||
@@ -8,6 +8,8 @@ export default class ScopesScopeAuthMethodsNewController extends Controller {
|
||||
|
||||
// =attributes
|
||||
|
||||
queryParams = ['type'];
|
||||
|
||||
/**
|
||||
* Translated new auth-method breadcrumb
|
||||
* @type {string}
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeAuthMethodsNewRoute extends Route {
|
||||
// =attributes
|
||||
|
||||
queryParams = {
|
||||
type: {
|
||||
refreshModel: true
|
||||
}
|
||||
};
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Create a new unsaved auth-method.
|
||||
* @return {AuthMethodModel}
|
||||
*/
|
||||
model() {
|
||||
model(params) {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('auth-method', {
|
||||
scopeModel,
|
||||
type: 'password',
|
||||
type: params.type,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,17 @@
|
||||
|
||||
<page.actions>
|
||||
{{#if @model}}
|
||||
<Rose::LinkButton @route="scopes.scope.auth-methods.new" @style="primary">
|
||||
{{t "titles.new"}}
|
||||
</Rose::LinkButton>
|
||||
<Rose::Dropdown
|
||||
@text={{t "titles.new"}}
|
||||
@dropdownRight={{true}}
|
||||
as |dropdown|>
|
||||
<dropdown.link
|
||||
@route="scopes.scope.auth-methods.new"
|
||||
@query={{hash type="password"}}
|
||||
>
|
||||
{{t 'resources.auth-method.types.password'}}
|
||||
</dropdown.link>
|
||||
</Rose::Dropdown>
|
||||
{{/if}}
|
||||
</page.actions>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ module('Acceptance | auth methods', function (hooks) {
|
||||
// Generate route URLs for resources
|
||||
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
|
||||
urls.authMethods = `${urls.orgScope}/auth-methods`;
|
||||
urls.newAuthMethod = `${urls.authMethods}/new`;
|
||||
urls.newAuthMethod = `${urls.authMethods}/new?type=password`;
|
||||
urls.authMethod = `${urls.authMethods}/${instances.authMethod.id}`;
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user