Skip to content

Commit

Permalink
add delete button to details page for easy access (ripgarpr#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamesargy6 authored and jschnei committed Oct 22, 2016
1 parent fdc6b6b commit 3d8c427
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions webapp/app/tournaments/controllers/tournamentDetail.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
1 change: 1 addition & 0 deletions webapp/app/tournaments/views/tournament_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ <h2 ng-if="tournament.url"><a href={{tournament.url}}>{{tournament.type}} url</a
</div>
<div class="col-md-2" ng-show="sessionService.isAdmin()">
<h1 class="text-right"><button type="button" class="btn btn-danger" ng-click="openDetailsModal()">Edit Tournament Details</button></h1>
<h1 class="text-right"><button type="button" class="btn btn-danger" ng-show="sessionService.isAdminForRegion(regionService.region.id)" ng-click="openDeleteTournamentModal(tournament.id)">Delete</a></button></h1>
</div>
</div>
<div class="row" ng-show="isPendingTournament">
Expand Down

0 comments on commit 3d8c427

Please sign in to comment.