Last active
December 17, 2015 03:28
-
-
Save marceldegraaf/5543004 to your computer and use it in GitHub Desktop.
Saving a model from Ember.js
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
hr | |
form | |
p | |
label Name | |
Ember.TextField valueBinding=name | |
p | |
label Email | |
Ember.TextField valueBinding=email | |
p | |
label Started employment | |
App.DatePickerView valueBinding=started_employment_on | |
.form-actions | |
button.btn.btn-primary type="submit" click="save" Save | |
button.btn type="button" click="cancel" Cancel |
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
App.EmployeeController = Ember.ObjectController.extend | |
isEditing: false | |
edit: -> | |
@set('isEditing', true) | |
save: -> | |
@get('store').commit() | |
@set('isEditing', false) | |
cancel: -> | |
@get('content').get('transaction').rollback() | |
@set('isEditing', 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
with controller.content | |
h3 = name | |
.row | |
.span6 | |
dl.dl-horizontal | |
dt Name | |
dd = name | |
dt Email | |
dd = email | |
dt Started employment | |
dd | |
date started_employment_on | |
span.muted.date (#{timeAgo started_employment_on}) | |
dt Birthday | |
dd | |
date born_on | |
span.muted.date (#{timeAgo born_on}) | |
.span2 | |
= partial 'shared/gravatar' | |
.row | |
.span8 | |
= partial 'employees/vacations' | |
.row | |
.span8 | |
if controller.isEditing | |
= partial 'employees/form' | |
else | |
p | |
button.btn type="button" click="edit" Edit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment