From 4c049595e6e96bd36605087076d72f10a083e1ea Mon Sep 17 00:00:00 2001 From: Suryansh Pathak <34577232+Suryansh5545@users.noreply.github.com> Date: Wed, 9 Aug 2023 23:09:57 +0530 Subject: [PATCH] [BugFix] Fix issues with deregister button on challenges (#4076) * Add redirect after deregister button is click * Added redirect, decrease size * fix button css * add line ending --------- Co-authored-by: Gunjan Chhablani --- frontend/src/css/modules/submission.scss | 5 ++++ frontend/src/js/controllers/challengeCtrl.js | 3 +++ frontend/src/js/route-config/route-config.js | 23 ++++++++++++++++++- .../edit-challenge-deregister.html | 2 +- .../src/views/web/challenge/submission.html | 2 +- 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/frontend/src/css/modules/submission.scss b/frontend/src/css/modules/submission.scss index 957800cc48..a6384156c5 100644 --- a/frontend/src/css/modules/submission.scss +++ b/frontend/src/css/modules/submission.scss @@ -117,3 +117,8 @@ md-radio-button .md-on { flex-direction: row; align-items: center; } + +.btn-custom { + padding: 0 1rem; + font-size: 0.8rem; +} diff --git a/frontend/src/js/controllers/challengeCtrl.js b/frontend/src/js/controllers/challengeCtrl.js index 6a02c36c0c..3a035519aa 100644 --- a/frontend/src/js/controllers/challengeCtrl.js +++ b/frontend/src/js/controllers/challengeCtrl.js @@ -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) { diff --git a/frontend/src/js/route-config/route-config.js b/frontend/src/js/route-config/route-config.js index 5f7b07729f..66dec96c83 100644 --- a/frontend/src/js/route-config/route-config.js +++ b/frontend/src/js/route-config/route-config.js @@ -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 = { diff --git a/frontend/src/views/web/challenge/edit-challenge/edit-challenge-deregister.html b/frontend/src/views/web/challenge/edit-challenge/edit-challenge-deregister.html index d599b88b98..017b9cbb8c 100644 --- a/frontend/src/views/web/challenge/edit-challenge/edit-challenge-deregister.html +++ b/frontend/src/views/web/challenge/edit-challenge/edit-challenge-deregister.html @@ -5,7 +5,7 @@
Deregister Partipant Team
- Are you sure you want to deregister Team: {{challenge.participated_team_name}} ? + Are you sure you want to deregister team: {{challenge.participated_team_name}} ?