diff --git a/www/index.html b/www/index.html
index a5c28ba..70a117d 100644
--- a/www/index.html
+++ b/www/index.html
@@ -20,6 +20,8 @@
+
+
@@ -56,6 +58,7 @@
+
diff --git a/www/js/app.js b/www/js/app.js
index 3b4cdbe..468d5d9 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1,5 +1,5 @@
-var urlapi = "http://localhost:3000/api/";
-//var urlapi = "http://192.168.1.33:3000/api/";
+//var urlapi = "http://localhost:3000/api/";
+var urlapi = "http://192.168.1.33:3000/api/";
@@ -19,6 +19,7 @@ angular.module('app', [
'app.place',
'app.byPlace',
'app.calendar',
+ 'app.byDay',
'app.users',
'app.user',
'app.login',
@@ -152,6 +153,15 @@ angular.module('app', [
}
}
})
+ .state('app.byDay', {
+ url: '/byDay/:day',
+ views: {
+ 'menuContent': {
+ templateUrl: 'templates/byDay.html',
+ controller: 'ByDayCtrl'
+ }
+ }
+ })
.state('app.users', {
url: '/users',
views: {
diff --git a/www/js/byDay.js b/www/js/byDay.js
new file mode 100644
index 0000000..26e6e03
--- /dev/null
+++ b/www/js/byDay.js
@@ -0,0 +1,68 @@
+angular.module('app.byDay', ['pascalprecht.translate'])
+
+.controller('ByDayCtrl', function($scope, $http, $ionicModal,
+ $timeout, $ionicLoading, $filter, $stateParams) {
+
+ $scope.day=$stateParams.day;
+ $scope.events=[];
+ $scope.page=0;
+ $scope.doRefresh = function() {
+ /* events refresh: */
+ //$http.get(urlapi + 'events?page=' + $scope.page)
+ $http.get(urlapi + 'events/day/'+ $stateParams.day)
+ .then(function(data){
+ $scope.events=data.data;
+ console.log($scope.events);
+ $scope.$broadcast('scroll.refreshComplete');//refresher stop
+
+ }, function(data){
+ console.log('data error');
+ $scope.$broadcast('scroll.refreshComplete');//refresher stop
+ $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
+
+ });
+ };
+ $scope.doRefresh();
+
+ $scope.share = function(event){
+ var message = "[" + event.title + "]" + event.description;
+ /*var subject = event.title;
+ var file= ['',''];*/
+ var link = "http://duckduckgo.com";
+ $cordovaSocialSharing
+ .share(message, link) // Share via native share sheet
+ .then(function(result) {
+ // Success!
+ }, function(err) {
+ // An error occured. Show a message to the user
+ });
+ };
+ $scope.savedEvents=[];
+ $scope.$on('$ionicView.enter', function(){//per executar-ho cada cop que es carrega el view
+ if (localStorage.getItem("events_app_savedEvents")) {
+ $scope.savedEvents = JSON.parse(localStorage.getItem("events_app_savedEvents"));
+ }
+ });
+ $scope.saveEvent = function(event){
+ $scope.savedEvents.push(event);
+ localStorage.setItem("events_app_savedEvents", JSON.stringify($scope.savedEvents));
+ $ionicLoading.show({ template: 'Event saved', noBackdrop: true, duration: 1000 });
+ };
+ $scope.unsaveEvent = function(event){
+ for(var i=0; i<$scope.savedEvents.length; i++) {
+ if ($scope.savedEvents[i]._id === event._id){
+ $scope.savedEvents.splice(i, 1);
+ }
+ }
+ localStorage.setItem("events_app_savedEvents", JSON.stringify($scope.savedEvents));
+ $ionicLoading.show({ template: 'Event unsaved', noBackdrop: true, duration: 1000 });
+ };
+ $scope.isEventSaved = function(event) {
+ for(var i=0; i<$scope.savedEvents.length; i++) {
+ if ($scope.savedEvents[i]._id === event._id){
+ return true;
+ }
+ }
+ return false;
+ };
+});
diff --git a/www/js/calendar.js b/www/js/calendar.js
index 3ee352b..5302814 100644
--- a/www/js/calendar.js
+++ b/www/js/calendar.js
@@ -3,5 +3,7 @@ angular.module('app.calendar', ['pascalprecht.translate'])
.controller('CalendarCtrl', function($scope, $http, $ionicModal, $timeout,
$ionicLoading, $filter) {
-
+ $scope.dayClick = function(date) {
+ window.location="#/app/byDay/" + date;
+ };
});
diff --git a/www/templates/byDay.html b/www/templates/byDay.html
new file mode 100644
index 0000000..6902462
--- /dev/null
+++ b/www/templates/byDay.html
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/www/templates/calendar.html b/www/templates/calendar.html
index a18d66b..d6cdebb 100644
--- a/www/templates/calendar.html
+++ b/www/templates/calendar.html
@@ -1,5 +1,4 @@
-