Skip to content

Commit 6e23d43

Browse files
committed
1 parent d332d62 commit 6e23d43

File tree

4 files changed

+966
-155
lines changed

4 files changed

+966
-155
lines changed

app/scripts/Skill.js

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ define(['lib/knockout', 'scripts/Book', 'scripts/Link', 'scripts/Utils'], functi
7777
});
7878

7979
self.addPoint = function () {
80+
console.log(this);
8081
if (self.canAddPoints()) {
8182
self.points(self.points() + 1);
8283
}

app/scripts/render.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ define(['d3', 'lib/knockout', 'scripts/Utils', 'dagre-d3', 'jquery', 'lettuce',
55
function setSkillNode() {
66
ko.utils.arrayForEach(skills_data.skills, function (skill) {
77
var value = skill;
8-
value.label = skill.name;
8+
value.label = skill.title;
99
value.height = value.width = 40;
1010
value.rx = value.ry = 10;
11-
g.setNode(skill.name, value);
11+
g.setNode(skill.title, value);
1212
});
1313
}
1414

@@ -17,8 +17,8 @@ define(['d3', 'lib/knockout', 'scripts/Utils', 'dagre-d3', 'jquery', 'lettuce',
1717
var skill_id = skill.id;
1818
if (skill.depends) {
1919
ko.utils.arrayForEach(skill.depends, function (id) {
20-
var dependents_name = Utils.getSkillById(skills_data.skills, id).name;
21-
var skill_name = Utils.getSkillById(skills_data.skills, skill_id).name;
20+
var dependents_name = Utils.getSkillById(skills_data.skills, id).title;
21+
var skill_name = Utils.getSkillById(skills_data.skills, skill_id).title;
2222
g.setEdge(dependents_name, skill_name, {label: '', lineInterpolate: 'basis'});
2323
});
2424
}
@@ -42,7 +42,7 @@ define(['d3', 'lib/knockout', 'scripts/Utils', 'dagre-d3', 'jquery', 'lettuce',
4242

4343
inner.selectAll('g.node')
4444
.attr('data-bind', function(){
45-
return 'css: { \'can-add-points\': canAddPoints, \'has-points\': hasPoints, \'has-max-points\': hasMaxPoints }';
45+
return 'css: { "can-add-points": canAddPoints, "has-points": hasPoints, "has-max-points": hasMaxPoints }';
4646
});
4747
inner.selectAll('g.node rect').attr('data-bind', function () {
4848
return 'click: addPoint, rightClick: removePoint';
@@ -51,6 +51,18 @@ define(['d3', 'lib/knockout', 'scripts/Utils', 'dagre-d3', 'jquery', 'lettuce',
5151
/* add tips */
5252
inner.selectAll('g.node')
5353
.each(function (v, id) {
54+
if( !g.node(v).books) {
55+
g.node(v).books = {
56+
label: "",
57+
url: ""
58+
}
59+
}
60+
if( !g.node(v).links) {
61+
g.node(v).links = {
62+
label: "",
63+
url: ""
64+
}
65+
}
5466
var data = {
5567
id: id,
5668
name: v,
@@ -60,7 +72,7 @@ define(['d3', 'lib/knockout', 'scripts/Utils', 'dagre-d3', 'jquery', 'lettuce',
6072
};
6173
var results = lettuce.Template.tmpl(description_template, data);
6274
$(this).tooltipster({content: $(results), contentAsHTML: true, interactive: true});
63-
$(this).find('rect').css("fill", colors[id]['font_color']);
75+
$(this).find('rect').css("fill", '#ecf0f1');
6476
});
6577

6678
svg.attr('height', g.graph().height + 120);

app/styles/layout.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ rect.selection {
6161
}
6262

6363
.edgePath path {
64-
stroke: #333;
65-
fill: #333;
64+
stroke: gray;
65+
fill: gray;
6666
stroke-width: 1.5px;
6767
}
6868

0 commit comments

Comments
 (0)