mirror of
https://gitlab.silvrtree.co.uk/martind2000/project.git
synced 2025-01-25 19:36:17 +00:00
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import Ember from 'ember';
|
|
const { service , store } = Ember.inject;
|
|
export default Ember.Controller.extend({
|
|
session: service('session'),
|
|
sessionAccount: service('session-account'),
|
|
|
|
actions: {
|
|
savePage: function() {
|
|
|
|
var model = this.get('model');
|
|
|
|
model.save()
|
|
.catch(function(err) {
|
|
console.error(err);
|
|
});
|
|
|
|
},
|
|
|
|
createNew: function() {
|
|
'use strict';
|
|
const cid = this.get('sessionAccount.account.memberof');
|
|
|
|
var store = this.get('store');
|
|
|
|
var newPage = store.createRecord('page',{cid: cid,
|
|
vid: 'JPnbDnRzwDSNLTCcS4miFq', content: 0, imageUrl: 'http://lorempixel.com/300/300'});
|
|
|
|
this.set('content',newPage);
|
|
|
|
this.set('isEditing', true);
|
|
}, cancelEdit: function() {
|
|
var model = this.get('model');
|
|
model.rollbackAttributes();
|
|
|
|
model = this.store.findAll('page');
|
|
this.set('isEditing', false);
|
|
this.set('model', model);
|
|
|
|
}
|
|
}
|
|
});
|