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

Commit 11583ef

Browse files
author
vikasrohit
committed
Merge branch 'dev' into feature/sup-2481-intergrate-web-links-api
* dev: (25 commits) removed extra <git> fixed JADE style spacing; css clean, added helper classes for spacings (margin) button spacing fixed form > p style fixed back on track container style added, consistent with everything else. added .csscomb.json; fixed password style fixing the password styles Format and remove console logs iff -> ternary Add styleguide generator Hide money if 0 Fix alignment for srm cards Remove flex on mobile and add vertical align SUP-2577, Bug Hunt should show wins not ratings as the main metric in profile and dashboard SUP-2599, Change copy on empty state for dashboard buncha new tests Change 2 links to use states Add includes and proper variables SUP-2582, Upcoming SRMs should be ordered by most recent date SUP-2582, Upcoming SRMs should be ordered by most recent date ...
2 parents a1df4e4 + f0d455f commit 11583ef

File tree

102 files changed

+63890
-503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+63890
-503
lines changed

.csscomb.json

Lines changed: 419 additions & 0 deletions
Large diffs are not rendered by default.

app/account/reset-password/reset-password.jade

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
header
44
a.logo-link(href="/")
55
img(src="/images/logo_mobile.svg", alt="Topcoder Logo")
6+
67
.arrow
8+
79
h1(class="header") PASSWORD RESET
810

911
form.reset-form(name='vm.generateTokenForm', role="form", ng-submit="vm.generateTokenForm.$valid && vm.sendLink()", novalidate)
10-
1112
p.email-label Please enter your email address, and we'll send you a link to reset your password
1213

1314
.validation-bar(ng-class="{ 'error-bar': (vm.generateTokenForm.email.$dirty && vm.generateTokenForm.email.$invalid), 'success-bar': (vm.generateTokenForm.email.$valid) }")
@@ -16,16 +17,20 @@
1617

1718
.tips.email-tips(ng-show="vm.emailTips")
1819
.arrow
20+
1921
h3 Email Tips:
2022

2123
p Enter your email address and we'll get back to you with a reset link
2224

2325
.form-errors
2426
p.form-error(ng-show="vm.generateTokenForm.email.$dirty && vm.generateTokenForm.email.$invalid") Please enter a valid email address.
27+
2528
p.form-error(ng-show="vm.alreadySent") You already requested a reset link recently. Please check your inbox or spam folder. If you have any trouble, please contact
2629
a(href="mailto:[email protected]?Subject=Unable%20to%20reset%20my%20password" target="_top") [email protected]
30+
2731
p.form-error(ng-show="vm.emailNotFound") We couldn't find a member with that email address. Please check that you entered it correctly. If you continue to have trouble, please contact
2832
a(href="mailto:[email protected]?Subject=Unable%20to%20reset%20my%20password" target="_top") [email protected]
33+
2934
p.form-error(ng-show="vm.unkownError") We were unable to send you a reset link because of a temporary problem. Please try again. If you continue to have trouble, please contact
3035
a(href="mailto:[email protected]?Subject=Unable%20to%20reset%20my%20password" target="_top") [email protected]
3136

@@ -34,29 +39,39 @@
3439
a.link(ui-sref="login") Back to Login
3540

3641
.reset-password-container(ng-show="vm.resetTokenSent")
42+
header
43+
a.logo-link(href="/")
44+
img(src="/images/logo_mobile.svg", alt="Topcoder Logo")
45+
46+
.arrow
47+
3748
h1(class="header") Back on Track!
38-
p We have sent you an email with a link to reset your password.
49+
50+
p(class="m-b-lg") We have sent you an email with a link to reset your password.
51+
3952
a.link(ui-sref="login") Back to Login
4053

4154
.reset-password-container(ng-show="vm.token")
4255
header
4356
img(src="/images/logo_mobile.svg", alt="Topcoder Logo")
57+
4458
.arrow
59+
4560
h1(class="header") CREATE NEW PASSWORD
4661

4762
form.reset-form(name='vm.resetPasswordForm', role="form", ng-submit="vm.resetPasswordForm.$valid && vm.resetPassword()", novalidate)
48-
4963
.validation-bar(ng-class="{ 'success-bar': (vm.resetPasswordForm.password.$valid) }")
5064
toggle-password-with-tips
5165

