summaryrefslogtreecommitdiff
path: root/src/ws
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-06-14 20:03:51 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-06-14 20:03:51 +0200
commit67ab36c1bb87196379153881afcd7e17aea421e2 (patch)
treebfc80665cf2c42ab0b8012916f3866adae809721 /src/ws
parent5e425372f92687af2b24972ca1d28ae66d3c15d6 (diff)
Make state toggle when clicked.
Diffstat (limited to 'src/ws')
-rw-r--r--src/ws/munia.css5
-rw-r--r--src/ws/node.js2
-rw-r--r--src/ws/view.js29
3 files changed, 33 insertions, 3 deletions
diff --git a/src/ws/munia.css b/src/ws/munia.css
index bfd63c7..bfc1823 100644
--- a/src/ws/munia.css
+++ b/src/ws/munia.css
@@ -10,7 +10,7 @@
body
{
cursor: default;
- font-family: sans-serif;
+ font-family: helvetica, arial, sans-serif;
font-size: 0.8em;
}
@@ -72,7 +72,8 @@ body
padding-left: 5px;
padding-right: 5px;
background: transparent;
- pointer-events: none;
+ pointer-events: auto;
+ cursor: pointer;
}
.node .description
diff --git a/src/ws/node.js b/src/ws/node.js
index 6e60b37..062f892 100644
--- a/src/ws/node.js
+++ b/src/ws/node.js
@@ -201,7 +201,7 @@ Node.prototype.create = function()
this.state_element.setAttribute("onclick", "changeState(event)");
this.state_element.setAttribute("nodeid", this.id);
this.state_element.setAttribute("class", "state");
- var txt_state = document.createTextNode("");
+ var txt_state = document.createTextNode("todo");
this.state_element.appendChild(txt_state);
this.data_element.appendChild(this.state_element);
diff --git a/src/ws/view.js b/src/ws/view.js
index 6c43dc8..aa4d9de 100644
--- a/src/ws/view.js
+++ b/src/ws/view.js
@@ -344,3 +344,32 @@ function collapse(e)
node.element.classList.remove('collapsed');
}
}
+
+function changeState(e)
+{
+ const idstr = e.target.parentElement.parentElement.id;
+ const node = findNodeFromString(idstr);
+ if(node == null)
+ {
+ return; // no node
+ }
+
+ const id = idFromStr(e.target.parentElement.parentElement.id);
+
+ switch(node.attributes["state"])
+ {
+ case "in-progress":
+ update(id, "state", "blocked");
+ break;
+ case "blocked":
+ update(id, "state", "done");
+ break;
+ case "done":
+ update(id, "state", "todo");
+ break;
+ default:
+ case "todo":
+ update(id, "state", "in-progress");
+ break;
+ }
+}