mirror of
https://github.com/arnaucube/openEventsPlatformApp.git
synced 2026-02-07 03:36:44 +01:00
alert system implemented
This commit is contained in:
@@ -13,31 +13,31 @@
|
|||||||
}
|
}
|
||||||
.c_red300{
|
.c_red300{
|
||||||
background: #E57373;
|
background: #E57373;
|
||||||
color: #ffffff;
|
color: #ffffff!important;
|
||||||
}
|
}
|
||||||
.c_red400{
|
.c_red400{
|
||||||
background: #EF5350;
|
background: #EF5350;
|
||||||
color: #ffffff;
|
color: #ffffff!important;
|
||||||
}
|
}
|
||||||
.c_red500{
|
.c_red500{
|
||||||
background: #F44336;
|
background: #F44336;
|
||||||
color: #ffffff;
|
color: #ffffff!important;
|
||||||
}
|
}
|
||||||
.c_red600{
|
.c_red600{
|
||||||
background: #E53935;
|
background: #E53935;
|
||||||
color: #ffffff;
|
color: #ffffff!important;
|
||||||
}
|
}
|
||||||
.c_red700{
|
.c_red700{
|
||||||
background: #D32F2F;
|
background: #D32F2F;
|
||||||
color: #ffffff;
|
color: #ffffff!important;
|
||||||
}
|
}
|
||||||
.c_red800{
|
.c_red800{
|
||||||
background: #C62828;
|
background: #C62828;
|
||||||
color: #ffffff;
|
color: #ffffff!important;
|
||||||
}
|
}
|
||||||
.c_red900{
|
.c_red900{
|
||||||
background: #B71C1C;
|
background: #B71C1C;
|
||||||
color: #ffffff;
|
color: #ffffff!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ctext_red400{
|
.ctext_red400{
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
<script src="js/events.js"></script>
|
<script src="js/events.js"></script>
|
||||||
<script src="js/event.js"></script>
|
<script src="js/event.js"></script>
|
||||||
|
<script src="js/alerts.js"></script>
|
||||||
<script src="js/savedEvents.js"></script>
|
<script src="js/savedEvents.js"></script>
|
||||||
<script src="js/users.js"></script>
|
<script src="js/users.js"></script>
|
||||||
<script src="js/user.js"></script>
|
<script src="js/user.js"></script>
|
||||||
|
|||||||
72
www/js/alerts.js
Normal file
72
www/js/alerts.js
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
angular.module('app.alerts', ['pascalprecht.translate'])
|
||||||
|
|
||||||
|
.controller('AlertsCtrl', function($scope, $http, $ionicModal,
|
||||||
|
$timeout, $ionicLoading, $filter) {
|
||||||
|
|
||||||
|
|
||||||
|
$scope.events=[];
|
||||||
|
$scope.page=0;
|
||||||
|
$scope.doRefresh = function() {
|
||||||
|
/* events refresh: */
|
||||||
|
//$http.get(urlapi + 'events?page=' + $scope.page)
|
||||||
|
$http.get(urlapi + 'alerts')
|
||||||
|
.then(function(data){
|
||||||
|
console.log('data success events');
|
||||||
|
console.log(data); // for browser console
|
||||||
|
//$scope.events = data.data; // for UI
|
||||||
|
$scope.events=data.data;
|
||||||
|
$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"));
|
||||||
|
console.log("savedEvents");
|
||||||
|
console.log($scope.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;
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -11,6 +11,7 @@ angular.module('app', [
|
|||||||
'app.main',
|
'app.main',
|
||||||
'app.events',
|
'app.events',
|
||||||
'app.event',
|
'app.event',
|
||||||
|
'app.alerts',
|
||||||
'app.savedEvents',
|
'app.savedEvents',
|
||||||
'app.users',
|
'app.users',
|
||||||
'app.user'
|
'app.user'
|
||||||
@@ -70,6 +71,15 @@ angular.module('app', [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('app.alerts', {
|
||||||
|
url: '/alerts',
|
||||||
|
views: {
|
||||||
|
'menuContent': {
|
||||||
|
templateUrl: 'templates/alerts.html',
|
||||||
|
controller: 'AlertsCtrl'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.state('app.savedEvents', {
|
.state('app.savedEvents', {
|
||||||
url: '/savedEvents',
|
url: '/savedEvents',
|
||||||
views: {
|
views: {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ angular.module('app.events', ['pascalprecht.translate'])
|
|||||||
|
|
||||||
|
|
||||||
$scope.events=[];
|
$scope.events=[];
|
||||||
|
$scope.alerts=[];
|
||||||
$scope.page=0;
|
$scope.page=0;
|
||||||
$scope.doRefresh = function() {
|
$scope.doRefresh = function() {
|
||||||
/* events refresh: */
|
/* events refresh: */
|
||||||
@@ -23,6 +24,11 @@ angular.module('app.events', ['pascalprecht.translate'])
|
|||||||
$ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
|
$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();
|
$scope.doRefresh();
|
||||||
|
|
||||||
|
|||||||
34
www/templates/alerts.html
Normal file
34
www/templates/alerts.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<ion-view view-title="Emergency alerts">
|
||||||
|
<ion-content class="c_red200">
|
||||||
|
<ion-refresher pulling-text="{{'Pull_to_refresh' | translate}}..." on-refresh="doRefresh()">
|
||||||
|
</ion-refresher>
|
||||||
|
<div class="card" ng-repeat="event in events">
|
||||||
|
<a class="item item-avatar" ng-href="#/app/users/{{event.user._id}}">
|
||||||
|
<img ng-src="{{event.user.img}}">
|
||||||
|
<h2>{{event.user.username}}</h2>
|
||||||
|
<p>{{event.user.shortDescription}}</p>
|
||||||
|
</a>
|
||||||
|
<a ng-href="#/app/events/{{event._id}}" class="item item-text-wrap">
|
||||||
|
<h2>{{event.title}}</h2>
|
||||||
|
<p>{{event.description}}</p>
|
||||||
|
<p>{{event.date | date: 'HH:mm, dd/MM/yyyy'}}</p>
|
||||||
|
</a>
|
||||||
|
<div class="item tabs tabs-icon-only">
|
||||||
|
<a class="tab-item" ng-click="share(event)">
|
||||||
|
<i class="icon ion-android-share-alt"></i>
|
||||||
|
</a>
|
||||||
|
<a class="tab-item">
|
||||||
|
|
||||||
|
</a>
|
||||||
|
<a class="tab-item" ng-click="unsaveEvent(event)"
|
||||||
|
ng-show="isEventSaved(event)">
|
||||||
|
<i class="icon ion-heart ctext_red600"></i>
|
||||||
|
</a>
|
||||||
|
<a class="tab-item" ng-click="saveEvent(event)"
|
||||||
|
ng-hide="isEventSaved(event)">
|
||||||
|
<i class="icon ion-heart"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
|
</ion-view>
|
||||||
@@ -2,19 +2,24 @@
|
|||||||
<ion-content class="c_blueGrey100">
|
<ion-content class="c_blueGrey100">
|
||||||
<ion-refresher pulling-text="{{'Pull_to_refresh' | translate}}..." on-refresh="doRefresh()">
|
<ion-refresher pulling-text="{{'Pull_to_refresh' | translate}}..." on-refresh="doRefresh()">
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
<a href="#/app/alerts" class="item item-icon-left c_red400"
|
||||||
|
ng-show="alerts">
|
||||||
|
<i class="icon ion-android-alert"></i> <b>{{alerts.length}}</b> Emergency alerts!
|
||||||
|
</a>
|
||||||
<div class="card" ng-repeat="event in events">
|
<div class="card" ng-repeat="event in events">
|
||||||
<a class="item item-avatar" ng-href="#/app/users/{{event.user._id}}">
|
<a class="item item-avatar" ng-href="#/app/users/{{event.user._id}}">
|
||||||
<img ng-src="{{event.user.img}}">
|
<img ng-src="{{event.user.img}}">
|
||||||
<h2>{{event.user.username}}</h2>
|
<h2>{{event.user.username}}</h2>
|
||||||
<p>{{event.user.shortDescription}}</p>
|
<p>{{event.user.shortDescription}}</p>
|
||||||
</a>
|
</a>
|
||||||
<a ng-href="#/app/events/{{event._id}}" class="item item-image">
|
<a ng-href="#/app/events/{{event._id}}" class="item item-image"
|
||||||
|
ng-show="event.img">
|
||||||
<img ng-src="{{event.img}}">
|
<img ng-src="{{event.img}}">
|
||||||
<div style="text-align: left; padding: 20px;">
|
</a>
|
||||||
|
<a ng-href="#/app/events/{{event._id}}" class="item item-text-wrap">
|
||||||
<h2>{{event.title}}</h2>
|
<h2>{{event.title}}</h2>
|
||||||
<p>{{event.description}}</p>
|
<p>{{event.description}}</p>
|
||||||
<p>{{event.date | date: 'HH:mm, dd/MM/yyyy'}}</p>
|
<p>{{event.date | date: 'HH:mm, dd/MM/yyyy'}}</p>
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
<div class="item tabs tabs-icon-only">
|
<div class="item tabs tabs-icon-only">
|
||||||
<a class="tab-item" ng-click="share(event)">
|
<a class="tab-item" ng-click="share(event)">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="row o_mainOptionRow">
|
<div class="row o_mainOptionRow">
|
||||||
<a class="col c_indigo300" ng-href="#/app/savedEvents">
|
<a class="col 0 c_yellow600" ng-href="#/app/savedEvents">
|
||||||
<i class="icon ion-heart"></i>
|
<i class="icon ion-heart"></i>
|
||||||
</a>
|
</a>
|
||||||
<a class="col c_green400" ng-href="#/app/byplace">
|
<a class="col c_green400" ng-href="#/app/byplace">
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="row o_mainOptionRow">
|
<div class="row o_mainOptionRow">
|
||||||
<a class="col c_yellow600" ng-href="#/app/search">
|
<a class="col c_deepPurple400" ng-href="#/app/search">
|
||||||
<i class="icon ion-search"></i>
|
<i class="icon ion-search"></i>
|
||||||
</a>
|
</a>
|
||||||
<a class="col c_cyan400" ng-href="#/app/bycategories">
|
<a class="col c_cyan400" ng-href="#/app/bycategories">
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="row o_mainOptionRow">
|
<div class="row o_mainOptionRow">
|
||||||
<a class="col c_deepPurple400" ng-href="#/app/bydate">
|
<a class="col c_indigo300" ng-href="#/app/bydate">
|
||||||
<i class="icon ion-calendar"></i><!--by date-->
|
<i class="icon ion-calendar"></i><!--by date-->
|
||||||
</a>
|
</a>
|
||||||
<a class="col c_orange400" ng-href="#/app/settings">
|
<a class="col c_orange400" ng-href="#/app/settings">
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<ion-side-menu side="left">
|
<ion-side-menu side="left">
|
||||||
<ion-header-bar class="bar-stable">
|
<ion-header-bar class="bar-stable">
|
||||||
<h1 class="title">Left</h1>
|
<h1 class="title">Menu</h1>
|
||||||
</ion-header-bar>
|
</ion-header-bar>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-list>
|
<ion-list>
|
||||||
|
|||||||
Reference in New Issue
Block a user