Pre Yoeman
authorFSinnona <fabio.sinnona@nextrek.net>
Mon, 30 Nov 2015 16:24:39 +0000 (17:24 +0100)
committerFSinnona <fabio.sinnona@nextrek.net>
Mon, 30 Nov 2015 16:24:39 +0000 (17:24 +0100)
client/app/come_funziona/come_funziona.html
client/app/community/community.html
client/app/main/main.controller.js
client/app/organizza/organizza.html
client/index.html
client/search/search.controller.js [new file with mode: 0755]
client/search/search.html [new file with mode: 0755]
client/search/search.js [new file with mode: 0755]
client/search/search.scss [new file with mode: 0755]
server/api/show/show.controller.js
server/config/environment/index.js

index 93fb279..c956343 100755 (executable)
@@ -41,7 +41,7 @@
 <div class="container">
        <div class="row">
        <div class="col-sm-12 text-center">
-               <h1 class="title">Organizza</h1>
+               <h1 class="title">COME FUNZIONA</h1>
                <h3 class="title">Scopri gli eventi in programma questa settimana</h3>
        </div>
        <div class="poster-view">
index 93fb279..d57c925 100755 (executable)
@@ -41,7 +41,7 @@
 <div class="container">
        <div class="row">
        <div class="col-sm-12 text-center">
-               <h1 class="title">Organizza</h1>
+               <h1 class="title">COMMUNITY</h1>
                <h3 class="title">Scopri gli eventi in programma questa settimana</h3>
        </div>
        <div class="poster-view">
index 2f4de7e..29b4f98 100755 (executable)
@@ -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});
     };
   });
index 93fb279..e039a66 100755 (executable)
@@ -41,7 +41,7 @@
 <div class="container">
        <div class="row">
        <div class="col-sm-12 text-center">
-               <h1 class="title">Organizza</h1>
+               <h1 class="title">ORGANIZZA</h1>
                <h3 class="title">Scopri gli eventi in programma questa settimana</h3>
        </div>
        <div class="poster-view">
index eafa6be..95cece5 100755 (executable)
@@ -79,8 +79,6 @@
       <script src="app/partecipa/partecipa.controller.js"></script>
       <script src="app/partecipa/partecipa.js"></script>
       <script src="app/partecipa/show/show.controller.js"></script>
-      <script src="app/search/search.controller.js"></script>
-      <script src="app/search/search.js"></script>
       <script src="components/auth/auth.service.js"></script>
       <script src="components/auth/user.service.js"></script>
       <script src="components/footer/footer.directive.js"></script>
diff --git a/client/search/search.controller.js b/client/search/search.controller.js
new file mode 100755 (executable)
index 0000000..a9d6275
--- /dev/null
@@ -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 (executable)
index 0000000..c9768cf
--- /dev/null
@@ -0,0 +1,73 @@
+<navbar></navbar>
+
+<div class="main-container">
+    <div class="row">
+      <div class="col-sm-12 text-center bg-grey">
+        <form class="form-inline" ng-submit="searchShows()">
+          <div class="form-group">
+            <input type="text" class="form-control" placeholder="Cosa vuoi guardare?" ng-model="fulltext">
+          </div>
+          <div class="form-group">
+            <div class="input-group">
+              <div class="input-group datepicker-group">
+                <input type="text" class="form-control" placeholder="Quando?"
+                name="dataInizio"
+                ng-model="dataInizio"
+                min-date="minDate"
+                max-date="maxDateInizio"
+                datepicker-popup="dd-MM-yyyy"
+                is-open="datepickers.dataInizio"
+                datepicker-options="dateOptions"
+                ng-readonly="true"
+                ng-required="true"
+                ng-click="open($event,'dataInizio','dataFine')">
+                <span class="input-group-btn">
+                  <button class="btn btn-default" ng-click="open($event,'dataInizio','dataFine')"><i class="glyphicon glyphicon-calendar"></i></button>
+                </span>
+              </div>
+            </div>
+          </div>
+          <div class="form-group">
+            <select ng-model="category" ng-options="category._id as category.name for category in categories" class="form-control"></select>
+          </div>
+          <div class="form-group">
+            <button type="submit" class="btn btn-default">{{ 'CERCA' | translate }}</button>
+            <button type="button" ng-click="resetForm()" class="btn btn-default">{{ 'CANCELLA FILTRI' | translate }}</button>
+          </div>
+        </form>
+      </div>
+    </div>
+</div>
+<div class="container">
+       <div class="row">
+       <div class="col-sm-12 text-center">
+               <h1 class="title">Search</h1>
+               <h3 class="title">Scopri gli eventi in programma questa settimana</h3>
+       </div>
+       <div ng-app="dashboardApp" ng-controller="SearchCtrl">
+                       <h3>{{ lat }}</h3>
+                       <h3>{{ lng }}</h3>
+                       </div>
+       <div class="poster-view">
+               <div class="poster" ng-repeat="poster in posters" ng-class="{'poster-wide': pCount($index)}">
+                       <img ng-src="/uploads/{{ poster.image }}">
+          <div class="poster_date">{{ poster.date | date: 'd' }}<br>{{ poster.date | date: 'MMM' }}</div>
+          <div class="poster_overlay">
+            <div class="poster_content">
+              <img src="/assets/images/avatar.png" class="avatar">
+              <rating ng-model="poster.userRating" max="5" readonly="true" class="rating"></rating>
+              <p class="user">{{ poster.user.name }} propone:</p>
+              <h3>{{ poster.title }}</h3>
+              <p class="descr">{{ poster.description }}</p>
+              <a class="btn btn-default" ui-sref="show({id: poster._id})">{{'PARTECIPA' | translate}}</a>
+            </div>
+          </div>
+               </div>
+       </div>
+      <div class="col-sm-12 text-center">
+          <button class="btn btn-default" ng-click="loadShows()">{{'CARICA ALTRO' | translate}}</button><br><br>
+      </div>
+       </div>
+</div>
+
+<footer></footer>
diff --git a/client/search/search.js b/client/search/search.js
new file mode 100755 (executable)
index 0000000..025c4d5
--- /dev/null
@@ -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 (executable)
index 0000000..8b805b5
--- /dev/null
@@ -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
index 2a5c2d8..b70dce4 100755 (executable)
@@ -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
index 504e586..891cbb2 100755 (executable)
@@ -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: {