5266
.tips.password-tips(ng-show="vm.passwordFocus")
5367
.arrow
68+
5469
h3 Password Tips:
55-
70+
5671
p(ng-class="{ 'has-length-between-range': (vm.resetPasswordForm.password.$dirty && !vm.resetPasswordForm.password.$error.minlength && !vm.resetPasswordForm.password.$error.maxlength && !vm.resetPasswordForm.password.$error.required) }") Must be between 8 and 64 characters
57-
72+
5873
p(ng-class="{ 'has-letter': (vm.resetPasswordForm.password.$dirty && !vm.resetPasswordForm.password.$error.hasLetter) }") At least one letter
59-
74+
6075
p(ng-class="{ 'has-symbol-or-number': (vm.resetPasswordForm.password.$dirty && !vm.resetPasswordForm.password.$error.hasSymbolOrNumber) }") At least one number or symbol
6176

6277
.form-errors

app/directives/page-state-header/page-state-header.directive.jade

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22
header
33
.page-info
44
h1 {{pageTitle}}
5+
56
div(ng-transclude)
7+
68
.info
79
.pic
810
a(ui-sref="profile.about({userHandle: vm.profile.handle})")
911
img.profile-circle(ng-if="vm.profile.photoURL", ng-src="{{vm.profile.photoURL}}")
12+
1013
img.profile-circle(ng-if="!vm.profile.photoURL", src="/images/ico-user-default.svg")
11-
14+
1215
.user-stats(id="metrics", ng-hide="vm.loading")
1316
a.handle(style="color:{{vm.handleColor}};", ui-sref="profile.about({userHandle: vm.profile.handle})") {{vm.profile.handle}}
17+
1418
.money-earned(ng-hide="hideMoney")
1519
p.number(ng-bind="vm.moneyEarned | currency:'$':0")
20+
1621
p Earned
22+
1723
.back-link(ng-if="showBackLink && vm.previousStateLabel")
1824
a(ng-click="vm.backHandler()") Back to {{vm.previousStateLabel}}
1925

app/directives/page-state-header/page-state-header.directive.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,14 @@
1414
defaultState: '@'
1515
},
1616
controller: ['CONSTANTS', '$rootScope', '$scope', 'NotificationService', 'ProfileService', '$log', '$state', pageStateHeader],
17-
controllerAs: "vm"
17+
controllerAs: 'vm'
1818
};
1919
});
2020

2121
function pageStateHeader(CONSTANTS, $rootScope, $scope, NotificationService, ProfileService, $log, $state) {
2222
var vm = this;
23-
vm.handle = $scope.handle;
24-
vm.profile = null;
25-
vm.handleColor = null;
26-
vm.hideMoney = _.get($scope, 'hideMoney', true);
27-
vm.previousStateName = null;
28-
vm.previousStateLabel = null;
29-
vm.previousState = null;
30-
vm.showBackLink = _.get($scope, 'showBackLink', false);
3123
vm.backHandler = backHandler;
24+
3225
activate();
3326

3427
// watch for profile update event in case handle/image are updated
@@ -37,12 +30,21 @@
3730
});
3831

