2015-03-14 17:32:16 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/* Controllers */
|
2015-03-15 18:00:08 +01:00
|
|
|
var eventManControllers = angular.module('eventManControllers', []);
|
2015-03-14 17:32:16 +01:00
|
|
|
|
2015-03-20 22:47:21 +01:00
|
|
|
eventManControllers.controller('navigation', ['$location',
|
|
|
|
function ($location) {
|
|
|
|
this.go = function(url) {
|
|
|
|
$location.url(url);
|
|
|
|
};
|
|
|
|
}]
|
|
|
|
);
|
|
|
|
|
2015-03-14 17:32:16 +01:00
|
|
|
|
2015-03-21 11:34:55 +01:00
|
|
|
eventManControllers.controller('EventsListCtrl', ['$scope', 'Event',
|
|
|
|
function ($scope, Event) {
|
|
|
|
$scope.events = Event.all();
|
2015-03-15 18:00:08 +01:00
|
|
|
$scope.orderProp = 'begin-datetime';
|
|
|
|
}]
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2015-03-21 11:34:55 +01:00
|
|
|
eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', '$routeParams',
|
|
|
|
function ($scope, Event, $routeParams) {
|
2015-03-21 15:33:17 +01:00
|
|
|
if ($routeParams.id) {
|
|
|
|
$scope.event = Event.get($routeParams);
|
|
|
|
}
|
|
|
|
$scope.save = function() {
|
|
|
|
if ($scope.event.id === undefined) {
|
|
|
|
Event.save($scope.event);
|
|
|
|
} else {
|
|
|
|
Event.update($scope.event);
|
|
|
|
}
|
|
|
|
};
|
2015-03-15 23:05:59 +01:00
|
|
|
}]
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2015-03-21 11:34:55 +01:00
|
|
|
eventManControllers.controller('PersonsListCtrl', ['$scope', 'Person',
|
|
|
|
function ($scope, Person) {
|
|
|
|
$scope.persons = Person.all();
|
2015-03-15 18:00:08 +01:00
|
|
|
$scope.orderProp = 'name';
|
2015-03-14 17:32:16 +01:00
|
|
|
}]
|
|
|
|
);
|
|
|
|
|
2015-03-15 23:05:59 +01:00
|
|
|
|
2015-03-21 11:34:55 +01:00
|
|
|
eventManControllers.controller('PersonDetailsCtrl', ['$scope', 'Person', '$routeParams',
|
|
|
|
function ($scope, Person, $routeParams) {
|
|
|
|
$scope.person = Person.get($routeParams);
|
2015-03-15 23:05:59 +01:00
|
|
|
}]
|
|
|
|
);
|
|
|
|
|