mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-01 19:26:30 +02:00
- added notifications - added toggle switches - added delete feature - added email verification
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
angular.module('rallly')
|
|
.controller('EventCtrl', function($scope, $http, $state, Title, Event, ConfirmModal){
|
|
var id = $state.params.id;
|
|
$scope.event = Event.get({id:id}, function(data){
|
|
Title.set($scope.event.title);
|
|
$scope.eventUrl = $state.href('event', {
|
|
id: $scope.event._id
|
|
}, {
|
|
absolute : true
|
|
});
|
|
}, function(e){
|
|
$state.go('notfound');
|
|
});
|
|
|
|
$scope.openEvent = function(){
|
|
$scope.event.isClosed = false;
|
|
Event.update({
|
|
id : id
|
|
}, $scope.event,
|
|
function(){
|
|
var modal = new ConfirmModal({
|
|
title : 'Event Open',
|
|
message : 'People can vote and comment on this event.',
|
|
cancelText : 'OK',
|
|
});
|
|
});
|
|
}
|
|
|
|
$scope.closeEvent = function(){
|
|
$scope.event.isClosed = true;
|
|
Event.update({
|
|
id : id
|
|
}, $scope.event,
|
|
function(){
|
|
var modal = new ConfirmModal({
|
|
title : 'Event Closed',
|
|
message : 'People can no longer vote or comment on this event.',
|
|
cancelText : 'OK',
|
|
});
|
|
});
|
|
}
|
|
|
|
$scope.editEvent = function(){
|
|
$state.go('editevent', { id : $scope.event._id });
|
|
}
|
|
|
|
});
|