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

Commit 430f8b6

Browse files
authored
Merge pull request #1250 from appirio-tech/dev
Updated announcement and banner in Dashboard + Some changes related to the skill-picker in registration flow?
2 parents 81593ee + fd548ec commit 430f8b6

File tree

11 files changed

+106
-41
lines changed

11 files changed

+106
-41
lines changed

app/my-dashboard/notifications/news.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
[
22
{
3-
"header": "TCO17",
4-
"details": "Congratulations to our Champions!",
5-
"backgroundImage": "tco-winners.jpg",
6-
"redirectTo": "https://tco17.topcoder.com",
7-
"redirectText": "Congratulations to our TCO17 Champions!",
3+
"header": "TCO18",
4+
"details": "Congratulations to all Stage 1 Winners!!",
5+
"headerExpand": "TCO18",
6+
"detailsExpand": "Congratulations to all of our Stage 1 Winners in every track! These members have earned an all-expense paid trip to the TCO18 finals. There are 3 more stages to go, so get competing!",
7+
"backgroundImage": "stage1-winners.png",
8+
"redirectTo": "https://tco18.topcoder.com",
9+
"redirectText": "TCO18 Homepage",
810
"live": false,
911
"liveExpand": false,
1012
"customTag": {

app/my-dashboard/notifications/notifications.jade

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
it will have same width, you can create a new .banner-row if you want place more banners
1010
in a new row
1111
.banner-row
12-
a.banner.tco17(href="https://tco17.topcoder.com/")
13-
img(src=require("../../../assets/images/tco17-web-logo-white.svg"), alt="TCO17")
12+
span.banner.tco17
1413
a.banner.watson(href="https://cognitive.topcoder.com/")
1514
img(src=require("../../../assets/images/logo_white.png"), alt="TCO17")

app/services/group.service.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import angular from 'angular'
2+
3+
(function () {
4+
'use strict'
5+
6+
angular.module('tc.services').factory('GroupService', GroupService)
7+
8+
GroupService.$inject = ['ApiService']
9+
10+
function GroupService(ApiService) {
11+
var service = ApiService.restangularV3
12+
13+
// Retrieves the registration status of the member for the given program
14+
service.getMembers = function(userId, programId) {
15+
return service.one('groups',programId).one('members').get()
16+
}
17+
18+
// Registers the given member for the given program.
19+
service.addMember = function(userId, programId) {
20+
return service.one('groups', programId).one('members').customPOST({
21+
memberId : userId +'', membershipType : 'user'
22+
})
23+
}
24+
25+
return service
26+
}
27+
})()

app/skill-picker/skill-picker.controller.js

+60-29
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import _ from 'lodash'
66

77
angular.module('tc.skill-picker').controller('SkillPickerController', SkillPickerController)
88

9-
SkillPickerController.$inject = ['$scope', 'CONSTANTS', 'ProfileService', '$state', 'userProfile', 'featuredSkills', 'logger', 'toaster', 'MemberCertService', '$q']
9+
SkillPickerController.$inject = ['$scope', 'CONSTANTS', 'ProfileService', '$state', 'userProfile', 'featuredSkills', 'logger', 'toaster', 'MemberCertService','GroupService', '$q']
1010

11-
function SkillPickerController($scope, CONSTANTS, ProfileService, $state, userProfile, featuredSkills, logger, toaster, MemberCertService, $q) {
11+
function SkillPickerController($scope, CONSTANTS, ProfileService, $state, userProfile, featuredSkills, logger, toaster, MemberCertService, GroupService, $q) {
1212
var vm = this
1313
vm.ASSET_PREFIX = CONSTANTS.ASSET_PREFIX
1414
vm.IOS_PROGRAM_ID = parseInt(CONSTANTS.SWIFT_PROGRAM_ID)
1515
vm.PREDIX_PROGRAM_ID = parseInt(CONSTANTS.PREDIX_PROGRAM_ID)
1616
vm.IBM_COGNITIVE_PROGRAM_ID = parseInt(CONSTANTS.IBM_COGNITIVE_PROGRAM_ID)
17+
vm.BLOCKCHAIN_PROGRAM_ID = parseInt(CONSTANTS.BLOCKCHAIN_PROGRAM_ID)
1718
vm.submitSkills = submitSkills
1819
vm.featuredSkills = featuredSkills
1920
vm.userId = userProfile.userId
@@ -22,12 +23,13 @@ import _ from 'lodash'
2223
vm.tracks = {}
2324
vm.mySkills = []
2425
vm.disableDoneButton = false
25-
vm.showCommunity = false
26+
vm.showCommunity = true
2627
vm.loadingCommunities = false
2728
vm.communities = {}
2829
vm.isPageDirty = isPageDirty
2930
vm.isTracksDirty = isTracksDirty
3031
vm.isCommunitySelected = isCommunitySelected
32+
vm.isPageStateDirty = false
3133
///////
3234
activate()
3335

@@ -42,20 +44,22 @@ import _ from 'lodash'
4244
/**
4345
* Verfies if the page state has been modified by the user in any way.
4446
*/
45-
function isPageDirty() {
47+
function isPageDirty() {
4648
return isTracksDirty() || isCommunitiesDirty()
4749
}
4850

4951
/**
5052
* Verfies if the tracks section state has been modified by the user in any way.
5153
*/
5254
function isTracksDirty() {
55+
vm.isPageStateDirty = true
5356
return vm.tracks.DESIGN || vm.tracks.DEVELOP || vm.tracks.DATA_SCIENCE
5457
}
5558
/**
5659
* Verfies if the communities section state has been modified by the user in any way.
5760
*/
5861
function isCommunitySelected() {
62+
vm.isPageStateDirty = true
5963
var community = _.find(vm.communities, {status: true, display: true})
6064
return !!community
6165
}
@@ -79,6 +83,14 @@ import _ from 'lodash'
7983
dirty: true,
8084
display: true
8185
}
86+
vm.communities['blockchain'] = {
87+
displayName: 'Blockchain',
88+
programId: vm.BLOCKCHAIN_PROGRAM_ID,
89+
status: false,
90+
dirty: false,
91+
display: true,
92+
groupCommunity: true
93+
}
8294
vm.communities['ios'] = {
8395
displayName: 'iOS',
8496
programId: vm.IOS_PROGRAM_ID,
@@ -92,10 +104,11 @@ import _ from 'lodash'
92104
status: false,
93105
dirty: false,
94106
display: true
95-
}
107+
}
96108
_addWatchToCommunity(vm.communities['ios'])
109+
_addWatchToCommunity(vm.communities['blockchain'])
97110
_addWatchToCommunity(vm.communities['predix'])
98-
_addWatchToCommunity(vm.communities['ibm_cognitive'])
111+
_addWatchToCommunity(vm.communities['ibm_cognitive'])
99112
}
100113

101114
/**
@@ -117,43 +130,59 @@ import _ from 'lodash'
117130
* Checks registration status of each community and updates the state of each community.
118131
*/
119132
function checkCommunityStatus() {
120-
var promises = []
133+
var eventAPIpromises = [], groupAPIPromises = []
121134
for (var name in vm.communities) {
122135
var community = vm.communities[name]
123-
promises.push(MemberCertService.getMemberRegistration(vm.userId, community.programId))
136+
if(community.groupCommunity){
137+
groupAPIPromises.push(GroupService.getMembers(vm.userId, community.programId))
138+
}else{
139+
eventAPIpromises.push(MemberCertService.getMemberRegistration(vm.userId, community.programId))
140+
}
124141
}
142+
125143
vm.loadingCommunities = true
126144

127-
$q.all(promises)
145+
$q.all(groupAPIPromises)
146+
.then(function(responses) {
147+
let members = responses[0] || []
148+
vm.loadingCommunities = false
149+
members.forEach(function(member) {
150+
if (member && member.memberId === vm.userId) {
151+
addWatchToExistingCommunity(member.groupId)
152+
}
153+
})
154+
})
155+
.catch(function(err) {
156+
logger.error('Could not load communities with group data', err)
157+
vm.loadingCommunities = false
158+
})
159+
160+
$q.all(eventAPIpromises)
128161
.then(function(responses) {
129162
vm.loadingCommunities = false
130163
responses.forEach(function(program) {
131-
if (program) {
132-
var community = _.find(vm.communities, {programId: program.eventId})
133-
if (community) {
134-
// set display false to avoid showing already enabled/registered program
135-
// we expect display property to be modified after first load of the page
136-
// community.status = true
137-
if (community.unregister){
138-
community.unregister()
139-
_addWatchToCommunity(community)
140-
}
141-
}
164+
if (program) {
165+
addWatchToExistingCommunity(program.eventId)
142166
}
143167
})
144-
// if there exists at least 1 community which can be displayed, set showCommunity flag to true
145-
var community = _.find(vm.communities, {display: true})
146-
if (community) {
147-
vm.showCommunity = true
148-
}
149168
})
150169
.catch(function(err) {
151170
logger.error('Could not load communities with member cert registration data', err)
152-
153171
vm.loadingCommunities = false
154172
})
155173
}
156174

175+
function addWatchToExistingCommunity(programId){
176+
var community = _.find(vm.communities, {programId: programId})
177+
if (community) {
178+
community.status = true
179+
if (community.unregister){
180+
community.unregister()
181+
_addWatchToCommunity(community)
182+
}
183+
}
184+
}
185+
157186
/**
158187
* Toggles the given skill for the user. If it is not added, adds it and if already added, removes it.
159188
*/
@@ -202,7 +231,11 @@ import _ from 'lodash'
202231
var community = vm.communities[communityName]
203232
if (community.dirty === true) {
204233
if (community.status === true) {
205-
promises.push(MemberCertService.registerMember(vm.userId, community.programId))
234+
if(community.groupCommunity){
235+
promises.push(GroupService.addMember(vm.userId, community.programId))
236+
}else{
237+
promises.push(MemberCertService.registerMember(vm.userId, community.programId))
238+
}
206239
}
207240
}
208241
}
@@ -217,9 +250,7 @@ import _ from 'lodash'
217250
})
218251
.catch(function(err) {
219252
logger.error('Could not update update user skills or register members for community', err)
220-
221253
vm.saving = false
222-
223254
toaster.pop('error', 'Whoops!', 'Something went wrong. Please try again later.')
224255
})
225256
}

