Skip to content

Instantly share code, notes, and snippets.

@superlou
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superlou/11307790 to your computer and use it in GitHub Desktop.
Save superlou/11307790 to your computer and use it in GitHub Desktop.
Library Update
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'))
}
}
});
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