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

Commit e53af1c

Browse files
author
Parth Shah
committed
Merge branch 'feature/skill-picker-track-int' into dev
2 parents e134dfb + 4be1a76 commit e53af1c

Some content is hidden

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

81 files changed

+4581
-121
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// clean srefs
22
li.submenu-item(ng-if="item.sref && !item.srefParams")
33
a.menu-link(ui-sref="{{item.sref}}" ng-class="{ 'active': isActive() }" )
4-
img.menu-icon(ng-src="/images/nav/{{item.icon}}.svg")
4+
img.menu-icon(ng-src="{{item.icon}}")
55
.menu-text {{item.text}}
66

77
// external links
88
li.submenu-item(ng-if="item.href && !item.srefParams")
99
a.menu-link(ng-click="$event.stopPropagation();" ng-href="{{item.href}}" ng-class="{ 'active': isActive() }" target="_blank")
10-
img.menu-icon(ng-src="/images/nav/{{item.icon}}.svg")
10+
img.menu-icon(ng-src="{{item.icon}}")
1111
.menu-text {{item.text}}
1212

1313
// srefs with params
1414
li.submenu-item(ng-if="item.srefParams")
1515
a.menu-link(ng-href="{{wtfhref}}" ng-class="{ 'active': isActive() }" )
16-
img.menu-icon(ng-src="/images/nav/{{item.icon}}.svg")
17-
.menu-text {{item.text}}
16+
img.menu-icon(ng-src="{{item.icon}}")
17+
.menu-text {{item.text}}

