Improved inline edit feature

This commit is contained in:
Luke Vella 2015-01-12 16:18:18 +01:00
parent 10c035e359
commit 0eeb4866f4
10 changed files with 65 additions and 21 deletions

View file

@ -1,7 +1,9 @@
angular.module('rallly')
.controller('EventCtrl', function($scope, $http, $state, Event, Participant){
var id = $state.params.id;
$scope.event = Event.get({id:id});
$scope.event = Event.get({id:id}, function(data){}, function(e){
$state.go('notfound');
});
$scope.delete = function(participant){
if (confirm("Are you sure you want to remove "+participant.name+"?")){
Participant.remove({ id : id , pid : participant._id }, function(event){
@ -12,7 +14,11 @@ angular.module('rallly')
$scope.defaults = [];
$scope.update = function(participant){
Event.update({'_id':$scope.event.id}, $scope.event);
Participant.update({
id : $scope.event._id,
pid : participant._id
}, participant);
// Event.update({'_id':$scope.event.id}, $scope.event);
}
$scope.edit = function(participant){
$scope.defaults[$scope.event.participants.indexOf(participant)] = angular.copy(participant);