YouAndWeb_TwoToc
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
|
'use strict';
angular.module('dashboardApp')
.controller('CommunityCtrl', 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();
};
// load categories
$http.get('/api/categories?active=true').then(function(response) {
$scope.categories = response.data;
});
});
|
Revision |
Author |
Commited |
Message |
a98e8d ...
|
FSinnona
|
Thu 26 Nov, 2015 13:26:45 +0000 |
|