-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#17 Starting to create new user. Need to add role select box.
- Loading branch information
Showing
22 changed files
with
212 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
import Controller from '@ember/controller'; | ||
|
||
export default Controller.extend({}); | ||
export default Controller.extend({ | ||
email: '', | ||
|
||
queryParams: [ | ||
{ email: { type: 'string' } } | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
import { not, readOnly } from '@ember/object/computed'; | ||
import BaseModel from 'ember-cybertooth-base-model/models/-base'; | ||
import DS from 'ember-data'; | ||
|
||
export default BaseModel.extend({ | ||
|
||
/** Attributes | ||
/* Attributes | ||
* ---------------------------------------------------------------------------------------------------------------- */ | ||
|
||
email: DS.attr('string'), | ||
inCognito: DS.attr('boolean'), | ||
|
||
/** Relationships | ||
/* Relationships | ||
* ---------------------------------------------------------------------------------------------------------------- */ | ||
|
||
roles: DS.hasMany('role'), | ||
sessions: DS.hasMany('session') | ||
sessions: DS.hasMany('session'), | ||
|
||
/* Computed | ||
* ---------------------------------------------------------------------------------------------------------------- */ | ||
|
||
'inCognito?': readOnly('inCognito'), | ||
|
||
'notInCognito?': not('inCognito?') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { hash } from 'rsvp'; | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
model() { | ||
return hash({ | ||
roles: this.get('store').query('role', { sort: 'name' }) | ||
}) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { hash } from 'rsvp'; | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
actions: { | ||
save(user) { | ||
user | ||
.save() | ||
.then((/*response*/) => { | ||
this.get('notify').success('Created.'); | ||
}) | ||
.catch((errors) => { | ||
console.error('???', errors); | ||
this.get('notify').error('Check for errors.'); | ||
}); | ||
return false; | ||
} | ||
}, | ||
|
||
model() { | ||
return hash({ | ||
roles: this.modelFor('protected.configuration.users.new'), | ||
user: this.get('store').createRecord('user') | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import DS from 'ember-data'; | ||
|
||
export default DS.JSONAPISerializer.extend({ | ||
attrs: { | ||
createdAt: { serialize: false }, | ||
updatedAt: { serialize: false } | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<section class="my-3"> | ||
<div class="container"> | ||
<div class="align-items-center d-flex my-3"> | ||
<h1 class="flex-fill h5"> | ||
{{#link-to "protected.configuration.index"}} | ||
Configuration | ||
{{/link-to}} | ||
{{fa-icon "caret-right" fixedWidth=true}} | ||
{{#link-to "protected.configuration.users.index"}} | ||
Users | ||
{{/link-to}} | ||
{{fa-icon "caret-right" fixedWidth=true}} | ||
New User | ||
</h1> | ||
<div class="align-self-center btn-group"> | ||
<button class="btn btn-outline-secondary" disabled="disabled" type="button"> | ||
{{fa-icon "question"}} | ||
</button> | ||
</div> | ||
</div> | ||
<form class="form" onsubmit={{action (route-action "save" model.user)}}> | ||
<div class="form-group"> | ||
<label for="js-username">Email Address</label> | ||
{{input | ||
aria-describedby="js-username-help" | ||
autocomplete="off" | ||
class="form-control" | ||
placeholder="Email Address" | ||
type="email" | ||
value=model.email | ||
}} | ||
<small id="js-username-help" class="form-text text-muted"> | ||
What is the new user's email address? | ||
</small> | ||
</div> | ||
<div class="form-group text-right"> | ||
<div class="btn-group"> | ||
<button class="btn btn-outline-primary" type="submit">Create</button> | ||
{{#link-to "protected.configuration.users.index" class="btn btn-outline-secondary"}} | ||
Cancel | ||
{{/link-to}} | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.