summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-11-11 15:16:42 +0200
committerAlon Levy <alon@pobox.com>2014-11-11 15:16:42 +0200
commitd3cacedf337e851d678c182c901d3dcf17fc25fa (patch)
tree27e79d03b4c0fb581b175fd785d95fa8c56a132b
parent758d24c1bef78d1ac3dc2b8b3141436f5124428b (diff)
rz_core: split off view/helpers
-rw-r--r--scripts/rz_core.js44
-rw-r--r--scripts/view/helpers.js40
2 files changed, 44 insertions, 40 deletions
diff --git a/scripts/rz_core.js b/scripts/rz_core.js
index 7c611cbc..60a16029 100644
--- a/scripts/rz_core.js
+++ b/scripts/rz_core.js
@@ -1,7 +1,7 @@
"use strict"
-define(['jquery', 'd3', 'consts', 'signal', 'util', 'model/graph'],
-function($, d3, consts, signal, util, model_graph) {
+define(['jquery', 'd3', 'consts', 'signal', 'util', 'model/graph', 'view/helpers'],
+function($, d3, consts, signal, util, model_graph, view_helpers) {
var addednodes = [];
@@ -241,7 +241,7 @@ function update(no_relayout) {
return customSize(d.type) - 2;
})
.style("fill", function(d) {
- return customColor(d.type);
+ return view_helpers.customColor(d.type);
})
.style("stroke", function(d) {
if (d.state === "chosen") return "#EDE275";
@@ -530,7 +530,7 @@ function showInfo(d, i) {
}
- $('.info').css("border-color", customColor(d.type));
+ $('.info').css("border-color", view_helpers.customColor(d.type));
$("#editenddate").datepicker({
inline: true,
@@ -647,42 +647,6 @@ function editLink(d, i) {
graph.update(true);
}
-
-function customColor(type) {
- var color;
- switch (type) {
- case "person":
- color = '#FCB924';
- break;
- case "project":
- color = '#009DDC';
- break;
- case "skill":
- color = '#62BB47';
- break;
- case "deliverable":
- color = '#202020';
- break;
- case "objective":
- color = '#933E99';
- break;
- case "empty":
- color = "#080808";
- break;
- case "chainlink":
- color = "#fff";
- break;
- case "bubble":
- color = "rgba(0,0,0,0.2)";
- break;
- default:
- console.log('bug: unknown type ' + type);
- color = '#080808';
- break;
- }
- return color;
-}
-
function customSize(type) {
var size;
switch (type) {
diff --git a/scripts/view/helpers.js b/scripts/view/helpers.js
new file mode 100644
index 00000000..9926049f
--- /dev/null
+++ b/scripts/view/helpers.js
@@ -0,0 +1,40 @@
+define(function() {
+function customColor(type) {
+ var color;
+ switch (type) {
+ case "person":
+ color = '#FCB924';
+ break;
+ case "project":
+ color = '#009DDC';
+ break;
+ case "skill":
+ color = '#62BB47';
+ break;
+ case "deliverable":
+ color = '#202020';
+ break;
+ case "objective":
+ color = '#933E99';
+ break;
+ case "empty":
+ color = "#080808";
+ break;
+ case "chainlink":
+ color = "#fff";
+ break;
+ case "bubble":
+ color = "rgba(0,0,0,0.2)";
+ break;
+ default:
+ console.log('bug: unknown type ' + type);
+ color = '#080808';
+ break;
+ }
+ return color;
+}
+
+return {
+ customColor: customColor,
+};
+});