avoid opening the WebSocket editing an event

This commit is contained in:
Davide Alberani 2015-05-05 21:42:57 +02:00
parent d89d07fedb
commit 8b1678853b

View file

@ -82,8 +82,8 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$modal', '
); );
eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person', 'EventUpdates', '$stateParams', 'Setting', '$log', eventManControllers.controller('EventDetailsCtrl', ['$scope', '$state', 'Event', 'Person', 'EventUpdates', '$stateParams', 'Setting', '$log',
function ($scope, Event, Person, EventUpdates, $stateParams, Setting, $log) { function ($scope, $state, Event, Person, EventUpdates, $stateParams, Setting, $log) {
$scope.personsOrder = ["name", "surname"]; $scope.personsOrder = ["name", "surname"];
$scope.countAttendees = 0; $scope.countAttendees = 0;
$scope.message = {}; $scope.message = {};
@ -101,7 +101,9 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
} }
); );
}); });
$scope.allPersons = Person.all();
if ($state.is('event.info')) {
// Handle WebSocket connection used to update the list of persons. // Handle WebSocket connection used to update the list of persons.
$scope.EventUpdates = EventUpdates; $scope.EventUpdates = EventUpdates;
$scope.EventUpdates.open(); $scope.EventUpdates.open();
@ -114,7 +116,7 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
$scope.event.persons = $scope.EventUpdates.data.persons; $scope.event.persons = $scope.EventUpdates.data.persons;
} }
); );
$scope.allPersons = Person.all(); }
} }
$scope.updateOrded = function(key) { $scope.updateOrded = function(key) {