server/bo_client/app/routes/doc.js
author ymh <ymh.work@gmail.com>
Mon, 03 Oct 2016 16:32:41 +0200
changeset 318 5564f5065f81
parent 28 b0b56e0f8c7f
permissions -rw-r--r--
add a root url for corpus back apis. it is set to the same than root api for the moment

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();
    }
  }
});