app/directives/profile-widget/profile-widget.directive.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
link: function(scope, elem, attrs) {
1717
scope.DOMAIN = CONSTANTS.domain;
18+
scope.ASSET_PREFIX = CONSTANTS.ASSET_PREFIX;
1819

1920
scope.$watch('editProfileLink', function(newValue, oldValue, scope) {
2021
if (newValue) {

app/directives/profile-widget/profile-widget.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.profile-widget-directive
22
a(ui-sref="profile.about({userHandle: profile.handle})")
3-
img.profile-circle(fallback-src="/images/avatarPlaceholder.png", ng-src="{{profile.photoURL}}")
3+
img.profile-circle(fallback-src="{{ASSET_PREFIX}}/images/avatarPlaceholder.png", ng-src="{{profile.photoURL}}")
44

55
.info
66
h1.handle {{profile.handle}}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
a(ng-click="enableHide && toggle()")
22

3-
.skill-icon
4-
i.colored(ng-show="icon", ng-class="icon")
5-
img.default(ng-hide="icon", src="/images/ico-code-c.svg")
6-
.name {{skill.tagName}} [{{skill.score}}]
3+
.skill-icon(ng-switch="skill.category")
4+
img(ng-switch-when="DEVELOP", ng-src="{{ASSET_PREFIX}}/images/skills/id-{{skill.tagId}}.svg", fallback-src="{{ASSET_PREFIX}}/images/skills/id-develop.svg")
5+
img(ng-switch-when="DESIGN", ng-src="{{ASSET_PREFIX}}/images/skills/id-{{skill.tagId}}.svg", fallback-src="{{ASSET_PREFIX}}/images/skills/id-design.svg")
6+
img(ng-switch-when="DATA_SCIENCE", ng-src="{{ASSET_PREFIX}}/images/skills/id-{{skill.tagId}}.svg", fallback-src="{{ASSET_PREFIX}}/images/skills/id-data.svg")
7+
.name {{skill.tagName}}
78
span.hidden(ng-if="skill.hidden") (Hidden)
89

app/directives/skill-tile/skill-tile.directive.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,16 @@
11
(function() {
22
'use strict';
33
angular.module('tcUIComponents').directive('skillTile', function() {
4-
5-
var _iconMap = {
6-
"c++": "devicon-cplusplus-plain",
7-
"c": "devicon-c-plain",
8-
"c#": "devicon-csharp-plain",
9-
"php": "devicon-php-plain",
10-
"ruby": "devicon-ruby-plain",
11-
"rails": "devicon-rails-plain",
12-
".net": "devicon-dot-net-plain",
13-
"python": "devicon-python-plain",
14-
"django": "devicon-django-plain",
15-
"java": "devicon-java-plain",
16-
"j2ee": "devicon-java-plain",
17-
"javascript": "devicon-javascript-plain",
18-
"node": "devicon-nodejs-plain",
19-
"angular": "devicon-angularjs-plain",
20-
"backbone": "devicon-backbonejs-plain",
21-
"coffeescript": "devicon-coffeescript-original",
22-
"css3": "devicon-css3-plain",
23-
"css": "devicon-css3-plain",
24-
"bootstrap": "devicon-bootstrap-plain",
25-
"less": "devicon-less-plain",
26-
"mongodb": "devicon-mongodb-plain",
27-
"postgresql": "devicon-postgresql-plain",
28-
"mysql": "devicon-mysql-plain",
29-
"oracle": "devicon-oracle-original",
30-
"android": "devicon-android-plain",
31-
"ios": "devicon-apple-original",
32-
"swift": "devicon-apple-original",
33-
"html5": "devicon-html5-plain",
34-
"amazon": "devicon-amazonwebservices-original"
35-
};
36-
374
return {
385
restrict: 'E',
396
templateUrl: 'directives/skill-tile/skill-tile.directive.html',
407
scope: {
418
skill: '=',
429
enableHide: "="
4310
},
44-
controller: ['$scope', 'ProfileService', 'UserService', function($scope, ProfileService, UserService) {
45-
46-
for (var key in _iconMap) {
47-
if ($scope.skill.tagName.trim().toLowerCase().indexOf(key) > -1) {
48-
$scope.icon = _iconMap[key];
49-
break;
50-
}
51-
}
11+
controller: ['$scope', 'ProfileService', 'UserService', 'CONSTANTS', function($scope, ProfileService, UserService, CONSTANTS) {
12+
$scope.skill.category = _.get($scope.skill, 'categories[0]', 'DEVELOP');
13+
$scope.ASSET_PREFIX = CONSTANTS.ASSET_PREFIX;
5214

5315
$scope.toggle = function() {
5416
var skillTagId = $scope.skill.tagId;

app/index.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ html
77
meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no")
88

99
// favicon
10-
link(rel="shortcut icon", type="image/png", href="images/favicon.ico")
10+
link(rel="shortcut icon", type="image/png", href="/images/favicon.ico")
1111

1212
// build:css /styles/vendor.css
1313
//- bower:css

app/layout/header/account-header.jade

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
header.topcoder-header
22
.container
3+
a(id="topcoder-logo", ng-href="/", title="topcoder")
4+
img(ng-src="{{vm.constants.ASSET_PREFIX}}/images/logo.png", alt="Topcoder Logo")

app/layout/header/header.controller.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818
vm.menuLinks =
1919
{
2020
'compete': [
21-
{ 'href': "/challenges/design/active/", 'text': 'DESIGN CHALLENGES', 'icon': 'design' },
22-
{ 'href': "/challenges/develop/active", 'text': 'DEVELOPMENT CHALLENGES', 'icon': 'development' },
23-
{ 'href': "/challenges/data/active", 'text': 'DATA SCIENCE CHALLENGES', 'icon': 'data-science' },
24-
{ 'href': vm.constants.ARENA_URL, 'text': 'THE ARENA', 'icon': 'srms' },
21+
{ 'href': "/challenges/design/active/", 'text': 'DESIGN CHALLENGES', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/design.svg' },
22+
{ 'href': "/challenges/develop/active", 'text': 'DEVELOPMENT CHALLENGES', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/development.svg' },
23+
{ 'href': "/challenges/data/active", 'text': 'DATA SCIENCE CHALLENGES', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/data-science.svg' },
24+
{ 'href': vm.constants.ARENA_URL, 'text': 'THE ARENA', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/srms.svg' },
2525
],
2626
'learn': [
27-
{ 'href': '/community/design/', 'text': 'DESIGN', 'icon': 'scroll-design' },
28-
{ 'href': '/community/development/', 'text': 'DEVELOPMENT', 'icon': 'scroll-develop' },
29-
{ 'href': '/community/data-science/', 'text': 'DATA SCIENCE', 'icon': 'scroll-data' },
30-
{ 'href': '/community/data-science/', 'text': 'COMPETITIVE PROGRAMMING', 'icon': 'srms' },
27+
{ 'href': '/community/design/', 'text': 'DESIGN', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/scroll-design.svg' },
28+
{ 'href': '/community/development/', 'text': 'DEVELOPMENT', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/scroll-develop.svg' },
29+
{ 'href': '/community/data-science/', 'text': 'DATA SCIENCE', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/scroll-data.svg' },
30+
{ 'href': '/community/data-science/', 'text': 'COMPETITIVE PROGRAMMING', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/srms.svg' },
3131
],
3232
'community': [
33-
{ 'href': '/community/members/', 'text': 'MEMBERS', 'icon': 'users' },
34-
{ 'href': '/community/member-programs/', 'text': 'PROGRAMS', 'icon': 'medal' },
35-
{ 'href': vm.constants.FORUMS_APP_URL, 'text': 'FORUMS', 'icon': 'forum' },
36-
{ 'href': '/community/statistics/', 'text': 'STATISTICS', 'icon': 'statistics' },
37-
{ 'href': '/community/events/', 'text': 'EVENTS', 'icon': 'calendar' },
38-
{ 'href': '/blog/', 'text': 'BLOG', 'icon': 'blog' }
33+
{ 'href': '/community/members/', 'text': 'MEMBERS', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/users.svg' },
34+
{ 'href': '/community/member-programs/', 'text': 'PROGRAMS', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/medal.svg' },
35+
{ 'href': vm.constants.FORUMS_APP_URL, 'text': 'FORUMS', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/forum.svg' },
36+
{ 'href': '/community/statistics/', 'text': 'STATISTICS', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/statistics.svg' },
37+
{ 'href': '/community/events/', 'text': 'EVENTS', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/calendar.svg' },
38+
{ 'href': '/blog/', 'text': 'BLOG', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/blog.svg' }
3939
]
4040
};
4141

@@ -66,10 +66,10 @@
6666
if (vm.isAuth) {
6767
vm.userHandle = UserService.getUserIdentity().handle;
6868
vm.userMenu = [
69-
{ 'sref': 'dashboard', 'text': 'DASHBOARD', 'icon': 'dashboard' },
70-
{ 'sref': 'profile.about', 'srefParams': { 'userHandle': vm.userHandle }, 'text': 'MY PROFILE', 'icon': 'badge' },
71-
{ 'href': vm.constants.COMMUNITY_URL + '/PactsMemberServlet?module=PaymentHistory&full_list=false', 'text': 'PAYMENTS', 'icon': 'money-bag' },
72-
{ 'sref': 'settings.profile', 'text': 'SETTINGS', 'icon': 'gear' },
69+
{ 'sref': 'dashboard', 'text': 'DASHBOARD', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/dashboard.svg' },
70+
{ 'sref': 'profile.about', 'srefParams': { 'userHandle': vm.userHandle }, 'text': 'MY PROFILE', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/badge.svg' },
71+
{ 'href': vm.constants.COMMUNITY_URL + '/PactsMemberServlet?module=PaymentHistory&full_list=false', 'text': 'PAYMENTS', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/money-bag.svg' },
72+
{ 'sref': 'settings.profile', 'text': 'SETTINGS', 'icon': vm.constants.ASSET_PREFIX + '/images/nav/gear.svg' },
7373
];
7474

7575
ProfileService.getUserProfile(vm.userHandle)

app/layout/header/header.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
header-menu-item(ng-repeat="item in vm.userMenu" item="item")
4040
li.submenu-item
4141
a.menu-link(ng-click="vm.logout(); main.menuVisible = vm.isAuth = false")
42-
img.menu-icon(src="/images/nav/logout.svg")
42+
img.menu-icon(ng-src="/images/nav/logout.svg")
4343
.menu-text LOG OUT
4444
// links for anonymous user
4545
.menu-item-header(ng-switch-when="false")

app/profile/subtrack/subtrack.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
function ProfileSubtrackController($scope, ProfileService, $q, $stateParams, ChallengeService, SRMService, CONSTANTS, $state, $window, ngDialog) {
1010
var vm = this;
11+
vm.ASSET_PREFIX = CONSTANTS.ASSET_PREFIX;
1112
vm.graphState = { show: 'history' };
1213
vm.subTrack = decodeURIComponent($stateParams.subTrack || '') || '';
1314
vm.track = $stateParams.track;

app/profile/subtrack/subtrack.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
.nav
44
a(ui-sref="profile.about({userHandle: profileVm.profile.handle})")
5-
img.arrow(src="/images/ico-arrow-big-left.svg")
5+
img.arrow(ng-src="{{vm.ASSET_PREFIX}}/images/ico-arrow-big-left.svg")
66

77
.breadcrumbs
88
.handle
9-
img.profile-circle(fallback-img="/images/avatarPlaceholder.png", ng-src="{{profileVm.profile.photoURL}}")
9+
img.profile-circle(fallback-src="{{vm.ASSET_PREFIX}}/images/avatarPlaceholder.png", ng-src="{{profileVm.profile.photoURL}}")
1010
a(ui-sref="profile.about({userHandle: profileVm.profile.handle})")
1111
| {{vm.userHandle}}
1212
| /

app/settings/edit-profile/edit-profile.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
vm.tags = [];
2020
vm.profileFormProcessing = false;
2121
vm.tracks = {};
22-
22+
vm.ASSET_PREFIX = CONSTANTS.ASSET_PREFIX;
2323
activate();
2424

2525
function activate() {

app/settings/edit-profile/edit-profile.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
.image
1313
.form-label your profile image
1414
.edit-image
15-
img.profile-circle(fallback-src="/images/avatarPlaceholder.png", ng-src="{{vm.userData.photoURL}}")
15+
img.profile-circle(fallback-src="{{vm.ASSET_PREFIX}}/images/avatarPlaceholder.png", ng-src="{{vm.userData.photoURL}}")
1616

1717
input(type="file", name="image", on-file-change)
1818

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,80 @@
1-
(function () {
1+
(function() {
22
'use strict';
33

44
angular.module('tc.skill-picker').controller('SkillPickerController', SkillPickerController);
55

6-
SkillPickerController.$inject = ['ProfileService', '$state', 'userProfile', 'featuredSkills', '$log', 'toaster'];
6+
SkillPickerController.$inject = ['CONSTANTS', 'ProfileService', '$state', 'userProfile', 'featuredSkills', '$log', 'toaster'];
77

8-
function SkillPickerController(ProfileService, $state, userProfile, featuredSkills, $log, toaster) {
8+
function SkillPickerController(CONSTANTS, ProfileService, $state, userProfile, featuredSkills, $log, toaster) {
99
var vm = this;
1010
$log = $log.getInstance("SkillPickerController");
11-
12-
vm.selectTrack = selectTrack;
11+
vm.ASSET_PREFIX = CONSTANTS.ASSET_PREFIX;
1312
vm.submitSkills = submitSkills;
1413
vm.featuredSkills = featuredSkills;
1514
vm.username = userProfile.handle;
15+
vm.toggleSkill = toggleSkill;
16+
vm.tracks = {};
1617
vm.mySkills = [];
1718
///////
1819
activate();
1920

2021
function activate() {
2122
$log.debug("init")
22-
vm.noTrackSelected = true;
23-
24-
vm.tracks = {
25-
design: true,
26-
develop: true,
27-
dataScience: true
28-
};
29-
30-
vm.toggleSkill = function(tagId) {
31-
var _idx = vm.mySkills.indexOf(tagId.toString());
32-
if (_idx > -1) {
33-
// remove
34-
vm.mySkills.splice(_idx, 1);
35-
} else {
36-
// add
37-
vm.mySkills.push(tagId.toString());
38-
}
39-
}
4023
}
4124

42-
function selectTrack(track) {
43-
vm.tracks[track] = !vm.tracks[track];
25+
function toggleSkill(tagId) {
26+
var _idx = vm.mySkills.indexOf(tagId.toString());
27+
if (_idx > -1) {
28+
// remove
29+
vm.mySkills.splice(_idx, 1);
30+
} else {
31+
// add
32+
vm.mySkills.push(tagId.toString());
33+
}
4434
}
4535

4636
function submitSkills() {
47-
if (vm.mySkills.length > 0) {
48-
// save skills
49-
var data = {};
50-
for(var i=0;i<vm.mySkills.length;i++) {
51-
data[vm.mySkills[i]] = {hidden: false};
37+
38+
vm.saving = true;
39+
// save tracks
40+
userProfile.tracks = _.reduce(vm.tracks, function(result, isInterested, trackName) {
41+
if (isInterested) {
42+
result.push(trackName);
5243
}
53-
ProfileService.updateUserSkills(vm.username, data)
54-
.then(function(resp) {
55-
toaster.pop('success', "Success!", "Your skills have been updated.");
56-
$state.go('dashboard');
44+
return result;
45+
}, []);
46+
47+
userProfile.save().then(function(data) {
48+
if (vm.mySkills.length > 0) {
49+
// save skills
50+
var data = {};
51+
for (var i = 0; i < vm.mySkills.length; i++) {
52+
data[vm.mySkills[i]] = {
53+
hidden: false
54+
};
55+
}
56+
ProfileService.updateUserSkills(vm.username, data)
57+
.then(function(resp) {
58+
vm.saving = false;
59+
toaster.pop('success', "Success!", "Your skills have been updated.");
60+
$state.go('dashboard');
61+
})
62+
.catch(function(data) {
63+
vm.saving = false;
64+
toaster.pop('error', "Whoops", "Something went wrong. Please try again later.");
65+
})
66+
} else {
67+
vm.saving = false;
68+
toaster.pop('success', "Success!", "Your skills have been updated.");
69+
$state.go('dashboard');
70+
}
71+
5772
})
58-
.catch(function(data) {
73+
.catch(function(resp) {
74+
vm.saving = false;
5975
toaster.pop('error', "Whoops", "Something went wrong. Please try again later.");
6076
})
6177

62-
}
6378
}
6479
}
6580
})();

0 commit comments

Comments
 (0)