-
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.
- Loading branch information
Ilya Radchenko
committed
Aug 27, 2018
1 parent
19220f2
commit b8e6f6d
Showing
11 changed files
with
141 additions
and
17 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
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,19 @@ | ||
import DS from 'ember-data'; | ||
import { attr } from '@ember-decorators/data'; | ||
|
||
export default class User extends DS.Model.extend({ | ||
|
||
}) { | ||
@attr('string') | ||
email!: string; | ||
|
||
@attr('string') | ||
password!: string; | ||
} | ||
|
||
// DO NOT DELETE: this is how TypeScript knows how to look up your models. | ||
declare module 'ember-data' { | ||
interface ModelRegistry { | ||
'user': 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
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,32 @@ | ||
import Controller from '@ember/controller'; | ||
import { action } from '@ember-decorators/object'; | ||
import { service } from '@ember-decorators/service'; | ||
import DS from 'ember-data'; | ||
|
||
export default class Signup extends Controller.extend({ | ||
// anything which *must* be merged to prototype here | ||
}) { | ||
@service('store') | ||
storeService!: DS.Store; | ||
|
||
email: string = ''; | ||
|
||
@action | ||
async signup() { | ||
let email = this.email; | ||
let store = this.storeService; | ||
let user = store.createRecord('user', { | ||
}); | ||
|
||
await user.save(); | ||
debugger; | ||
} | ||
} | ||
|
||
// DO NOT DELETE: this is how TypeScript knows how to look up your controllers. | ||
declare module '@ember/controller' { | ||
interface Registry { | ||
'signup': Signup; | ||
} | ||
} |
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,7 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default class Signup extends Route.extend({ | ||
// anything which *must* be merged to prototype here | ||
}) { | ||
// normal class body definition here | ||
} |
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,31 @@ | ||
<FullLayout> | ||
<div class='self-center mt-8 w-full max-w-xs'> | ||
<form class='bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4' {{action 'signup' on='submit'}}> | ||
<div class='mb-4'> | ||
<label | ||
class='block text-grey-darker text-sm font-bold mb-2' | ||
for='email' | ||
> | ||
</label> | ||
<input | ||
class='shadow appearance-none border rounded w-full py-2 px-3 text-grey-darker leading-tight' | ||
id='email' | ||
type='text' | ||
placeholder='Email' | ||
oninput={{action (mut this.email) value='target.value'}} | ||
> | ||
</div> | ||
|
||
<div class='flex items-center justify-between'> | ||
<button class='bg-blue hover:bg-blue-dark text-white font-bold py-2 px-4 rounded' type='submit'> | ||
Sign Up | ||
</button> | ||
|
||
{{#link-to 'signin' class='inline-block align-baseline font-bold text-sm text-blue hover:text-blue-darker'}} | ||
Already have an account? Sign In | ||
{{/link-to}} | ||
</div> | ||
</form> | ||
</div> | ||
</FullLayout> |
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,14 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
import { run } from '@ember/runloop'; | ||
|
||
module('Unit | Model | user', function(hooks) { | ||
setupTest(hooks); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
let store = this.owner.lookup('service:store'); | ||
let model = run(() => store.createRecord('user', {})); | ||
assert.ok(model); | ||
}); | ||
}); |
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,12 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
|
||
module('Unit | Controller | signup', function(hooks) { | ||
setupTest(hooks); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
let controller = this.owner.lookup('controller:signup'); | ||
assert.ok(controller); | ||
}); | ||
}); |
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,11 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
|
||
module('Unit | Route | signup', function(hooks) { | ||
setupTest(hooks); | ||
|
||
test('it exists', function(assert) { | ||
let route = this.owner.lookup('route:signup'); | ||
assert.ok(route); | ||
}); | ||
}); |