mirror of
https://github.com/arnaucube/openEventsPlatformApp.git
synced 2026-02-07 03:36:44 +01:00
delete event
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//var urlapi = "http://localhost:3000/api/";
|
//var urlapi = "http://localhost:3000/api/";
|
||||||
var urlapi = "http://192.168.1.35:3001/api/";
|
var urlapi = "http://192.168.1.38:3001/api/";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
angular.module('app.event', ['pascalprecht.translate', 'ui-leaflet'])
|
angular.module('app.event', ['pascalprecht.translate', 'ui-leaflet'])
|
||||||
|
|
||||||
.controller('EventCtrl', function($scope, $http, $ionicModal,
|
.controller('EventCtrl', function($scope, $http, $ionicModal,
|
||||||
$stateParams, $timeout, $ionicLoading, $filter,
|
$stateParams, $timeout, $ionicLoading, $filter, $ionicPopup,
|
||||||
leafletData, leafletBoundsHelpers, $cordovaSocialSharing) {
|
leafletData, leafletBoundsHelpers, $cordovaSocialSharing) {
|
||||||
|
|
||||||
|
|
||||||
@@ -68,4 +68,37 @@ angular.module('app.event', ['pascalprecht.translate', 'ui-leaflet'])
|
|||||||
// An error occured. Show a message to the user
|
// An error occured. Show a message to the user
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$scope.deleteEvent = function(){
|
||||||
|
var confirmPopup = $ionicPopup.confirm({
|
||||||
|
title: 'Deleting event',
|
||||||
|
template: 'Are you sure you want to delete <b>'+ $scope.event.title+'</b>?'
|
||||||
|
});
|
||||||
|
confirmPopup.then(function(res) {
|
||||||
|
if(res) {
|
||||||
|
console.log('You are sure');
|
||||||
|
console.log("delete travel: " + $stateParams.eventid);
|
||||||
|
$http({
|
||||||
|
url: urlapi + '/events/id/' + $stateParams.eventid,
|
||||||
|
method: "DELETE"
|
||||||
|
})
|
||||||
|
.then(function(response) {
|
||||||
|
console.log(response);
|
||||||
|
$scope.events=response.data;
|
||||||
|
/*localStorage.setItem('c_travels', JSON.stringify($scope.travels));
|
||||||
|
localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date()));*/
|
||||||
|
$ionicLoading.show({ template: 'Event deleted', noBackdrop: true, duration: 2000 });
|
||||||
|
window.location.href="#/app/main";
|
||||||
|
},
|
||||||
|
function(response) { // optional
|
||||||
|
// failed
|
||||||
|
$ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('You are not sure');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,25 +5,34 @@
|
|||||||
<h2>{{event.user.username}}</h2>
|
<h2>{{event.user.username}}</h2>
|
||||||
<p>{{event.user.shortDescription}}</p>
|
<p>{{event.user.shortDescription}}</p>
|
||||||
</a>
|
</a>
|
||||||
|
<div class="item" ng-show="storageuser._id==event.user._id">
|
||||||
|
<p class="text-right">
|
||||||
|
<!--<a ng-click="" class="button button-small button-royal">
|
||||||
|
<i class="icon ion-edit"></i>
|
||||||
|
</a>-->
|
||||||
|
<a ng-click="deleteEvent()" class="button button-small c_red500">
|
||||||
|
<i class="icon ion-trash-a"></i>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div class="item item-image" ng-show="event.img">
|
<div class="item item-image" ng-show="event.img">
|
||||||
<img ng-src="{{event.img}}">
|
<img ng-src="{{event.img}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="item-note">{{event.date | date: 'HH:mm, dd/MM/yyyy'}}</div>
|
<div class="item-note">{{event.date | date: 'HH:mm, dd/MM/yyyy'}}</div>
|
||||||
<h2>{{event.title}}</h2>
|
<h2>{{event.title}}</h2>
|
||||||
<p>{{event.description}}</p>
|
<p>{{event.description}}</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="o_badge c_blueGrey300" ng-repeat="category in event.categories">
|
<span class="o_badge c_blueGrey300" ng-repeat="category in event.categories">
|
||||||
{{category.name}}
|
{{category.name}}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item" ng-show="markers[0]">
|
<div class="item" ng-show="markers[0]">
|
||||||
<h2>Place: {{event.location.direction}}</h2>
|
<h2>Place: {{event.location.direction}}</h2>
|
||||||
</div>
|
</div>
|
||||||
<leaflet ng-show="markers[0]"
|
<leaflet ng-show="markers[0]" width="100%" height="40%" markers="markers" center="center" tiles="tiles" id="map-simple-map"></leaflet>
|
||||||
width="100%" height="40%" markers="markers" center="center" tiles="tiles" id="map-simple-map"></leaflet>
|
|
||||||
|
|
||||||
<a class="item item-icon-left ctext_indigo500" ng-click="share(event)">
|
<a class="item item-icon-left ctext_indigo500" ng-click="share(event)">
|
||||||
<i class="icon ion-android-share-alt"></i> Share
|
<i class="icon ion-android-share-alt"></i> Share
|
||||||
|
|||||||
Reference in New Issue
Block a user