server/bo_client/app/routes/doc.js
author ymh <ymh.work@gmail.com>
Wed, 22 Feb 2017 07:57:05 +0100
changeset 519 ef3e4841d506
parent 28 b0b56e0f8c7f
permissions -rw-r--r--
Correct bug #0026428 - in notice filter on creation date for period

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