public/js/controllers.js in simple_pvr-1.0.0 vs public/js/controllers.js in simple_pvr-1.1.0

- old
+ new

@@ -1,7 +1,26 @@ 'use strict'; +function CredentialsController($scope, loginService) { + $scope.credentials = { userName: '', password: '' }; + + $scope.submit = function() { + loginService.setUserNameAndPassword($scope.credentials.userName, $scope.credentials.password); + } +} + +function LoginController($scope, $location, loginService) { + $scope.isLoggedIn = function() { + return loginService.isLoggedIn(); + } + + $scope.logOut = function() { + loginService.logOut(); + $location.path('/about'); + } +} + function SchedulesCtrl($scope, $http, Schedule, UpcomingRecording, Channel) { var updateView = function() { $scope.schedules = Schedule.query(); $scope.upcomingRecordings = UpcomingRecording.query(); $scope.newSchedule = { title: null, channelId: 0 } @@ -48,11 +67,11 @@ $scope.classForProgrammeLine = function(programme) { if (programme == null) { return ''; } - return programme.is_conflicting ? 'error' : (programme.is_scheduled ? 'success' : ''); + return programme.is_conflicting ? 'danger' : (programme.is_scheduled ? 'success' : ''); } $scope.hideChannel = function(channel) { // I wish Angular could let me define this operation on the Channel object $http.post('/api/channels/' + channel.id + '/hide').success(function() { channel.$get(); }); } @@ -69,11 +88,11 @@ $scope.channelId = $routeParams.channelId; $scope.date = $routeParams.date; $scope.programmeListing = ProgrammeListing.get({channelId: $scope.channelId, date: $scope.date}); $scope.classForProgrammeLine = function(programme) { - return programme.is_conflicting ? 'error' : (programme.is_scheduled ? 'success' : ''); + return programme.is_conflicting ? 'danger' : (programme.is_scheduled ? 'success' : ''); } } function ProgrammeCtrl($scope, $routeParams, $http, Programme) { var loadProgramme = function() { @@ -117,11 +136,11 @@ var loadRecordings = function() { $scope.recordings = Recording.query({showId: $routeParams.showId}); } $scope.deleteRecording = function(recording) { - if (confirm("Really delete recording\n" + recording.episode + "\nof show\n" + $scope.show.name + "\n?")) { + if (confirm("Really delete this recording of show\n" + $scope.show.name + "\n?")) { recording.$delete(loadRecordings); } } $scope.startTranscoding = function(recording) { @@ -132,20 +151,9 @@ $scope.show = Show.get({id: $routeParams.showId}); loadRecordings(); } function SearchProgrammesCtrl($scope, $http, $location) { - $scope.autocomplete = function(query, process) { - $http.get('/api/programmes/title_search', {params: {query: query}}).success(process); - } - - $scope.updater = function(item) { - $scope.$apply(function() { - $scope.title = item; - }); - return item; - } - $scope.search = function() { $location.path('/search').search({query: $scope.title}); } } \ No newline at end of file