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

Commit fa36a99

Browse files
author
Victor George
committed
Merge branch 'dev' of https://github.com/appirio-tech/topcoder-app into forms-refactor
# By Tom Ladendorf (2) and vikasrohit (2) # Via Tom Ladendorf * 'dev' of https://github.com/appirio-tech/topcoder-app: added password maxlength Revert "SUP-2207, "Whoops! Something went wrong. Please try again later." message while opening the profile page." SUP-2207, "Whoops! Something went wrong. Please try again later." message while opening the profile page. Added design submission viewer lightbox
2 parents 6a135b0 + 52d64b2 commit fa36a99

File tree

7 files changed

+146
-8
lines changed

7 files changed

+146
-8
lines changed

app/directives/account/toggle-password-with-tips/toggle-password-with-tips.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ input#password-input(
1212

1313
ng-minlength="8",
1414
ng-maxlength="64",
15+
maxlength="64",
1516
has-letter,
1617
has-symbol-or-number,
1718
required)

app/directives/challenge-tile/challenge-tile.directive.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
if ($scope.challenge.status.trim().toUpperCase() === 'PAST' && $scope.challenge.subTrack === 'MARATHON_MATCH') {
2424
ChallengeService.processPastMarathonMatch($scope.challenge);
2525
}
26+
27+
if ($scope.challenge.status.trim().toUpperCase() === 'COMPLETED' && $scope.challenge.track === 'DESIGN') {
28+
ChallengeService.formatPastDesignChallenge($scope.challenge);
29+
console.log($scope.challenge.plain());
30+
}
2631
}
2732