3932
function activate() {
33+
vm.handle = $scope.handle;
34+
vm.profile = null;
35+
vm.handleColor = null;
36+
$scope.hideMoney = _.get($scope, 'hideMoney', true);
37+
vm.previousStateName = null;
38+
vm.previousStateLabel = null;
39+
vm.previousState = null;
40+
vm.showBackLink = _.get($scope, 'showBackLink', false);
4041
vm.loading = true;
4142

4243
// identifies the previous state
4344
if ($scope.$root.previousState && $scope.$root.previousState.name.length > 0) {
4445
vm.previousState = $scope.$root.previousState;
4546
vm.previousStateName = vm.previousState.name;
47+
4648
} else if ($scope.defaultState) {
4749
vm.previousStateName = $scope.defaultState;
4850
}
@@ -51,6 +53,7 @@
5153
if (vm.previousStateName) {
5254
if (vm.previousStateName === 'dashboard') {
5355
vm.previousStateLabel = 'Dashboard';
56+
5457
} else if (vm.previousStateName.indexOf('profile') > -1) {
5558
vm.previousStateLabel = 'Profile';
5659
}
@@ -60,7 +63,8 @@
6063
ProfileService.getUserProfile(vm.handle).then(function(profile) {
6164
vm.profile = profile;
6265
vm.handleColor = ProfileService.getUserHandleColor(vm.profile);
63-
if (!vm.hideMoney) {
66+
67+
if (!$scope.hideMoney) {
6468
displayMoneyEarned(vm.handle);
6569
} else {
6670
vm.loading = false;
@@ -71,6 +75,7 @@
7175
function backHandler() {
7276
var _params = {};
7377
var _name = vm.previousStateName;
78+
7479
switch (vm.previousStateName) {
7580
case 'profile.about':
7681
_params = {userHandle: vm.profile.handle};
@@ -80,6 +85,7 @@
8085
_name = 'dashboard';
8186
break;
8287
}
88+
8389
$state.go(_name, _params);
8490
}
8591

@@ -89,13 +95,13 @@
8995
vm.moneyEarned = _.sum(_.pluck(financials, 'amount'));
9096

9197
if (!vm.moneyEarned) {
92-
vm.hideMoney = true;
98+
$scope.hideMoney = true;
9399
}
94100

95101
vm.loading = false;
96102
})
97103
.catch(function(err) {
98-
vm.hideMoney = true;
104+
$scope.hideMoney = true;
99105
vm.loading = false;
100106
});
101107
}

app/directives/tc-sticky/tc-sticky.directive.js

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,66 @@
66

77
function tcSticky(CONSTANTS, $window) {
88
return {
9-
restrict: 'A',
10-
link: function(scope, element) {
11-
scope.width = element.prop('offsetWidth');
12-
var elWidth = scope.width + 'px',
13-
elChild = angular.element(element[0].querySelector(':first-child'));
14-
// elChild.css('width', elWidth);
15-
var hitBottom = false;
16-
angular.element($window).bind("scroll", function() {
17-
var affixElement = document.getElementById('affix'),
18-
xPosition = 0,
19-
yPosition = 0;
20-
function getPosition(element) {
21-
while(element) {
22-
yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
23-
element = element.offsetParent;
24-
}
25-
}
26-
getPosition(affixElement);
27-
var height = angular.element(affixElement).prop('offsetHeight');
28-
var top = angular.element(affixElement).prop('offsetTop');
29-
// console.log(yPosition);
30-
// console.log(angular.element(document).scrollTop);
31-
// console.log(elChild[0].clientTop);
32-
if (yPosition >= 0 || $window.innerHeight <= elChild[0].offsetHeight || $window.innerWidth < 768) {
33-
elChild.removeClass('affix affix-bottom');
34-
} else if ( yPosition < 0) {
35-
var bodyRect = document.body.getBoundingClientRect()
36-
var elChildRect = elChild[0].getBoundingClientRect()
37-
var elChildAbsOffset = elChildRect.top - bodyRect.top;
38-
39-
var affixElementRect = affixElement.getBoundingClientRect();
40-
var affixElementAbsOffset = affixElementRect.top - bodyRect.top;
41-
42-
var elChildOffset = elChildAbsOffset - affixElementAbsOffset;
43-
var elChildHeight = elChild[0].clientHeight;
44-
var affixElementHeight = affixElement.clientHeight;
45-
46-
console.log(elChildRect.top);
47-
48-
var pastBottom = elChildOffset + elChildHeight > affixElementHeight;
49-
var topCovered = elChildRect.top > 10;
50-
51-
console.log('topcovered', topCovered);
52-
console.log('pastBottom', pastBottom);
53-
54-
elChild.addClass('affix');
55-
56-
if (pastBottom && !hitBottom) {
57-
hitBottom = true;
58-
elChild.addClass('affix-bottom');
59-
elChild.removeClass('affix');
60-
}
61-
62-
if (topCovered) {
63-
hitBottom = false;
64-
elChild.removeClass('affix-bottom');
65-
elChild.addClass('affix');
66-
}
67-
}
68-
});
69-
}
9+
restrict: 'A',
10+
link: function(scope, element) {
11+
scope.width = element.prop('offsetWidth');
12+
13+
var elWidth = scope.width + 'px';
14+
var elChild = angular.element(element[0].querySelector(':first-child'));
15+
// elChild.css('width', elWidth);
16+
17+
var hitBottom = false;
18+
19+
angular.element($window).bind("scroll", function() {
20+
var affixElement = document.getElementById('affix');
21+
var xPosition = 0;
22+
var yPosition = 0;
23+
24+
function getPosition(element) {
25+
while(element) {
26+
yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
27+
element = element.offsetParent;
28+
}
29+
}
30+
31+
getPosition(affixElement);
32+
33+
var height = angular.element(affixElement).prop('offsetHeight');
34+
var top = angular.element(affixElement).prop('offsetTop');
35+
36+
if (yPosition >= 0 || $window.innerHeight <= elChild[0].offsetHeight || $window.innerWidth < 768) {
37+
elChild.removeClass('affix affix-bottom');
38+
} else if ( yPosition < 0) {
39+
var bodyRect = document.body.getBoundingClientRect()
40+
var elChildRect = elChild[0].getBoundingClientRect()
41+
var elChildAbsOffset = elChildRect.top - bodyRect.top;
42+
43+
var affixElementRect = affixElement.getBoundingClientRect();
44+
var affixElementAbsOffset = affixElementRect.top - bodyRect.top;
45+
46+
var elChildOffset = elChildAbsOffset - affixElementAbsOffset;
47+
var elChildHeight = elChild[0].clientHeight;
48+
var affixElementHeight = affixElement.clientHeight;
49+
50+
var pastBottom = elChildOffset + elChildHeight > affixElementHeight;
51+
var topCovered = elChildRect.top > 10;
52+
53+
elChild.addClass('affix');
54+
55+
if (pastBottom && !hitBottom) {
56+
hitBottom = true;
57+
elChild.addClass('affix-bottom');
58+
elChild.removeClass('affix');
59+
}
60+
61+
if (topCovered) {
62+
hitBottom = false;
63+
elChild.removeClass('affix-bottom');
64+
elChild.addClass('affix');
65+
}
66+
}
67+
});
68+
}
7069
};
7170
}
7271
})();

app/filters/filters.spec.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ describe('filters', function() {
33

44
beforeEach(function() {
55
bard.appModule('topcoder');
6-
bard.inject(this, 'CONSTANTS', 'roleFilter', 'percentageFilter', 'ordinalFilter', 'displayLocationFilter', 'listRolesFilter', 'trackFilter', 'challengeLinksFilter');
6+
bard.inject(this, 'CONSTANTS', 'roleFilter', 'percentageFilter', 'ordinalFilter', 'displayLocationFilter', 'listRolesFilter', 'trackFilter', 'challengeLinksFilter', 'externalLinkColorFilter', 'emptyFilter', 'ternaryFilter');
77
domain = CONSTANTS.domain;
88
});
99

@@ -98,4 +98,41 @@ describe('filters', function() {
9898
expect(challengeLinksFilter(_ch, 'registrants')).to.be.equal('https://community.'+domain+'/longcontest/?module=ViewStandings&rd=3');
9999
});
100100
});
101+
102+
describe('externalLinkColorFilter', function() {
103+
104+
it('should handle twitter and linkedin correctly', function() {
105+
expect(externalLinkColorFilter('el-twitter')).to.be.equal('#62AADC');
106+
expect(externalLinkColorFilter('el-linkedin')).to.be.equal('#127CB5');
107+
});
108+
});
109+
110+
describe('emptyFilter', function() {
111+
it('should handle empty stuff correctly', function() {
112+
var a = emptyFilter(0);
113+
var b = emptyFilter(12);
114+
var c = emptyFilter(false);
115+
var d = emptyFilter(NaN);
116+
var e = emptyFilter('NaN');
117+
var f = emptyFilter('');
118+
var g = emptyFilter('%');
119+
expect(a).to.be.equal(0);
120+
expect(b).to.be.equal(12);
121+
expect(c).to.be.equal('-');
122+
expect(d).to.be.equal('-');
123+
expect(e).to.be.equal('-');
124+
expect(f).to.be.equal('-');
125+
expect(g).to.be.equal('-');
126+
});
127+
});
128+
129+
describe('ternaryFilter', function() {
130+
it('should function logically', function() {
131+
expect(ternaryFilter(true, 1, 2)).to.be.equal(1);
132+
expect(ternaryFilter(false, 1, 2)).to.be.equal(2);
133+
expect(ternaryFilter(0, 1, 2)).to.be.equal(2);
134+
console.log(jstz.determine().name());
135+
expect(ternaryFilter(true, 'm', 'n')).to.be.equal('m');
136+
});
137+
});
101138
});

0 commit comments

Comments
 (0)