Skip to content

Commit

Permalink
Merge pull request #991 from appirio-tech/dev
Browse files Browse the repository at this point in the history
Bug Bash 1 Merge
  • Loading branch information
ajefts authored Feb 9, 2017
2 parents e581f85 + 80d9b3c commit ce1b96a
Show file tree
Hide file tree
Showing 23 changed files with 141 additions and 97 deletions.
8 changes: 5 additions & 3 deletions app/account/logout/logout.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import angular from 'angular'
describe('Logout Controller', function() {
var controller
var fakeWindow = {
// Without the `angular` field our fake window will crush
// `[email protected]` and higher!
angular: {
callbacks: {}
},
location: {
href: ''
}
Expand All @@ -15,14 +20,11 @@ describe('Logout Controller', function() {
angular.mock.module('tc.account', function($provide) {
$provide.value('$window', fakeWindow)
})

bard.inject(this, '$controller', 'TcAuthService', '$window', '$q', 'CONSTANTS')

bard.mockService(TcAuthService, {
logout: $q.when({}),
_default: $q.when({})
})

controller = $controller('LogoutController')
})

Expand Down
6 changes: 3 additions & 3 deletions app/directives/challenge-tile/challenge-tile.jade
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
.challenge-details
p.currentPhase {{challenge.userCurrentPhase}}

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

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

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

p.ends-in(ng-show="challenge.userCurrentPhaseEndTime") Ends: {{challenge.userCurrentPhaseEndTime[2] | localTime}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
div.paginator
tc-section(state="state")
button.tc-btn.tc-btn-s(ng-show="pageParams.totalCount > pageParams.currentCount", ng-click="loadMore()") Load More
button.tc-btn.tc-btn-s(ng-show="pageParams.totalCount > pageParams.currentCount && firstLoadMore", ng-click="loadMore()") Load More
2 changes: 1 addition & 1 deletion app/directives/tc-section/tc-section.jade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
section(ng-switch="state")
.section-loading(ng-switch-when="loading")
.section-loading(ng-transclude, ng-switch-when="loading")

.section-error(ng-switch-when="error")
p {{errMsg}}
Expand Down
1 change: 0 additions & 1 deletion app/layout/footer/footer.jade
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
footer.bottom-footer
// Footer links
nav.menu-item
.menu-item-header.show-small OTHERS

ul.submenu
li.submenu-item #[a.menu-link(ng-href="https://www.{{domain}}/sitemap") SITE MAP]
Expand Down
13 changes: 8 additions & 5 deletions app/my-challenges/my-challenges.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import _ from 'lodash'
vm.loadMore = loadMore
vm.getChallenges = getChallenges
vm.totalCount = 0
vm.firstLoadMore = true
// this will help to keep track of pagination across individual api calls
var counts = {
devDesign: {total: 0, current: 0},
Expand Down Expand Up @@ -99,7 +100,7 @@ import _ from 'lodash'

function getDevDesignChallenges(offset) {
var params = {
limit: 12,
limit: CONSTANTS.CHALLENGES_LOADING_CHUNK,
offset: offset,
orderBy: vm.orderBy + ' desc',
filter: 'status=' + vm.statusFilter
Expand All @@ -125,7 +126,7 @@ import _ from 'lodash'
_filter = 'status=past&isRatedForMM=true'
}
var params = {
limit: 12,
limit: CONSTANTS.CHALLENGES_LOADING_CHUNK,
offset: offset,
orderBy: vm.statusFilter === 'active' ? 'startDate' : 'endDate desc',
filter: _filter
Expand All @@ -142,12 +143,14 @@ import _ from 'lodash'
}

function loadMore() {
currentOffset+=12
vm.getChallenges(currentOffset, false)
if (vm.loading === CONSTANTS.STATE_READY) {
currentOffset += CONSTANTS.CHALLENGES_LOADING_CHUNK
vm.getChallenges(currentOffset, false)
}
}

window.onscroll = function() {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - CONSTANTS.INFINITE_SCROLL_OFFSET)) {
if (vm.totalCount > vm.myChallenges.length) {
vm.loadMore()
}
Expand Down
2 changes: 2 additions & 0 deletions app/my-challenges/my-challenges.jade
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@
challenge-tile(
ng-repeat="challenge in vm.myChallenges | orderBy:vm.orderBy:true",
challenge="challenge", view="vm.view", ng-class="vm.view + '-view'")

tc-section.load-more-section(state="vm.loading")
6 changes: 6 additions & 0 deletions app/profile/badges/badges.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,12 @@ import moment from 'moment-timezone'
name: 'Predix Community',
groupClass: 'Predix-Community',
active: false
},
{
id: 1009,
name: 'iOS Community',
groupClass: 'iOS-Community',
active: false
}
]
}
Expand Down
20 changes: 17 additions & 3 deletions app/profile/subtrack/subtrack.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import _ from 'lodash'
vm.showNav = showNav
vm.back = back
vm.subTrackStats = []

vm.loadMore = loadMore
vm.pageName = vm.subTrack

vm.tabs = ['statistics']

if (vm.track !== 'COPILOT') {
Expand All @@ -41,7 +40,7 @@ import _ from 'lodash'
// paging params, these are updated by tc-pager
vm.pageParams = {
currentOffset : 0,
limit: 16,
limit: CONSTANTS.CHALLENGES_LOADING_CHUNK,
currentCount: 0,
totalCount: 0,
// counter used to indicate page change
Expand Down Expand Up @@ -156,6 +155,21 @@ import _ from 'lodash'
$window.history.back()
}

function loadMore() {
if (vm.status.challenges === CONSTANTS.STATE_READY) {
vm.pageParams.currentOffset += CONSTANTS.CHALLENGES_LOADING_CHUNK
_getChallenges()
}
}

window.onscroll = function() {
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - CONSTANTS.INFINITE_SCROLL_OFFSET)) {
if (vm.pageParams.totalCount > vm.challenges.length) {
vm.loadMore()
}
}
}

function _getChallenges() {
vm.status.challenges = CONSTANTS.STATE_LOADING
var params = {
Expand Down
5 changes: 2 additions & 3 deletions app/services/blog.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import X2JS from 'xml2js'

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

deferred.resolve(result)
})
})
.error(function(error) {
}, function(error) {
deferred.reject(error)
})