app/skill-picker/skill-picker.jade

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
.community__icon(ng-class="{'community__icon--disabled': !community.status}")
1313
img(ng-if="communityKey == 'ibm_cognitive' && community.status", src=require("../../assets/images/ico-ibm_cognitive-community.svg"))
1414
img(ng-if="communityKey == 'ibm_cognitive' && !community.status", src=require("../../assets/images/ico-ibm_cognitive-community-grey.svg"))
15+
img(ng-if="communityKey == 'blockchain' && community.status", src=require("../../assets/images/ico-predix-community.svg"))
16+
img(ng-if="communityKey == 'blockchain' && !community.status", src=require("../../assets/images/ico-predix-community-grey.svg"))
1517
img(ng-if="communityKey == 'ios' && community.status", src=require("../../assets/images/ico-ios-community.svg"))
1618
img(ng-if="communityKey == 'ios' && !community.status", src=require("../../assets/images/ico-ios-community-grey.svg"))
1719
img(ng-if="communityKey == 'predix' && community.status", src=require("../../assets/images/ico-predix-community.svg"))
@@ -21,6 +23,7 @@
2123
span.community__title(class="{{!community.status && 'disabled'}}") {{community.displayName}}
2224
.community__description
2325
span(ng-if="communityKey == 'ibm_cognitive'") Cognitive Community
26+
span(ng-if="communityKey == 'blockchain'") Help create the future of Blockchain-based applications
2427
span(ng-if="communityKey == 'ios'") Mobile app design and development for iOS, with Swift emphasis
2528
span(ng-if="communityKey == 'predix'") Design and development on GE’s platform for the Industrial Internet of Things
2629

