From d6be00c626e5a9ce6816c543aa6636ffbe4417fe Mon Sep 17 00:00:00 2001 From: James Argyropoulos Date: Sat, 22 Oct 2016 13:30:48 -0400 Subject: [PATCH] add delete button to details page for easy access (#141) --- .../controllers/tournamentDetail.controller.js | 18 ++++++++++++++++++ .../tournaments/views/tournament_detail.html | 1 + 2 files changed, 19 insertions(+) diff --git a/webapp/app/tournaments/controllers/tournamentDetail.controller.js b/webapp/app/tournaments/controllers/tournamentDetail.controller.js index 2d6ef55..a6ba27f 100644 --- a/webapp/app/tournaments/controllers/tournamentDetail.controller.js +++ b/webapp/app/tournaments/controllers/tournamentDetail.controller.js @@ -326,6 +326,24 @@ angular.module('app.tournaments').controller("TournamentDetailController", funct }; + $scope.openDeleteTournamentModal = function(tournamentId) { + $scope.modalInstance = $modal.open({ + templateUrl: 'app/tournaments/views/delete_tournament_modal.html', + scope: $scope, + size: 'lg' + }); + $scope.tournamentId = tournamentId; + }; + + $scope.deleteTournament = function() { + url = hostname + $routeParams.region + '/tournaments/' + $scope.tournamentId; + successCallback = function(data) { + window.location.href = "#/" + $routeParams.region + '/tournaments' ; + window.location.reload(); + }; + $scope.sessionService.authenticatedDelete(url, successCallback); + }; + $http.get(hostname + $routeParams.region + '/tournaments/' + $scope.tournamentId). success($scope.updateData); }); \ No newline at end of file diff --git a/webapp/app/tournaments/views/tournament_detail.html b/webapp/app/tournaments/views/tournament_detail.html index 9d94d50..f0078e7 100644 --- a/webapp/app/tournaments/views/tournament_detail.html +++ b/webapp/app/tournaments/views/tournament_detail.html @@ -7,6 +7,7 @@

{{tournament.type}} url

+