From baa74e1921316f9428dde6750322992f5195cfb6 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Sat, 25 Feb 2017 12:58:13 +0100 Subject: [PATCH] getEvents by following users, and some pages --- bower.json | 2 +- www/index.html | 8 ++++++-- www/js/app.js | 32 +++++++++++++++++++++++++++++++- www/js/calendar.js | 12 ++++++++++++ www/js/editUser.js | 8 ++++++++ www/js/events.js | 9 ++++++++- www/js/newAlert.js | 8 ++++++++ www/js/statistics.js | 8 ++++++++ www/js/users.js | 6 +++--- www/templates/calendar.html | 7 +++++++ www/templates/editUser.html | 5 +++++ www/templates/newAlert.html | 5 +++++ www/templates/statistics.html | 7 +++++++ www/templates/userZone.html | 28 ++++++++-------------------- 14 files changed, 117 insertions(+), 28 deletions(-) create mode 100644 www/js/editUser.js create mode 100644 www/js/newAlert.js create mode 100644 www/js/statistics.js create mode 100644 www/templates/editUser.html create mode 100644 www/templates/newAlert.html create mode 100644 www/templates/statistics.html diff --git a/bower.json b/bower.json index aa3e5b8..ef2cf81 100644 --- a/bower.json +++ b/bower.json @@ -8,6 +8,6 @@ "angular-translate": "^2.14.0", "ui-leaflet": "^2.0.0", "ngCordova": "^0.1.27-alpha", - "material-calendar": "^0.2.14" + "moment": "^2.17.1" } } diff --git a/www/index.html b/www/index.html index 70a117d..3b2596c 100644 --- a/www/index.html +++ b/www/index.html @@ -20,8 +20,6 @@ - - @@ -44,6 +42,9 @@ + + + @@ -64,6 +65,9 @@ + + + diff --git a/www/js/app.js b/www/js/app.js index 468d5d9..0bc0e3a 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -24,7 +24,10 @@ angular.module('app', [ 'app.user', 'app.login', 'app.userZone', - 'app.newEvent' + 'app.newEvent', + 'app.editUser', + 'app.statistics', + 'app.newAlert' ]) .run(function($ionicPlatform) { @@ -206,6 +209,33 @@ angular.module('app', [ controller: 'NewEventCtrl' } } + }) + .state('app.editUser', { + url: '/editUser', + views: { + 'menuContent': { + templateUrl: 'templates/editUser.html', + controller: 'EditUserCtrl' + } + } + }) + .state('app.statistics', { + url: '/statistics', + views: { + 'menuContent': { + templateUrl: 'templates/statistics.html', + controller: 'StatisticsCtrl' + } + } + }) + .state('app.newAlert', { + url: '/newAlert', + views: { + 'menuContent': { + templateUrl: 'templates/newAlert.html', + controller: 'NewAlertCtrl' + } + } }); // if none of the above states are matched, use this as the fallback diff --git a/www/js/calendar.js b/www/js/calendar.js index 5302814..34a3aa7 100644 --- a/www/js/calendar.js +++ b/www/js/calendar.js @@ -6,4 +6,16 @@ angular.module('app.calendar', ['pascalprecht.translate']) $scope.dayClick = function(date) { window.location="#/app/byDay/" + date; }; + + var startOfWeek = moment().startOf('month'); + var endOfWeek = moment().endOf('month'); + $scope.days = []; + var day = startOfWeek; + + while (day <= endOfWeek) { + $scope.days.push(new Date(day.toDate())); + day = day.clone().add(1, 'd'); + } + + console.log($scope.days); }); diff --git a/www/js/editUser.js b/www/js/editUser.js new file mode 100644 index 0000000..0329fc7 --- /dev/null +++ b/www/js/editUser.js @@ -0,0 +1,8 @@ +angular.module('app.editUser', ['pascalprecht.translate']) + +.controller('EditUserCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + + + + +}); diff --git a/www/js/events.js b/www/js/events.js index 22462bc..b00b484 100644 --- a/www/js/events.js +++ b/www/js/events.js @@ -7,10 +7,17 @@ angular.module('app.events', ['pascalprecht.translate']) $scope.events=[]; $scope.alerts=[]; $scope.page=0; + $scope.doRefresh = function() { /* events refresh: */ //$http.get(urlapi + 'events?page=' + $scope.page) - $http.get(urlapi + 'events') + $scope.followingUsers = JSON.parse(localStorage.getItem("events_app_followingUsers")); + console.log($scope.followingUsers); + $http({ + url: urlapi + 'events/following', + method: "POST", + data: {users: $scope.followingUsers} + }) .then(function(data){ console.log('data success events'); console.log(data); // for browser console diff --git a/www/js/newAlert.js b/www/js/newAlert.js new file mode 100644 index 0000000..d502d02 --- /dev/null +++ b/www/js/newAlert.js @@ -0,0 +1,8 @@ +angular.module('app.newAlert', ['pascalprecht.translate']) + +.controller('NewAlertCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + + + + +}); diff --git a/www/js/statistics.js b/www/js/statistics.js new file mode 100644 index 0000000..e12772e --- /dev/null +++ b/www/js/statistics.js @@ -0,0 +1,8 @@ +angular.module('app.statistics', ['pascalprecht.translate']) + +.controller('StatisticsCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + + + + +}); diff --git a/www/js/users.js b/www/js/users.js index 6e49f9a..25ec556 100644 --- a/www/js/users.js +++ b/www/js/users.js @@ -33,12 +33,12 @@ angular.module('app.users', ['pascalprecht.translate']) } }); $scope.followUser = function(user){ - $scope.followingUsers.push(user); + $scope.followingUsers.push(user._id); localStorage.setItem("events_app_followingUsers", JSON.stringify($scope.followingUsers)); }; $scope.unfollowUser = function(user){ for(var i=0; i<$scope.followingUsers.length; i++) { - if ($scope.followingUsers[i]._id === user._id){ + if ($scope.followingUsers[i] === user._id){ $scope.followingUsers.splice(i, 1); } } @@ -46,7 +46,7 @@ angular.module('app.users', ['pascalprecht.translate']) }; $scope.isUserFollowed = function(user) { for(var i=0; i<$scope.followingUsers.length; i++) { - if ($scope.followingUsers[i]._id === user._id){ + if ($scope.followingUsers[i] === user._id){ return true; } } diff --git a/www/templates/calendar.html b/www/templates/calendar.html index d6cdebb..068e642 100644 --- a/www/templates/calendar.html +++ b/www/templates/calendar.html @@ -1,4 +1,11 @@ + Aquí la idea és un calendari que t'ha enviat el server, on als dies que hi ha coses, apareixen amb colors. + I quan cliques a un dia, et porta als events d'aquell dia. + + + {{day | date: 'dd/MMMM'}} + + diff --git a/www/templates/editUser.html b/www/templates/editUser.html new file mode 100644 index 0000000..12d8442 --- /dev/null +++ b/www/templates/editUser.html @@ -0,0 +1,5 @@ + + + Not yet + + diff --git a/www/templates/newAlert.html b/www/templates/newAlert.html new file mode 100644 index 0000000..afe1ff1 --- /dev/null +++ b/www/templates/newAlert.html @@ -0,0 +1,5 @@ + + + Funcionalitat encara no disponible, si hi ha alguna emergència, envia'ns un telegram a @entropiasocial, i crearem l'emergència. + + diff --git a/www/templates/statistics.html b/www/templates/statistics.html new file mode 100644 index 0000000..57f210b --- /dev/null +++ b/www/templates/statistics.html @@ -0,0 +1,7 @@ + + + Not yet. + Estadístiques de la compta que està loguejada a l'app. Quants events ha publicat, quins dies té més events, etc + Quines categories té més events, etc. + + diff --git a/www/templates/userZone.html b/www/templates/userZone.html index 0db10d1..43b28a3 100644 --- a/www/templates/userZone.html +++ b/www/templates/userZone.html @@ -2,34 +2,22 @@