YouAndWeb_TwoToc
e86e768a66d1367f873e3a66194451f52484f39f
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
'use strict'; angular.module('dashboardApp') .controller('SearchCtrl', function($scope, $http, datepickerPopupConfig, $stateParams) { var baseLimit = 7; $scope.limit = baseLimit; var d = new Date(); d.setHours(0,0,0,0); $scope.dataInizio = new Date(d); $scope.posters = []; var route; $scope.loadCount = 0; $scope.loadShows = function() { route = '/api/shows?limit=' + $scope.limit; if ($scope.dataInizio) { route += '&date=' + $scope.dataInizio; } if ($scope.category) { route += '&category=' + $scope.category; } if ($stateParams.lat && $stateParams.lng) { route += '&lat=' + $stateParams.lat + '&lng=' + $stateParams.lng; } if ($scope.fulltext) { route += '&fulltext=' + $scope.fulltext; } $http.get(route).then(function(response) { $scope.posters = response.data; $scope.limit += $scope.limit; if ($scope.loadCount % 2 === 0) { $scope.limit++; } $scope.loadCount++; }); }; $scope.loadShows(); var posterCount = 0; $scope.pCount = function(index) { posterCount = index % 10 === 0 ? 0 : posterCount + 1; return posterCount === 0 || posterCount === 6; }; $scope.datepickers = { dataInizio: false, dataFine: false }; $scope.open = function($event, which, whichnot) { $event.preventDefault(); $event.stopPropagation(); $scope.datepickers[which]= true; $scope.datepickers[whichnot]= false; }; $scope.dateOptions = { 'year-format': 'yy', 'starting-day': 1, 'show-weeks': false }; datepickerPopupConfig.showButtonBar = false; datepickerPopupConfig.appendToBody = false; $scope.minDate = new Date(); $scope.minDateFine = new Date(); $scope.searchShows = function() { $scope.limit = baseLimit; $scope.loadCount = 0; $scope.loadShows(); }; $scope.lat = $stateParams.lat; $scope.lng = $stateParams.lng; // load categories $http.get('/api/categories?active=true').then(function(response) { $scope.categories = response.data; }); }); |
Commits for YouAndWeb_TwoToc/client/search/search.controller.js
Revision | Author | Commited | Message |
---|---|---|---|
f7c47c ... | FSinnona | Mon 30 Nov, 2015 16:24:39 +0000 | Pre Yoeman |