@@ -74,4 +77,4 @@
7477
type="button",
7578
tc-busy-button, tc-busy-when="vm.saving",
7679
ng-click="vm.submitSkills()",
77-
ng-disabled="vm.disableDoneButton || !vm.isPageDirty()") Done
80+
ng-disabled="vm.disableDoneButton || vm.isPageStateDirty") Done

app/topcoder.constants.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ angular.module('CONSTANTS', []).constant('CONSTANTS', {
2929
'NEW_CHALLENGES_URL' : 'https://www.topcoder.com/challenges/develop/upcoming/',
3030
'SWIFT_PROGRAM_ID' : 3445,
3131
'PREDIX_PROGRAM_ID' : process.env.PREDIX_PROGRAM_ID || 3448,
32-
'IBM_COGNITIVE_PROGRAM_ID' : process.env.IBM_COGNITIVE_PROGRAM_ID || 3449,
32+
'IBM_COGNITIVE_PROGRAM_ID' : process.env.IBM_COGNITIVE_PROGRAM_ID || 3449,
33+
'BLOCKCHAIN_PROGRAM_ID' : process.env.BLOCKCHAIN_PROGRAM_ID || 20000010,
3334
'UPCOMING_SRMS_URL' : 'https://www.topcoder.com/challenges/data/upcoming/',
3435
'EVENT_USER_LOGGED_IN' : 'user_logged_in',
3536
'EVENT_USER_LOGGED_OUT' : 'user_logged_out',

assets/css/directives/notification.directive.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,18 @@
7777
.header{
7878
font-weight: bold;
7979
font-size: 40px;
80-
margin-top: 440px;
80+
margin-top: 35px;
8181
padding-left: 60px;
8282
margin-bottom: 20px;
83+
color: #FFF;
8384
}
8485
.details{
8586
font-size: 16px;
8687
line-height: 26px;
8788
font-weight: 100;
8889
padding-left: 60px;
89-
max-width: 640px;
90+
max-width: 40%;
91+
color: #FFF;
9092
}
9193
.action{
9294
position: absolute;

assets/css/my-dashboard/notifications.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
margin-right: 0;
4141
}
4242
&.tco17{
43-
background: url(../../images/home-hero.jpg) center/cover;
43+
background: url(../../images/happy-holidays.png) center/cover;
4444
img{
4545
width: 150px;
4646
margin: 120px auto 0;

assets/images/happy-holidays.png

62.2 KB
Loading

assets/images/news/stage1-winners.png

250 KB
Loading

assets/images/news/tco-winners.jpg

-172 KB
Binary file not shown.

0 commit comments

Comments
 (0)