Skip to content

Commit

Permalink
[BugFix] Fix issues with deregister button on challenges (#4076)
Browse files Browse the repository at this point in the history
* Add redirect after deregister button is click

* Added redirect, decrease size

* fix button css

* add line ending

---------

Co-authored-by: Gunjan Chhablani <[email protected]>
  • Loading branch information
Suryansh5545 and gchhablani committed Aug 9, 2023
1 parent d44d33b commit 4c04959
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
5 changes: 5 additions & 0 deletions frontend/src/css/modules/submission.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,8 @@ md-radio-button .md-on {
flex-direction: row;
align-items: center;
}

.btn-custom {
padding: 0 1rem;
font-size: 0.8rem;
}
3 changes: 3 additions & 0 deletions frontend/src/js/controllers/challengeCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3025,8 +3025,11 @@
var status = response.status;
if (status === 200) {
$rootScope.notify("success", "You have successfully deregistered from the challenge.");
$mdDialog.hide();
$state.go('web.challenge-main.challenge-page.overview');
setTimeout(function() {
$state.reload();
}, 100);
}
},
onError: function(response) {
Expand Down
23 changes: 22 additions & 1 deletion frontend/src/js/route-config/route-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,28 @@
url: "/submission",
templateUrl: baseUrl + "/web/challenge/submission.html",
title: 'Submit',
authenticate: true
authenticate: true,
resolve: {
challenge: function(utilities, $state, $stateParams) {
return new Promise(function(resolve) {
var parameters = {};
parameters.token = utilities.getData('userKey');
parameters.url = 'challenges/' + $stateParams.challengeId + '/participant_team/team_detail';
parameters.method = 'GET';
parameters.data = {};
parameters.callback = {
onSuccess: function(response) {
var details = response.data;
resolve(details);
},
onError: function() {
$state.go('error-404');
}
};
utilities.sendRequest(parameters);
});
}
},
};

var my_submission = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<form name="Deregisterform" ng-submit="challenge.deregister(Deregisterform.$valid)">
<div class="pass-title">Deregister Partipant Team</div>
<div class="input-field align-left">
<span class="form-icon"> Are you sure you want to deregister Team: <b>{{challenge.participated_team_name}} </b>?<i class="fa fa-text"></i></span>
<span class="form-icon"> Are you sure you want to deregister team: <b>{{challenge.participated_team_name}} </b>?<i class="fa fa-text"></i></span>
</div>
<ul class="inline-list pointer">
<li>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/web/challenge/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h5 class="w-300">Submission Guidelines</h5>
<section ng-if="!challenge.isChallengeHost" class="ev-sm-container ev-view challenge-container">
<div class="ev-md-container ev-card-panel ev-z-depth-5">
Click here to deregister from this challenge:
<button class="btn ev-btn-dark waves-effect waves-dark grad-btn grad-btn-dark fs-16" ng-click="challenge.deregisterdialog($event)">Deregister</button>
<button class="btn btn-custom ev-btn-dark waves-effect waves-dark grad-btn grad-btn-dark fs-16" ng-click="challenge.deregisterdialog($event)">Deregister</button>
</div>
</section>

Expand Down

0 comments on commit 4c04959

Please sign in to comment.