server/bo_client/app/routes/doc.js
author nowmad@nowmads-macbook-pro.local
Wed, 20 Jan 2016 23:05:52 +0100
changeset 91 acfeddc7821d
parent 28 b0b56e0f8c7f
permissions -rw-r--r--
rename "sound" to "document"

import Ember from 'ember';

export default Ember.Route.extend({
  options: Ember.inject.service(),
  model(params) {
    return this.store.findRecord('document', params.doc_id);
  },
  actions: {
    saveDocument: function(doc) {
      doc.save();
      if(this.get('options').backurl) {
        window.location.replace(this.get('options').backurl);
      }
      else {
        this.transitionTo('index');
      }
    },
    cancelDocument: function(doc) {
      doc.rollbackAttributes();
      doc.reload();
    }
  }
});