diff --git a/www/css/style.css b/www/css/style.css index b8638e2..01c7555 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -65,3 +65,8 @@ text-decoration: none; color: #000000; } +.o_badge{ + border-radius: 8px; + margin: 5px; + padding: 2px 5px; +} diff --git a/www/index.html b/www/index.html index d2878b4..4e1c8ab 100644 --- a/www/index.html +++ b/www/index.html @@ -50,7 +50,8 @@ - + + diff --git a/www/js/app.js b/www/js/app.js index cfe8f17..80d0a96 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -13,7 +13,8 @@ angular.module('app', [ 'app.event', 'app.alerts', 'app.savedEvents', - 'app.byCategories', + 'app.categories', + 'app.byCategory', 'app.users', 'app.user', 'app.login', @@ -93,12 +94,21 @@ angular.module('app', [ } } }) - .state('app.byCategories', { - url: '/byCategories', + .state('app.categories', { + url: '/categories', views: { 'menuContent': { - templateUrl: 'templates/byCategories.html', - controller: 'ByCategoriesCtrl' + templateUrl: 'templates/categories.html', + controller: 'CategoriesCtrl' + } + } + }) + .state('app.byCategory', { + url: '/byCategory/:categoryname', + views: { + 'menuContent': { + templateUrl: 'templates/byCategory.html', + controller: 'ByCategoryCtrl' } } }) diff --git a/www/js/byCategories.js b/www/js/byCategory.js similarity index 78% rename from www/js/byCategories.js rename to www/js/byCategory.js index 612d30d..58cdb6b 100644 --- a/www/js/byCategories.js +++ b/www/js/byCategory.js @@ -1,21 +1,18 @@ -angular.module('app.byCategories', ['pascalprecht.translate']) - -.controller('ByCategoriesCtrl', function($scope, $http, $ionicModal, - $timeout, $ionicLoading, $filter) { +angular.module('app.byCategory', ['pascalprecht.translate']) +.controller('ByCategoryCtrl', function($scope, $http, $ionicModal, + $timeout, $ionicLoading, $filter, $stateParams) { + $scope.category=$stateParams.categoryname; $scope.events=[]; - $scope.alerts=[]; $scope.page=0; $scope.doRefresh = function() { /* events refresh: */ //$http.get(urlapi + 'events?page=' + $scope.page) - $http.get(urlapi + 'events') + $http.get(urlapi + 'events/category/'+ $stateParams.categoryname) .then(function(data){ - console.log('data success events'); - console.log(data); // for browser console - //$scope.events = data.data; // for UI $scope.events=data.data; + console.log($scope.events); $scope.$broadcast('scroll.refreshComplete');//refresher stop }, function(data){ @@ -24,11 +21,6 @@ angular.module('app.byCategories', ['pascalprecht.translate']) $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); }); - $http.get(urlapi + 'alerts') - .then(function(data){ - $scope.alerts=data.data; - }, function(data){ - }); }; $scope.doRefresh(); @@ -49,8 +41,6 @@ angular.module('app.byCategories', ['pascalprecht.translate']) $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")); - console.log("savedEvents"); - console.log($scope.savedEvents); } }); $scope.saveEvent = function(event){ diff --git a/www/js/categories.js b/www/js/categories.js new file mode 100644 index 0000000..fc02163 --- /dev/null +++ b/www/js/categories.js @@ -0,0 +1,17 @@ +angular.module('app.categories', ['pascalprecht.translate']) + +.controller('CategoriesCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + + + $scope.categories; + $http.get(urlapi + 'categoriesList') + .then(function(data){ + $scope.categories=data.data; + console.log($scope.categories); + }, function(data){ + console.log('data error'); + console.log(data); + $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); + + }); +}); diff --git a/www/templates/byCategories.html b/www/templates/byCategory.html similarity index 76% rename from www/templates/byCategories.html rename to www/templates/byCategory.html index 57155c1..42a5ed5 100644 --- a/www/templates/byCategories.html +++ b/www/templates/byCategory.html @@ -1,11 +1,7 @@ - + - - {{alerts.length}} Emergency alerts! -
@@ -17,9 +13,14 @@ -

{{event.title}}

-

{{event.description}}

-

{{event.date | date: 'HH:mm, dd/MM/yyyy'}}

+
{{event.date | date: 'HH:mm, dd/MM/yyyy'}}
+

{{event.title}}

+

{{event.description}}

+

+ + {{category.name}} + +

diff --git a/www/templates/categories.html b/www/templates/categories.html new file mode 100644 index 0000000..0efa45b --- /dev/null +++ b/www/templates/categories.html @@ -0,0 +1,9 @@ + + + + + {{category.name}} + + + + diff --git a/www/templates/event.html b/www/templates/event.html index 404fd32..cb8f5b7 100644 --- a/www/templates/event.html +++ b/www/templates/event.html @@ -9,13 +9,18 @@
-

{{event.title}}

-

{{event.description}}

-

{{event.date | date: 'HH:mm, dd/MM/yyyy'}}

+
{{event.date | date: 'HH:mm, dd/MM/yyyy'}}
+

{{event.title}}

+

{{event.description}}

+

+ + {{category.name}} + +

-

Map

+

Place: {{event.location.direction}}

diff --git a/www/templates/events.html b/www/templates/events.html index e939fcf..ede7160 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -17,9 +17,14 @@ -

{{event.title}}

-

{{event.description}}

-

{{event.date | date: 'HH:mm, dd/MM/yyyy'}}

+
{{event.date | date: 'HH:mm, dd/MM/yyyy'}}
+

{{event.title}}

+

{{event.description}}

+

+ + {{category.name}} + +

diff --git a/www/templates/menu.html b/www/templates/menu.html index 0ab4030..fc0b35b 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -30,7 +30,7 @@ Saved Events - + By Categories