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

Community fixes 1 and initial listings page #931

Merged
merged 27 commits into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7962e8c
Topcoder - Fix position of X to close Badges popup v1
iversonLv Dec 16, 2016
a401205
Issue_905 -iversonLv- X to close Badges pop up is too far to the right
Dec 22, 2016
275e0e1
Misc bug fixes
ThomasKranitsas Dec 28, 2016
f0a96ea
Fix lint error
ThomasKranitsas Dec 30, 2016
2d4c680
Github issue #919, Few Unit tests failing after angular 1.6.x release
Jan 2, 2017
85bb85c
Github issue #919, Few Unit tests failing after angular 1.6.x release
Jan 2, 2017
7e34139
Merge pull request #921 from appirio-tech/feature/fix_unit_tests
Jan 2, 2017
96bbfea
Merge https://github.com/iversonLv/topcoder-app into dev
iversonLv Jan 2, 2017
cd61da6
Merge branch 'dev' of https://github.com/appirio-tech/topcoder-app in…
iversonLv Jan 2, 2017
2276527
Merge pull request #916 from iversonLv/dev
talesforce Jan 2, 2017
1b4d814
Merge remote-tracking branch 'upstream/dev' into dev
ThomasKranitsas Jan 2, 2017
802bdbb
Merge pull request #920 from ThomasKranitsas/dev
talesforce Jan 2, 2017
5b65b1d
Created new empty module for listings
tladendo Jan 4, 2017
f07fa15
Finished pulling in filters
tladendo Jan 4, 2017
2aabd28
cleanup
tladendo Jan 4, 2017
f07fe6d
more cleanup
tladendo Jan 5, 2017
52b68b3
Changed auth for listings
tladendo Jan 5, 2017
30c46f5
Merge branch 'dev' into new-listings
tladendo Jan 5, 2017
70d9b7b
Merge pull request #923 from appirio-tech/new-listings
tladendo Jan 5, 2017
6864a70
reverted some commits that broke the build
tladendo Jan 5, 2017
b4ebe65
Merge pull request #925 from appirio-tech/new-listings
tladendo Jan 5, 2017
13f67bf
Re-add thomaskranitsas' changes
tladendo Jan 10, 2017
6b6aa96
Fix build errors
ThomasKranitsas Jan 12, 2017
59ba29d
Merge pull request #928 from ThomasKranitsas/tom-fix-build
tladendo Jan 12, 2017
9d93893
Merge pull request #929 from appirio-tech/tom-fix-build
tladendo Jan 12, 2017
969720c
updated to new react-components branch
tladendo Jan 13, 2017
c5c65d2
Merge pull request #930 from appirio-tech/tom-card-filter-merge
tladendo Jan 13, 2017
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
4 changes: 2 additions & 2 deletions app/directives/challenge-links/challenge-links.jade
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.challenge-links(ng-class="view + '-view'")
a.registrants(ng-href="{{challenge|challengeLinks:'registrants'}}", ng-switch="challenge.subTrack")
a.registrants(ng-href="{{challenge|challengeLinks:'registrants'}}", ng-switch="challenge.subTrack", target="_self")
.icon.registrants-icon
p(ng-switch-when="MARATHON_MATCH") {{challenge.numRegistrants[0]}}
p(ng-switch-default) {{challenge.numRegistrants}}

a.submissions(ng-hide="challenge.track === 'DATA_SCIENCE'", ng-href="{{challenge|challengeLinks:'submissions'}}")
a.submissions(ng-hide="challenge.track === 'DATA_SCIENCE'", ng-href="{{challenge|challengeLinks:'submissions'}}", target="_self")
.icon.submissions-icon
p {{challenge.numSubmissions}}

Expand Down
1 change: 1 addition & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require('angucomplete-alt')
require('angularjs-toaster')
require('ng-dialog')
require('xml2js')
require('ngreact')

require('appirio-tech-ng-ui-components')
require('appirio-tech-ng-iso-constants')
Expand Down
23 changes: 23 additions & 0 deletions app/listings/listings.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import angular from 'angular'

(function () {
'use strict'

angular.module('tc.listings').controller('ListingsCtrl', ListingsCtrl)

ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q',
'TcAuthService', 'UserService', 'UserStatsService', 'ProfileService', 'ChallengeService', 'ExternalAccountService',
'ngDialog', '$anchorScroll'
]

function ListingsCtrl(CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll) {

activate()

function activate() {
logger.debug('Calling ListingsController activate()')

}
}

})()
1 change: 1 addition & 0 deletions app/listings/listings.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
react-component(name="ChallengeFiltersExample")
21 changes: 21 additions & 0 deletions app/listings/listings.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import angular from 'angular'
import { ChallengeFiltersExample } from 'appirio-tech-react-components'

(function() {
'use strict'

var dependencies = [
'angular-jwt',
'ui.router',
'ngCookies',
'tc.services',
'tcUIComponents',
'angularSlideables',
'ngDialog',
'react'
]

angular.module('tc.listings', dependencies)
.value('ChallengeFiltersExample', ChallengeFiltersExample.default)

})()
43 changes: 43 additions & 0 deletions app/listings/listings.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import angular from 'angular'

(function() {
'use strict'

angular.module('tc.listings').config([
'$stateProvider',
routes
]).run(['$rootScope', '$state', function($rootScope, $state) {
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
// if (toState.name.indexOf('sloog') > -1 && 400 <= error.status <= 500 ) {
//
// // unable to find a member with that username
// $state.go('404')
// }
})
}])

