mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-13 16:11:51 +02:00
Update
- updated styles - added edit functionality
This commit is contained in:
parent
2630cc237a
commit
b72dfc474e
21 changed files with 136 additions and 52 deletions
|
@ -1,13 +1,22 @@
|
|||
angular.module('rallly')
|
||||
.controller('EventCtrl', function($scope, $http, $state, Event, Participant){
|
||||
|
||||
var id = $state.params.id;
|
||||
$scope.event = Event.get({id:id});
|
||||
$scope.deleteParticipant = function(pid){
|
||||
Participant.remove({ id : id , pid : pid }, function(event){
|
||||
$scope.event = event;
|
||||
});
|
||||
$scope.deleteParticipant = function(participant){
|
||||
if (confirm("Are you sure you want to remove "+participant.name+"?")){
|
||||
Participant.remove({ id : id , pid : participant._id }, function(event){
|
||||
$scope.event = event;
|
||||
});
|
||||
}
|
||||
}
|
||||
$scope.edit = function(index){
|
||||
|
||||
}
|
||||
|
||||
$scope.update = function(participant){
|
||||
Event.update({'_id':$scope.event.id}, $scope.event);
|
||||
}
|
||||
|
||||
$scope.save = function(participant){
|
||||
var participant = new Participant(participant);
|
||||
participant.$save({id:id}, function(event){
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
angular.module('rallly')
|
||||
.controller('NewEventCtrl', function($scope, $http, $state){
|
||||
$scope.event = {};
|
||||
$scope.templates = {
|
||||
modal : 'templates/modal.html'
|
||||
};
|
||||
$scope.submit = function(){
|
||||
$http.post('/api/event', $scope.event)
|
||||
.success(function(event, status, headers, config){
|
||||
|
@ -17,7 +14,6 @@ angular.module('rallly')
|
|||
})
|
||||
.error(function(data, status, headers, config){
|
||||
$scope.errors = data.errors;
|
||||
console.log(data.errors);
|
||||
})
|
||||
}
|
||||
$scope.clearDates = null
|
||||
|
@ -51,15 +47,4 @@ angular.module('rallly')
|
|||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
.directive('rallly-error', function(){
|
||||
return {
|
||||
restrict : 'A',
|
||||
scope: {
|
||||
'message': '='
|
||||
},
|
||||
controller : function($scope){
|
||||
console.log($scope.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue