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

fixed appirio-tech/topcoder-app/issues/1054 refactor for design buttons #484

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions src/js/app/challenge-details/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,12 @@
<div class="container rightSplit grid-3-3">

<div class="leftColumn">
<div ng-if="!CD.isDesign">
<div ng-repeat="button in CD.buttons track by $index">
<a class="btn btnAction {{button.classes}}" target="_blank" ng-href="{{button.href || 'javascript:void(0);'}}" ng-click="button.onClick()">
<span>{{$index + 1}}</span>
<strong>{{button.text}}</strong>
</a>
</div>
<div ng-repeat="button in CD.buttons track by $index">
<a class="btn btnAction {{button.classes}}" target="_blank" ng-href="{{button.href || 'javascript:void(0);'}}" ng-click="button.onClick()">
<span>{{$index + 1}}</span>
<strong>{{button.text}}</strong>
</a>
</div>
<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:;">
<span>1</span>
<strong ng-hide="CD.isRegistered">
Register For This Challenge
</strong>
<strong ng-show="CD.isRegistered">
Unregister From This Challenge
</strong>
</a>
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
ng-href="/challenges/{{CD.challenge.challengeId}}/submit/file">
<span>2</span> <strong>Submit Your Entries</strong>
</a>
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
ng-href="//studio.{{CD.domain}}/?module=ViewSubmission&ct={{CD.challenge.challengeId}}">
<span>3</span> <strong>View Your Submission</strong>
</a>
<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">
<span>3</span><strong>Review This Challenge</strong>
</a>
</div>

<div class="middleColumn member-program-path" ng-show="CD.isPeerReviewed && CD.phaseProgram">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,17 +562,7 @@

function initButtons(vm) {
vm.buttons = [];
if (vm.challenge.currentPhaseName === 'Appeals' && vm.hasSubmitted) {
vm.buttons.push(newButton({
text: 'View Scorecard',
href: '//' + vm.reviewAppURL + '/actions/ViewProjectDetails?pid=' + vm.challenge.challengeId,
}));
vm.buttons.push(newButton({
text: 'Complete Appeals',
href: '//' + vm.reviewAppURL + '/actions/EarlyAppeals?pid=' + vm.challenge.challengeId,
classes: 'unregister'
}));
} else {
if (vm.isDesign) {
if (vm.challenge.allowToUnregister) {
vm.buttons.push(newButton({
classes: 'challengeRegisterBtn unregister',
Expand All @@ -591,6 +581,51 @@
classes: (vm.challenge.submissionDisabled ? 'disabled ' : 'disabledNOT'),
text: 'Submit Your Entries'
}));
vm.buttons.push(newButton({
href: '//studio.' + vm.domain + '/?module=ViewSubmission&ct=' + vm.challenge.challengeId,
text: 'View Your Submission',
classes: (vm.challenge.submissionDisabled ? 'disabled ' : 'disabledNOT'),
}))
} else {
if (vm.challenge.currentPhaseName === 'Appeals') {
vm.buttons.push(newButton({
text: 'View Scorecard',
href: '//' + vm.reviewAppURL + '/actions/ViewProjectDetails?pid=' + vm.challenge.challengeId,
}));
if (vm.hasSubmitted) {
vm.buttons.push(newButton({
text: 'Complete Appeals',
href: '//' + vm.reviewAppURL + '/actions/EarlyAppeals?pid=' + vm.challenge.challengeId,
classes: 'unregister'
}));
}
} else {
if (vm.challenge.allowToUnregister) {
vm.buttons.push(newButton({
classes: 'challengeRegisterBtn unregister',
onClick: vm.unregisterFromChallenge,
text: 'Unregister From This Challenge'
}));
} else {
vm.buttons.push(newButton({
classes: 'challengeRegisterBtn ' + (vm.challenge.registrationDisabled ? 'disabled ' : 'disabledNOT'),
onClick: vm.registerToChallenge,
text: 'Register For This Challenge'
}));
}
vm.buttons.push(newButton({
href: '/challenge-details/' + vm.challenge.challengeId + '/submit/?type=develop',
classes: (vm.challenge.submissionDisabled ? 'disabled ' : 'disabledNOT'),
text: 'Submit Your Entries'
}));
if (!vm.challenge.peerReviewDisabled) {
vm.buttons.push(newButton({
href: '/challenges/' + vm.challenge.challengeId + '/reviews/',
classes: (vm.challenge.peerReviewDisabled ? 'disabled ' : 'disabledNOT'),
text: 'Review This Challenge'
}));
}
}
}
}

Expand Down