function routes($stateProvider) {
var states = {
'listings': {
parent: 'root',
url: '/listings/',
template: require('./listings')(),
controller: 'ListingsCtrl as vm',
resolve: {
userHandle: ['$stateParams', function($stateParams) {
return $stateParams.userHandle
}]
},
data: {
authRequired: false,
title: 'Listings'
}
}
}

for (var name in states) {
var state = states[name]
$stateProvider.state(name, state)
}
}
})()
8 changes: 8 additions & 0 deletions app/my-challenges/my-challenges.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ import _ from 'lodash'
vm.getChallenges(currentOffset, false)
}

window.onscroll = function() {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
if (vm.totalCount > vm.myChallenges.length) {
vm.loadMore()
}
}
}

function _checkForParticipation() {
return ChallengeService.checkChallengeParticipation(vm.handle, function(participated) {
vm.neverParticipated = !participated
Expand Down
9 changes: 3 additions & 6 deletions app/my-challenges/my-challenges.jade
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.my-challenges-container
.my-challenges

.page-header
page-state-header(handle="{{vm.handle}}", page-title="My Challenges", hide-money="true", show-back-link="true", default-state="dashboard")

Expand All @@ -26,10 +26,7 @@

.hasChallenges(ng-show="vm.myChallenges.length", state="vm.loading")

.data(ng-class="vm.view + '-view'")
.data(ng-class="vm.view + '-view'")
challenge-tile(
ng-repeat="challenge in vm.myChallenges | orderBy:vm.orderBy:true",
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")
button.tc-btn(ng-show="vm.totalCount > vm.myChallenges.length", ng-click="vm.loadMore()") Load More
84 changes: 3 additions & 81 deletions app/my-dashboard/header-dashboard/header-dashboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,15 @@ const mockData = require('../../../tests/test-helpers/mock-data')

/* jshint -W117, -W030 */
describe('Header Dashboard Controller', function() {
var userService, profileService, identity
var profile = mockData.getMockProfile()
var stats = mockData.getMockStats()
var financials = mockData.getMockUserFinancials()

beforeEach(function() {
bard.appModule('topcoder')
bard.inject(this,
'$controller',
'$rootScope',
'$q',
'UserService',
'ProfileService',
'Helpers')

userService = UserService
profileService = ProfileService

identity = function() {
return {
handle: 'albertwang',
userId: 123456
}
}

// mock user api
sinon.stub(userService, 'getUserIdentity', function() {
return {
userId: 1234567,
handle: 'ut',
email: '[email protected]'
}
})

// mock profile api
sinon.stub(profileService, 'getUserProfile', function(handle) {
var deferred = $q.defer()
deferred.resolve(profile)
return deferred.promise
})
sinon.stub(profileService, 'getUserStats', function(handle) {
var deferred = $q.defer()
deferred.resolve(stats)
return deferred.promise
})
sinon.stub(profileService, 'getUserFinancials', function(handle) {
var deferred = $q.defer()
deferred.resolve(financials)
return deferred.promise
})
})

bard.verifyNoOutstandingHttpRequests()
Expand All @@ -61,33 +20,6 @@ describe('Header Dashboard Controller', function() {
var controller = null
beforeEach( function(){
controller = $controller('HeaderDashboardController', {
UserService : userService,
ProfileService: profileService,
userIdentity: identity,
profile: profile
})
$rootScope.$apply()
})

it('variables should be initialized to correct value', function() {
expect(controller.profile).to.exist
expect(controller.profile.handle).to.equal('albertwang')
})
})

describe('inialization with profile api stats endpoint error', function() {
var controller = null
beforeEach( function(){
profileService.getUserStats.restore()
sinon.stub(profileService, 'getUserStats', function(handle) {
var deferred = $q.defer()
deferred.reject('failed')
return deferred.promise
})
controller = $controller('HeaderDashboardController', {
UserService : userService,
ProfileService: profileService,
userIdentity: identity,
profile: profile
})
$rootScope.$apply()
Expand All @@ -99,27 +31,17 @@ describe('Header Dashboard Controller', function() {
})
})

describe('inialization with profile api profile endpoint error', function() {
describe('inialization with null profile', function() {
var controller = null
beforeEach( function(){
profileService.getUserProfile.restore()
sinon.stub(profileService, 'getUserProfile', function(handle) {
var deferred = $q.defer()
deferred.reject('failed')
return deferred.promise
})
controller = $controller('HeaderDashboardController', {
UserService : userService,
ProfileService: profileService,
userIdentity: identity,
profile: profileService.getUserProfile()
profile: null
})
$rootScope.$apply()
})

it('variables should be initialized to correct value', function() {
expect(controller.profile.$$state.status).to.equal(2)
expect(controller.profile.$$state.value).to.equal('failed')
expect(controller.profile).to.be.null
})
})

Expand Down
1 change: 1 addition & 0 deletions app/profile/badges/badges.jade
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
header.head
.ngdialog-close
.breadcrumbs
.handle
img.profile-circle(fallback-src=require("../../../assets/images/avatarPlaceholder.png"), ng-src="{{vm.profile.photoURL}}")
Expand Down
2 changes: 1 addition & 1 deletion app/services/externalAccounts.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ import _ from 'lodash'
} else {
logger.error('Unsupported social login backend', provider)

$q.reject({
reject({
status: 'failed',
'error': 'Unsupported social login backend \'' + provider + '\''
})
Expand Down
Loading