Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 6a41d4e

Browse files
authored
Merge pull request #484 from shubhendusaurabh/details-button-refactor-2
fixed topcoder-archive/appirio_tech-topcoder-app/issues/1054 refactor for design buttons
2 parents f43285a + 5090795 commit 6a41d4e

File tree

2 files changed

+51
-38
lines changed

2 files changed

+51
-38
lines changed

src/js/app/challenge-details/index.html

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,12 @@
1111
<div class="container rightSplit grid-3-3">
1212

1313
<div class="leftColumn">
14-
<div ng-if="!CD.isDesign">
15-
<div ng-repeat="button in CD.buttons track by $index">
16-
<a class="btn btnAction {{button.classes}}" target="_blank" ng-href="{{button.href || 'javascript:void(0);'}}" ng-click="button.onClick()">
17-
<span>{{$index + 1}}</span>
18-
<strong>{{button.text}}</strong>
19-
</a>
20-
</div>
14+
<div ng-repeat="button in CD.buttons track by $index">
15+
<a class="btn btnAction {{button.classes}}" target="_blank" ng-href="{{button.href || 'javascript:void(0);'}}" ng-click="button.onClick()">
16+
<span>{{$index + 1}}</span>
17+
<strong>{{button.text}}</strong>
18+
</a>
2119
</div>
22-
<a ng-show="CD.isDesign" ng-click="CD.challenge.allowToUnregister?CD.unregisterFromChallenge():CD.registerToChallenge()" ng-class="{disabled:!CD.challenge.allowToUnregister && (CD.challenge.registrationDisabled || !CD.callComplete), disabledNOT:!CD.challenge.registrationDisabled, unregister: CD.challenge.allowToUnregister}" class="btn btnAction challengeRegisterBtn" href="javascript:;">
23-
<span>1</span>
24-
<strong ng-hide="CD.isRegistered">
25-
Register For This Challenge
26-
</strong>
27-
<strong ng-show="CD.isRegistered">
28-
Unregister From This Challenge
29-
</strong>
30-
</a>
31-
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
32-
ng-href="/challenges/{{CD.challenge.challengeId}}/submit/file">
33-
<span>2</span> <strong>Submit Your Entries</strong>
34-
</a>
35-
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
36-
ng-href="//studio.{{CD.domain}}/?module=ViewSubmission&ct={{CD.challenge.challengeId}}">
37-
<span>3</span> <strong>View Your Submission</strong>
38-
</a>
39-
<a ng-show="!CD.isDesign && CD.isPeerReviewed" ng-class="{disabled:CD.challenge.peerReviewDisabled || !CD.callComplete, disabledNOT:!CD.challenge.peerReviewDisabled}" class="btn btnAction" ng-href="/challenges/{{CD.challenge.challengeId}}/reviews/" target="_blank">
40-
<span>3</span><strong>Review This Challenge</strong>
41-
</a>
4220
</div>
4321

4422
<div class="middleColumn member-program-path" ng-show="CD.isPeerReviewed && CD.phaseProgram">

src/js/app/challenge-details/js/controllers/challenge-details-controller.js

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -573,17 +573,7 @@
573573

574574
function initButtons(vm) {
575575
vm.buttons = [];
576-
if (vm.challenge.currentPhaseName === 'Appeals' && vm.hasSubmitted) {
577-
vm.buttons.push(newButton({
578-
text: 'View Scorecard',
579-
href: '//' + vm.reviewAppURL + '/actions/ViewProjectDetails?pid=' + vm.challenge.challengeId,
580-
}));
581-
vm.buttons.push(newButton({
582-
text: 'Complete Appeals',
583-
href: '//' + vm.reviewAppURL + '/actions/EarlyAppeals?pid=' + vm.challenge.challengeId,
584-
classes: 'unregister'
585-
}));
586-
} else {
576+
if (vm.isDesign) {
587577
if (vm.challenge.allowToUnregister) {
588578
vm.buttons.push(newButton({
589579
classes: 'challengeRegisterBtn unregister',
@@ -602,6 +592,51 @@
602592
classes: (vm.challenge.submissionDisabled ? 'disabled ' : 'disabledNOT'),
603593
text: 'Submit Your Entries'
604594
}));
595+
vm.buttons.push(newButton({
596+
href: '//studio.' + vm.domain + '/?module=ViewSubmission&ct=' + vm.challenge.challengeId,
597+
text: 'View Your Submission',
598+
classes: (vm.challenge.submissionDisabled ? 'disabled ' : 'disabledNOT'),
599+
}))
600+
} else {
601+
if (vm.challenge.currentPhaseName === 'Appeals') {
602+
vm.buttons.push(newButton({
603+
text: 'View Scorecard',
604+
href: '//' + vm.reviewAppURL + '/actions/ViewProjectDetails?pid=' + vm.challenge.challengeId,
605+
}));
606+
if (vm.hasSubmitted) {
607+
vm.buttons.push(newButton({
608+
text: 'Complete Appeals',
609+
href: '//' + vm.reviewAppURL + '/actions/EarlyAppeals?pid=' + vm.challenge.challengeId,
610+
classes: 'unregister'
611+
}));
612+
}
613+
} else {
614+
if (vm.challenge.allowToUnregister) {
615+
vm.buttons.push(newButton({
616+
classes: 'challengeRegisterBtn unregister',
617+
onClick: vm.unregisterFromChallenge,
618+
text: 'Unregister From This Challenge'
619+
}));
620+
} else {
621+
vm.buttons.push(newButton({
622+
classes: 'challengeRegisterBtn ' + (vm.challenge.registrationDisabled ? 'disabled ' : 'disabledNOT'),
623+
onClick: vm.registerToChallenge,
624+
text: 'Register For This Challenge'
625+
}));
626+
}
627+
vm.buttons.push(newButton({
628+
href: '/challenge-details/' + vm.challenge.challengeId + '/submit/?type=develop',
629+
classes: (vm.challenge.submissionDisabled ? 'disabled ' : 'disabledNOT'),
630+
text: 'Submit Your Entries'
631+
}));
632+
if (!vm.challenge.peerReviewDisabled) {
633+
vm.buttons.push(newButton({
634+
href: '/challenges/' + vm.challenge.challengeId + '/reviews/',
635+
classes: (vm.challenge.peerReviewDisabled ? 'disabled ' : 'disabledNOT'),
636+
text: 'Review This Challenge'
637+
}));
638+
}
639+
}
605640
}
606641
}
607642

0 commit comments

Comments
 (0)