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

Commit ce1b96a

Browse files
authored
Merge pull request #991 from appirio-tech/dev
Bug Bash 1 Merge
2 parents e581f85 + 80d9b3c commit ce1b96a

23 files changed

+141
-97
lines changed

Diff for: app/account/logout/logout.spec.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import angular from 'angular'
44
describe('Logout Controller', function() {
55
var controller
66
var fakeWindow = {
7+
// Without the `angular` field our fake window will crush
8+
// `[email protected]` and higher!
9+
angular: {
10+
callbacks: {}
11+
},
712
location: {
813
href: ''
914
}
@@ -15,14 +20,11 @@ describe('Logout Controller', function() {
1520
angular.mock.module('tc.account', function($provide) {
1621
$provide.value('$window', fakeWindow)
1722
})
18-
1923
bard.inject(this, '$controller', 'TcAuthService', '$window', '$q', 'CONSTANTS')
20-
2124
bard.mockService(TcAuthService, {
2225
logout: $q.when({}),
2326
_default: $q.when({})
2427
})
25-
2628
controller = $controller('LogoutController')
2729
})
2830

Diff for: app/directives/challenge-tile/challenge-tile.jade

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
.challenge-details
1313
p.currentPhase {{challenge.userCurrentPhase}}
1414

15-
.challenge-calendar(ng-show="challenge.userCurrentPhaseEndTime")
16-
p.ends-in Ends In
15+
.challenge-calendar(ng-show="challenge.userCurrentPhaseEndTime", ng-class="{'challenge-late' : challenge.isLate}")
16+
p.ends-in {{challenge.isLate ? 'Late for' : 'Ends In'}}
1717
p.time-remaining {{challenge.userCurrentPhaseEndTime[0]}}
1818
p.unit-of-time {{challenge.userCurrentPhaseEndTime[1]}}
1919

@@ -88,7 +88,7 @@
8888
p.roles(ng-hide="challenge.track === 'DATA_SCIENCE'") #[span Role: ] #[span {{challenge.userDetails.roles | listRoles}}]
8989

9090
.challenge-details
91-
.challenge-info
91+
.challenge-info(ng-class="{'challenge-late' : challenge.isLate}")
9292
p.currentPhase {{challenge.userCurrentPhase}}
9393

9494
p.ends-in(ng-show="challenge.userCurrentPhaseEndTime") Ends: {{challenge.userCurrentPhaseEndTime[2] | localTime}}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
div.paginator
22
tc-section(state="state")
3-
button.tc-btn.tc-btn-s(ng-show="pageParams.totalCount > pageParams.currentCount", ng-click="loadMore()") Load More
3+
button.tc-btn.tc-btn-s(ng-show="pageParams.totalCount > pageParams.currentCount && firstLoadMore", ng-click="loadMore()") Load More

Diff for: app/directives/tc-section/tc-section.jade

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
section(ng-switch="state")
2-
.section-loading(ng-switch-when="loading")
2+
.section-loading(ng-transclude, ng-switch-when="loading")
33

44
.section-error(ng-switch-when="error")
55
p {{errMsg}}

Diff for: app/layout/footer/footer.jade

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
footer.bottom-footer
22
// Footer links
33
nav.menu-item
4-
.menu-item-header.show-small OTHERS
54

65
ul.submenu
76
li.submenu-item #[a.menu-link(ng-href="https://www.{{domain}}/sitemap") SITE MAP]

Diff for: app/my-challenges/my-challenges.controller.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import _ from 'lodash'
2020
vm.loadMore = loadMore
2121
vm.getChallenges = getChallenges
2222
vm.totalCount = 0
23+
vm.firstLoadMore = true
2324
// this will help to keep track of pagination across individual api calls
2425
var counts = {
2526
devDesign: {total: 0, current: 0},
@@ -99,7 +100,7 @@ import _ from 'lodash'
99100

100101
function getDevDesignChallenges(offset) {
101102
var params = {
102-
limit: 12,
103+
limit: CONSTANTS.CHALLENGES_LOADING_CHUNK,
103104
offset: offset,
104105
orderBy: vm.orderBy + ' desc',
105106
filter: 'status=' + vm.statusFilter
@@ -125,7 +126,7 @@ import _ from 'lodash'
125126
_filter = 'status=past&isRatedForMM=true'
126127
}
127128
var params = {
128-
limit: 12,
129+
limit: CONSTANTS.CHALLENGES_LOADING_CHUNK,
129130
offset: offset,
130131
orderBy: vm.statusFilter === 'active' ? 'startDate' : 'endDate desc',
131132
filter: _filter
@@ -142,12 +143,14 @@ import _ from 'lodash'
142143
}
143144

144145
function loadMore() {
145-
currentOffset+=12
146-
vm.getChallenges(currentOffset, false)
146+
if (vm.loading === CONSTANTS.STATE_READY) {
147+
currentOffset += CONSTANTS.CHALLENGES_LOADING_CHUNK
148+
vm.getChallenges(currentOffset, false)
149+
}
147150
}
148151

149152
window.onscroll = function() {
150-
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
153+
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - CONSTANTS.INFINITE_SCROLL_OFFSET)) {
151154
if (vm.totalCount > vm.myChallenges.length) {
152155
vm.loadMore()
153156
}

Diff for: app/my-challenges/my-challenges.jade

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@
3030
challenge-tile(
3131
ng-repeat="challenge in vm.myChallenges | orderBy:vm.orderBy:true",
3232
challenge="challenge", view="vm.view", ng-class="vm.view + '-view'")
33+
34+
tc-section.load-more-section(state="vm.loading")

Diff for: app/profile/badges/badges.controller.js

+6
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,12 @@ import moment from 'moment-timezone'
661661
name: 'Predix Community',
662662
groupClass: 'Predix-Community',
663663
active: false
664+
},
665+
{
666+
id: 1009,
667+
name: 'iOS Community',
668+
groupClass: 'iOS-Community',
669+
active: false
664670
}
665671
]
666672
}

Diff for: app/profile/subtrack/subtrack.controller.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ import _ from 'lodash'
2626
vm.showNav = showNav
2727
vm.back = back
2828
vm.subTrackStats = []
29-
29+
vm.loadMore = loadMore
3030
vm.pageName = vm.subTrack
31-
3231
vm.tabs = ['statistics']
3332

3433
if (vm.track !== 'COPILOT') {
@@ -41,7 +40,7 @@ import _ from 'lodash'
4140
// paging params, these are updated by tc-pager
4241
vm.pageParams = {
4342
currentOffset : 0,
44-
limit: 16,
43+
limit: CONSTANTS.CHALLENGES_LOADING_CHUNK,
4544
currentCount: 0,
4645
totalCount: 0,
4746
// counter used to indicate page change
@@ -156,6 +155,21 @@ import _ from 'lodash'
156155
$window.history.back()
157156
}
158157

158+
function loadMore() {
159+
if (vm.status.challenges === CONSTANTS.STATE_READY) {
160+
vm.pageParams.currentOffset += CONSTANTS.CHALLENGES_LOADING_CHUNK
161+
_getChallenges()
162+
}
163+
}
164+
165+
window.onscroll = function() {
166+
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - CONSTANTS.INFINITE_SCROLL_OFFSET)) {
167+
if (vm.pageParams.totalCount > vm.challenges.length) {
168+
vm.loadMore()
169+
}
170+
}
171+
}
172+
159173
function _getChallenges() {
160174
vm.status.challenges = CONSTANTS.STATE_LOADING
161175
var params = {

Diff for: app/services/blog.service.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import X2JS from 'xml2js'
1919

2020
// fetch blog rss feed
2121
$http.get(CONSTANTS.BLOG_LOCATION)
22-
.success(function(data) {
22+
.then(function(data) {
2323
// parse the blog rss feed using x2js
2424
var parseString = X2JS.parseString
2525
parseString(data.trim(), function (err, res) {
@@ -38,8 +38,7 @@ import X2JS from 'xml2js'
3838

3939
deferred.resolve(result)
4040
})
41-
})
42-
.error(function(error) {
41+
}, function(error) {
4342
deferred.reject(error)
4443
})
4544

Diff for: app/services/challenge.service.js

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ import moment from 'moment'
119119
// Add actual time ['2', 'months', actual date]
120120
timeAndUnit.push(fullTime)
121121
challenge.userCurrentPhaseEndTime = timeAndUnit
122+
challenge.isLate = moment().diff(fullTime) > 0 // If > 0 then the challenge has 'Late Deliverables' or
122123
}
123124
})
124125
}

Diff for: app/services/helpers.service.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ const mockData = require('../../tests/test-helpers/mock-data')
55
describe('Helper Service', function() {
66

77
var fakeWindow = {
8+
// Without the `angular` field our fake window will crush
9+
// `[email protected]` and higher!
10+
angular: {
11+
callbacks: {}
12+
},
813
location: {
914
href: '/'
1015
},

Diff for: app/services/jwtInterceptor.service.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ describe('JWT Interceptor Service', function() {
3333
})
3434
},
3535
fakeWindow = {
36+
// Without the `angular` field our fake window will crush
37+
// `[email protected]` and higher!
38+
angular: {
39+
callbacks: {}
40+
},
3641
location: ''
3742
}
3843

Diff for: app/topcoder.constants.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ angular.module('CONSTANTS', []).constant('CONSTANTS', {
4343
'REGISTERED' : 'REGISTERED',
4444
'SUBMISSION_TYPE_CONTEST': 'Contest Submission',
4545
'STATUS_ACTIVE' : 'Active',
46-
'STATUS_COMPLETED_WITHOUT_WIN' : 'Completed Without Win'
46+
'STATUS_COMPLETED_WITHOUT_WIN' : 'Completed Without Win',
47+
'CHALLENGES_LOADING_CHUNK' : 36,
48+
'INFINITE_SCROLL_OFFSET' : '400' // footer is 300px and challenge tile is 400px
4749
})

Diff for: assets/css/directives/badge-tooltip.scss

+3
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@
440440
.Predix-Community {
441441
background-position: -50px -672px;
442442
}
443+
.iOS-Community {
444+
background-position: -95px -672px;
445+
}
443446
.Wireframe {
444447
width: 31px;
445448
background-position: 0px -1009px !important;

Diff for: assets/css/directives/challenge-tile.scss

+12
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ challenge-tile .challenge.tile-view {
222222
text-transform: lowercase;
223223
color: #7F7F7F;
224224
}
225+
226+
&.challenge-late {
227+
.ends-in, .time-remaining, .unit-of-time {
228+
color: #ee6666;
229+
}
230+
}
225231
}
226232

227233
.stalled-challenge {
@@ -462,6 +468,12 @@ challenge-tile .challenge.list-view {
462468
font-size: 14px;
463469
color: #A3A3AE;
464470
}
471+
472+
&.challenge-late {
473+
.ends-in, .time-remaining, .unit-of-time {
474+
color: #ee6666;
475+
}
476+
}
465477
}
466478

467479
.marathon-score {

Diff for: assets/css/directives/tc-section.scss

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
.section-loading {
77
width: 100%;
8+
min-width: 50px;
89
min-height: 100px;
910
background: url(../../images/ripple.gif) no-repeat center center;
1011
}

0 commit comments

Comments
 (0)