From f7c47c562dfb62380f9cc00adf29a7ffe5910275 Mon Sep 17 00:00:00 2001 From: FSinnona Date: Mon, 30 Nov 2015 17:24:39 +0100 Subject: [PATCH] Pre Yoeman --- client/app/come_funziona/come_funziona.html | 2 +- client/app/community/community.html | 2 +- client/app/main/main.controller.js | 7 +- client/app/organizza/organizza.html | 2 +- client/index.html | 2 - client/search/search.controller.js | 84 ++++++++++++++++ client/search/search.html | 73 ++++++++++++++ client/search/search.js | 20 ++++ client/search/search.scss | 100 ++++++++++++++++++++ server/api/show/show.controller.js | 12 +-- server/config/environment/index.js | 2 +- 11 files changed, 290 insertions(+), 16 deletions(-) create mode 100755 client/search/search.controller.js create mode 100755 client/search/search.html create mode 100755 client/search/search.js create mode 100755 client/search/search.scss diff --git a/client/app/come_funziona/come_funziona.html b/client/app/come_funziona/come_funziona.html index 93fb279..c956343 100755 --- a/client/app/come_funziona/come_funziona.html +++ b/client/app/come_funziona/come_funziona.html @@ -41,7 +41,7 @@
-

Organizza

+

COME FUNZIONA

Scopri gli eventi in programma questa settimana

diff --git a/client/app/community/community.html b/client/app/community/community.html index 93fb279..d57c925 100755 --- a/client/app/community/community.html +++ b/client/app/community/community.html @@ -41,7 +41,7 @@
-

Organizza

+

COMMUNITY

Scopri gli eventi in programma questa settimana

diff --git a/client/app/main/main.controller.js b/client/app/main/main.controller.js index 2f4de7e..29b4f98 100755 --- a/client/app/main/main.controller.js +++ b/client/app/main/main.controller.js @@ -6,11 +6,11 @@ angular.module('dashboardApp') $scope.slides = [ { image: 'soccer-ball.jpg', - text: 'PARTECIPA, ORGANIZZA, GUARDA, SOCIALIZZA' + text: 'PARTECIPA, ORGANIZZA, GUARDA, SOCIALIZZA.' }, { image: 'got.jpg', - text: 'DAJE, SU, MEH, AHO' + text: 'PARTECIPA, ORGANIZZA, GUARDA, SOCIALIZZA.' } ]; @@ -32,7 +32,6 @@ angular.module('dashboardApp') $scope.searchShow = function() { console.log($scope.search); - /*$state.go('partecipa', {lat: $scope.search.lat, lng: $scope.search.lng});*/ - $state.go('search', {lat: $scope.search.lat, lng: $scope.search.lng}); + $state.go('partecipa', {lat: $scope.search.lat, lng: $scope.search.lng}); }; }); diff --git a/client/app/organizza/organizza.html b/client/app/organizza/organizza.html index 93fb279..e039a66 100755 --- a/client/app/organizza/organizza.html +++ b/client/app/organizza/organizza.html @@ -41,7 +41,7 @@
-

Organizza

+

ORGANIZZA

Scopri gli eventi in programma questa settimana

diff --git a/client/index.html b/client/index.html index eafa6be..95cece5 100755 --- a/client/index.html +++ b/client/index.html @@ -79,8 +79,6 @@ - - diff --git a/client/search/search.controller.js b/client/search/search.controller.js new file mode 100755 index 0000000..a9d6275 --- /dev/null +++ b/client/search/search.controller.js @@ -0,0 +1,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; + }); +}); diff --git a/client/search/search.html b/client/search/search.html new file mode 100755 index 0000000..c9768cf --- /dev/null +++ b/client/search/search.html @@ -0,0 +1,73 @@ + + +
+
+
+
+
+ +
+
+
+
+ + + + +
+
+
+
+ +
+
+ + +
+
+
+
+
+
+
+
+

Search

+

Scopri gli eventi in programma questa settimana

+
+
+

{{ lat }}

+

{{ lng }}

+
+
+
+ +
{{ poster.date | date: 'd' }}
{{ poster.date | date: 'MMM' }}
+
+
+ + +

{{ poster.user.name }} propone:

+

{{ poster.title }}

+

