Last active
August 29, 2015 14:00
-
-
Save superlou/11307790 to your computer and use it in GitHub Desktop.
Library Update
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
export default Ember.ObjectController.extend({ | |
actions: { | |
save: function() { | |
var _this = this; | |
console.log(this.get('content')); | |
this.get('content').save().then( | |
function(val) { | |
_this.transitionToRoute('books.book', _this.get('content')); | |
}, | |
function(err) {} | |
) | |
}, | |
cancel: function() { | |
this.get('content').rollback() | |
this.transitionToRoute('books.book', this.get('content')) | |
} | |
} | |
}); |
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
var Router = Ember.Router.extend({ | |
// Uncomment to change Ember's router to use the | |
// HTML5 History API | |
// Please note that not all browsers support this! | |
// You will also need to uncomment the greedy route matcher | |
// in config/routes.rb | |
// location: 'history' | |
}); | |
Router.map(function() { | |
this.resource('books', function() { | |
this.resource('books.book', {path: ':book_id'}); | |
this.route('new'); | |
this.route('edit', {path: ':book_id/edit'}); | |
this.route('clone_volume', {path: ':book_id/clone_volume'}); | |
}); | |
this.resource('patrons', function() { | |
this.resource('patrons.patron', {path: ':patron_id'}); | |
this.route('new'); | |
this.route('edit', {path: ':patron_id/edit'}); | |
}); | |
this.resource('checkouts', function() { | |
this.resource('checkouts.checkout', {path: ':checkout_id'}); | |
this.route('new'); | |
}); | |
this.route('checkout'); | |
this.route('checkin'); | |
this.resource('settings', function() { | |
this.route('general'); | |
this.route('events'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment