1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-23 00:00:02 +01:00
VILLASweb/app/controllers/project/index.js
Markus Grigull ddd2680d0d Add user management. Move relationship building to server side
Admins can create/edit and delete users (with all their projects etc.)
Deleting a user/project/visualization automatically deletes all its belonging
data (e.g. deleting a visualization deletes all plots).
When creating and deleting objects the relationship is (mostly) handled server
side. Only the first required relationship (e.g. when creating a new project,
the project's owner is set client-side, the rest is matched on the server).
2016-07-11 22:03:47 +02:00

19 lines
595 B
JavaScript

import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
newVisualization() {
// get the project
var project = this.get('model');
var projectId = this.get('model.id');
// create the visualization
var visualization = this.store.createRecord('visualization', { name: 'Visualization', project: projectId });
// this change will not be saved, but it is nessecary otherwise ember will omit the project's id in the post request
project.get('visualizations').pushObject(visualization);
visualization.save();
}
}
});