{{ poster.description }}

+ {{'PARTECIPA' | translate}} +
+
+
+
+
+

+
+
+
+ + diff --git a/client/search/search.js b/client/search/search.js new file mode 100755 index 0000000..025c4d5 --- /dev/null +++ b/client/search/search.js @@ -0,0 +1,20 @@ +'use strict'; + +angular.module('dashboardApp') + .config(function($stateProvider) { + $stateProvider + .state('search', { + url: '/search', + templateUrl: 'app/search/search.html', + controller: 'SearchCtrl', + params: { + lng: null, + lat: null + } + }) + /*.state('showOrga', { + url: '/:id', + templateUrl: 'app/organizza/showOrga/showOrg.html', + controller: 'ShowOrgaCtrl' + });*/ + }); diff --git a/client/search/search.scss b/client/search/search.scss new file mode 100755 index 0000000..8b805b5 --- /dev/null +++ b/client/search/search.scss @@ -0,0 +1,100 @@ +.poster-view { + margin-top: 30px; +} +.poster { + overflow: hidden; + position: relative; + display: flex; + height: 350px; + width: 33.3%; + float: left; + border: 10px solid #FFF; + box-sizing: border-box; + align-items: center; + justify-content: center; +} +.poster_show { + width: 100% !important; + border: 0 !important; + margin-bottom: 30px; +} +.poster > img { + min-width: 100%; + min-height: 100%; + flex-shrink: 0; +} +.poster.poster-wide { + width: 66.6%; +} + +@media all and (max-width: 768px) { + .poster { + width: 100% !important; + } +} + +.poster_date { + position: absolute; + background: #FFF; + font-family: "Oswald", sans-serif; + font-size: 22px; + font-weight: 300; + color: #000; + top: 0; + left: 20px; + text-transform: uppercase; + text-align: center; + padding: 10px 15px; +} + +.poster:hover { + .poster_overlay { + display: block; + opacity: 1; + } + .poster_date { + display: none; + } +} + +.poster_overlay { + background-color: rgba(255,255,255,0.8); + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + display:none; + opacity: 0; + + .poster_content { + text-align: center; + position: absolute; + top: 20px; + width: 100%; + color: #000; + padding: 20px; + + .avatar { + display: block; + margin: 0 auto; + } + + .user { + font-size: 16px; + margin: 0 0 5px; + } + + h3 { + margin: 0 0 10px; + font-family: "Oswald", sans-serif; + text-transform: uppercase; + font-weight: 700; + font-size: 20px; + } + + .rating { + font-size: 18px; + } + } +} \ No newline at end of file diff --git a/server/api/show/show.controller.js b/server/api/show/show.controller.js index 2a5c2d8..b70dce4 100755 --- a/server/api/show/show.controller.js +++ b/server/api/show/show.controller.js @@ -113,8 +113,8 @@ exports.index = function(req, res) { sq.title = new RegExp("^" + pattern + ".*$", 'i'); } Show.find(sq).lean().limit(limit) - .then(responseWithResult(res, true)) - .catch(handleError(res)); + .then(responseWithResult(res, true), handleError(res)); + /*.catch(handleError(res));*/ }; @@ -122,15 +122,15 @@ exports.index = function(req, res) { exports.show = function(req, res) { Show.findById(req.params.id).lean() .then(handleEntityNotFound(res)) - .then(responseWithResult(res)) - .catch(handleError(res)); + .then(responseWithResult(res), handleError(res)); + /*.catch(handleError(res));*/ }; // Creates a new Show in the DB exports.create = function(req, res) { Show.createAsync(req.body) - .then(responseWithResult(res, 201)) - .catch(handleError(res)); + .then(responseWithResult(res, 201), handleError(res)); + /*.catch(handleError(res));*/ }; // Updates an existing Show in the DB diff --git a/server/config/environment/index.js b/server/config/environment/index.js index 504e586..891cbb2 100755 --- a/server/config/environment/index.js +++ b/server/config/environment/index.js @@ -25,7 +25,7 @@ var all = { ip: process.env.IP || '0.0.0.0', // Should we populate the DB with sample data? - seedDB: false, + seedDB: true, // Secret for session, you will want to change this and make it an environment variable secrets: { -- 2.20.1