Expand Down
1 change: 1 addition & 0 deletions app/services/challenge.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ import moment from 'moment'
// Add actual time ['2', 'months', actual date]
timeAndUnit.push(fullTime)
challenge.userCurrentPhaseEndTime = timeAndUnit
challenge.isLate = moment().diff(fullTime) > 0 // If > 0 then the challenge has 'Late Deliverables' or
}
})
}
Expand Down
5 changes: 5 additions & 0 deletions app/services/helpers.service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const mockData = require('../../tests/test-helpers/mock-data')
describe('Helper Service', function() {

var fakeWindow = {
// Without the `angular` field our fake window will crush
// `[email protected]` and higher!
angular: {
callbacks: {}
},
location: {
href: '/'
},
Expand Down
5 changes: 5 additions & 0 deletions app/services/jwtInterceptor.service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ describe('JWT Interceptor Service', function() {
})
},
fakeWindow = {
// Without the `angular` field our fake window will crush
// `[email protected]` and higher!
angular: {
callbacks: {}
},
location: ''
}

Expand Down
4 changes: 3 additions & 1 deletion app/topcoder.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ angular.module('CONSTANTS', []).constant('CONSTANTS', {
'REGISTERED' : 'REGISTERED',
'SUBMISSION_TYPE_CONTEST': 'Contest Submission',
'STATUS_ACTIVE' : 'Active',
'STATUS_COMPLETED_WITHOUT_WIN' : 'Completed Without Win'
'STATUS_COMPLETED_WITHOUT_WIN' : 'Completed Without Win',
'CHALLENGES_LOADING_CHUNK' : 36,
'INFINITE_SCROLL_OFFSET' : '400' // footer is 300px and challenge tile is 400px
})
3 changes: 3 additions & 0 deletions assets/css/directives/badge-tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@
.Predix-Community {
background-position: -50px -672px;
}
.iOS-Community {
background-position: -95px -672px;
}
.Wireframe {
width: 31px;
background-position: 0px -1009px !important;
Expand Down
12 changes: 12 additions & 0 deletions assets/css/directives/challenge-tile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ challenge-tile .challenge.tile-view {
text-transform: lowercase;
color: #7F7F7F;
}

&.challenge-late {
.ends-in, .time-remaining, .unit-of-time {
color: #ee6666;
}
}
}

.stalled-challenge {
Expand Down Expand Up @@ -462,6 +468,12 @@ challenge-tile .challenge.list-view {
font-size: 14px;
color: #A3A3AE;
}

&.challenge-late {
.ends-in, .time-remaining, .unit-of-time {
color: #ee6666;
}
}
}

.marathon-score {
Expand Down
1 change: 1 addition & 0 deletions assets/css/directives/tc-section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

.section-loading {
width: 100%;
min-width: 50px;
min-height: 100px;
background: url(../../images/ripple.gif) no-repeat center center;
}
Expand Down
Loading

0 comments on commit ce1b96a

Please sign in to comment.