2833
function openLightbox() {

app/directives/challenge-user-place/challenge-user-place.directive.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,21 @@
3333
challenge: '=',
3434
view: '='
3535
},
36-
controller: ['$scope', 'CONSTANTS', '$attrs', 'ChallengeService',
37-
function($scope, CONSTANTS, $attrs, ChallengeService) {
36+
controller: ['$scope', 'CONSTANTS', '$attrs', 'ChallengeService', 'ngDialog',
37+
function($scope, CONSTANTS, $attrs, ChallengeService, ngDialog) {
3838
$scope.DOMAIN = CONSTANTS.domain;
39+
$scope.openLightbox = openLightbox;
40+
$scope.updateSelected = updateSelected;
41+
$scope.incrementIndex = incrementIndex;
3942

4043
activate();
4144

4245
function activate() {
43-
if ($scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {
46+
if (!$scope.challenge.isPrivate && $scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {
47+
$scope.selectedIndex = 0;
4448
$scope.challenge.thumbnailId = $scope.challenge.userDetails.submissions[0].id;
49+
$scope.imageURL = $scope.challenge.userDetails.submissions[0].fullImage;
50+
$scope.selectedImage = $scope.imageURL;
4551

4652
$scope.challenge.highestPlacement = _.max($scope.challenge.userDetails.submissions, 'placement').placement;
4753

@@ -50,6 +56,27 @@
5056
}
5157
}
5258
}
59+
60+
function updateSelected(newImage, index) {
61+
$scope.selectedImage = newImage;
62+
$scope.selectedIndex = index;
63+
}
64+
65+
function incrementIndex(x) {
66+
$scope.selectedIndex += x;
67+
if ($scope.selectedIndex < 0) $scope.selectedIndex = $scope.challenge.userDetails.submissions.length - 1;
68+
if ($scope.selectedIndex == $scope.challenge.userDetails.submissions.length) $scope.selectedIndex = 0;
69+
$scope.selectedImage = $scope.challenge.userDetails.submissions[$scope.selectedIndex].fullImage;
70+
}
71+
72+
function openLightbox() {
73+
ngDialog.open({
74+
template: 'directives/challenge-user-place/design-lightbox/design-lightbox.html',
75+
className: 'design-lightbox',
76+
scope: $scope
77+
});
78+
}
79+
5380
}]
5481
};
5582
}

app/directives/challenge-user-place/design-challenge-user-place.directive.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
p.place(ng-show="challenge.userStatus === 'COMPLETED'") COMPLETED
66

77
.thumbnail(ng-click="openLightbox()", ng-class="{hidden: challenge.userStatus !== 'PASSED_REVIEW'}")
8-
img(ng-src="http://studio.{{DOMAIN}}/studio.jpg?module=DownloadSubmission&sbmid={{challenge.thumbnailId}}&sbt=full", fallback-src="/images/ico-picture.svg")
8+
img(ng-src="{{imageURL}}", fallback-src="/images/ico-picture.svg")
99

10-
.thumbnail-gallery(ng-click="challenge.showLightbox()")
10+
.thumbnail-gallery(ng-click="openLightbox()")
1111
.gallery-icon
1212

1313
.num-images 1 image
@@ -28,4 +28,4 @@
2828
.thumbnail-gallery(ng-click="challenge.showLightbox()")
2929
.gallery-icon
3030

31-
.num-images 1 image
31+
.num-images 1 image
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.lightbox-container
2+
.left-nav
3+
img(src="/images/ico-arrow-big-left.svg", ng-click="incrementIndex(-1)")
4+
5+
.selector
6+
.title {{challenge.name}}
7+
8+
9+
img(ng-src="{{selectedImage}}")
10+
11+
12+
.info
13+
| {{selectedIndex + 1}} of {{challenge.userDetails.submissions.length}}
14+
15+
.selections
16+
img.selection(
17+
ng-repeat="submission in challenge.userDetails.submissions",
18+
ng-src="{{submission.fullImage}}",
19+
ng-click="updateSelected(submission.fullImage, $index)",
20+
ng-class="{'current': submission.fullImage == selectedImage}"
21+
)
22+
23+
.right-nav
24+
img(src="/images/ico-arrow-big-right.svg", ng-click="incrementIndex(1)")
25+
26+
// img(ng-src="http://studio.{{DOMAIN}}/studio.jpg?module=DownloadSubmission&sbmid={{challenge.thumbnailId}}&sbt=full", fallback-src="/images/ico-picture.svg")

app/services/challenge.service.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
var service = {
1212
getChallenges: getChallenges,
1313
getUserChallenges: getUserChallenges,
14+
formatPastDesignChallenge: formatPastDesignChallenge,
1415
getUserMarathonMatches: getUserMarathonMatches,
1516
getReviewEndDate: getReviewEndDate,
1617
getChallengeDetails: getChallengeDetails,
@@ -32,6 +33,18 @@
3233
return api.one('members', handle.toLowerCase()).all('challenges').getList(params);
3334
}
3435

36+
function formatPastDesignChallenge(challenge) {
37+
if (!challenge.isPrivate && challenge.userDetails && challenge.userDetails.submissions && challenge.userDetails.submissions.length) {
38+
challenge.userDetails.submissions.forEach(function(submission) {
39+
var images = submission.images.filter(function(image) {
40+
return image.match('full') || image.match('thumb');
41+
});
42+
submission.fullImage = images[0];
43+
submission.thumbnailImage = images[1];
44+
});
45+
}
46+
}
47+
3548
function getUserMarathonMatches(handle, params) {
3649
return api.one('members', handle.toLowerCase()).all('mms').getList(params);
3750
}
Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,76 @@
11
.lightbox-container {
2+
font-family: 'Sofia Pro';
23
display: flex;
34
width: 100%;
45
margin: auto;
56
overflow: hidden;
7+
flex-direction: row;
68

7-
img {
8-
margin: 0 auto;
9+
.left-nav, .right-nav {
10+
display: flex;
11+
flex-direction: column;
12+
justify-content: center;
13+
align-items: center;
14+
width: 80px;
15+
img {
16+
width: 20px;
17+
&:hover {
18+
cursor: pointer;
19+
}
20+
}
21+
}
22+
23+
24+
.selector {
25+
26+
.title {
27+
font-size: 24px;
28+
margin: 30px auto;
29+
text-align: center;
30+
}
31+
32+
display: flex;
33+
flex-direction: column;
34+
justify-content: flex-start;
35+
36+
img {
37+
height: 550px;
38+
}
39+
40+
.info {
41+
color: #a3a3ae;
42+
text-align: right;
43+
}
44+
45+
.selections {
46+
img.selection {
47+
height: 60px;
48+
opacity: .6;
49+
&.current {
50+
border: solid 2px #0096ff;
51+
height: 62px;
52+
opacity: 1;
53+
}
54+
&:hover {
55+
cursor: pointer;
56+
opacity: 1;
57+
}
58+
}
59+
}
60+
}
61+
62+
63+
}
64+
65+
.design-lightbox {
66+
display: flex;
67+
justify-content: center;
68+
z-index: 10000;
69+
.ngdialog-content {
70+
.ngdialog-close { display: none; }
71+
opacity: .95;
72+
height: 742px;
73+
width: 768px;
74+
align-self: center;
975
}
1076
}

0 commit comments

Comments
 (0)