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

Commit a161cf1

Browse files
committed
show skills on edit profile
1 parent 58fcb54 commit a161cf1

File tree

4 files changed

+91
-9
lines changed

4 files changed

+91
-9
lines changed

app/services/profile.service.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
getUserProfile: getUserProfile,
1515
updateUserProfile: updateUserProfile,
1616
getUserSkills: getUserSkills,
17+
addUserSkill: addUserSkill,
1718
getUserFinancials: getUserFinancials,
1819
getUserStats: getUserStats,
1920
getDistributionStats: getDistributionStats,
@@ -41,6 +42,12 @@
4142
function getUserSkills(username) {
4243
return restangular.one('members', username).one('skills').get();
4344
}
45+
46+
function addUserSkill(username, skillTagId) {
47+
var body = {};
48+
body[skillTagId] = { 'hidden': false };
49+
return restangular.one('members', username).one('skills').patch(JSON.stringify(body));
50+
}
4451

4552
function getUserFinancials(username) {
4653
return restangular.one('members', username).one('financial').get();

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33

44
angular.module('tc.settings').controller('EditProfileController', EditProfileController);
55

6-
EditProfileController.$inject = ['userData', 'userHandle', 'ProfileService', '$log', 'ISO3166', 'ImageService', '$rootScope', 'CONSTANTS'];
6+
EditProfileController.$inject = ['userData', 'userHandle', 'ProfileService', '$log', 'ISO3166', 'ImageService', '$rootScope', 'CONSTANTS', 'TagsService'];
77

8-
function EditProfileController(userData, userHandle, ProfileService, $log, ISO3166, ImageService, $rootScope, CONSTANTS) {
8+
function EditProfileController(userData, userHandle, ProfileService, $log, ISO3166, ImageService, $rootScope, CONSTANTS, TagsService) {
99
var vm = this;
1010
vm.toggleTrack = toggleTrack;
1111
vm.updateCountry = updateCountry;
1212
vm.onFileChange = onFileChange;
1313
vm.updateProfile = updateProfile;
14+
vm.skills = false;
15+
vm.addSkill = addSkill;
16+
vm.tags = [];
1417

1518
activate();
1619

@@ -19,7 +22,28 @@
1922
vm.countryObj = ISO3166.getCountryObjFromAlpha3(userData.competitionCountryCode);
2023

2124
processData(userData);
22-
vm.userData = userData
25+
vm.userData = userData;
26+
27+
TagsService.getApprovedSkillTags()
28+
.then(function(tags) {
29+
vm.tags = tags;
30+
})
31+
.catch(function(err) {
32+
$log.error(err);
33+
});
34+
35+
ProfileService.getUserSkills(vm.userData.handle)
36+
.then(function(skills) {
37+
vm.skills = skills.skills;
38+
})
39+
.catch(function(err) {
40+
$log.error(err);
41+
});
42+
}
43+
44+
function addSkill(skill) {
45+
var skillTagId = _.get(skill, 'originalObject.id');
46+
ProfileService.addUserSkill(vm.userData.handle, skillTagId);
2347
}
2448

2549
function updateCountry(angucompleteCountryObj) {

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,29 @@
8585
p Find challenges about data and algorithms. You know data sets, algorithms, DB structures, statistics, data analysis.
8686

8787
button(type="submit", ng-disabled="vm.editProfile.$invalid", ng-class="{'enabled-button': vm.editProfile.$valid}") Save
88-
89-
.field-section
90-
h4.field-title Add Your Skills
91-
92-
.field-section
93-
h4.field-title Links to Work
88+
89+
.field-section.edit-skills
90+
h4.field-title My Skills
91+
h5 This skills are shown on the
92+
93+
angucomplete-alt(
94+
id="tagId",
95+
input-name="skill-input",
96+
placeholder='Type skill name here and press "Enter" to add it',
97+
pause="100",
98+
selected-object="vm.addSkill",
99+
local-data="vm.tags",
100+
search-fields="name",
101+
title-field="name",
102+
match-class="angucomplete-highlight",
103+
minlength="1"
104+
)
105+
106+
.skills
107+
.skill(ng-repeat="skill in vm.skills")
108+
skill-tile(skill="skill")
109+
110+
.clearfix
111+
112+
.field-section
113+
h4.field-title Links to Work

assets/css/settings/edit-profile.scss

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,37 @@
108108

109109
}
110110
}
111+
112+
.edit-skills {
113+
input {
114+
width: 790px;
115+
margin: 16px 0 16px 0;
116+
}
117+
}
118+
119+
.skills {
120+
.skill {
121+
margin: 10px 10px 0 0;
122+
padding: 26px 0px 10px 4px;
123+
cursor: pointer;
124+
width: 150px;
125+
text-align: center;
126+
float: left;
127+
background-color: #d1d3d4;
128+
i {
129+
font-size: 50px;
130+
}
131+
.name {
132+
text-align: center;
133+
margin: 14px auto;
134+
}
135+
}
136+
}
137+
138+
.clearfix {
139+
@include clearfix;
140+
margin-bottom: 40px;
141+
}
111142

112143
button {
113144
width: 200px;

0 commit comments

Comments
 (0)