diff options
author | Tom Willemse | 2013-06-20 21:04:44 +0200 |
---|---|---|
committer | Tom Willemse | 2013-06-20 21:04:44 +0200 |
commit | e529f38b59cdf6fa7155de754ec9857f2b5e2dc6 (patch) | |
tree | 27bb5c61e6dc94c737db1f17bcae08dbd8910187 /scrumelo.el | |
parent | 53dfb99f6b4fee7c93c4c4747159a17c62e530db (diff) | |
download | scrumelo-e529f38b59cdf6fa7155de754ec9857f2b5e2dc6.tar.gz scrumelo-e529f38b59cdf6fa7155de754ec9857f2b5e2dc6.zip |
Add changing of state
By clicking on a story's state you change that story's state to the next
possible state.
Diffstat (limited to 'scrumelo.el')
-rw-r--r-- | scrumelo.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scrumelo.el b/scrumelo.el index 54c15bd..a3ba2d3 100644 --- a/scrumelo.el +++ b/scrumelo.el @@ -115,6 +115,19 @@ (save-buffer))) (elnode-send-redirect httpcon "/")))) +(defun scrumelo-change-state (httpcon) + "Parse data from HTTPCON and change the given task's state." + (elnode-method httpcon + (POST + (with-scrumelo-http-params (id) httpcon + (message "HI: %s" id) + (with-scrumelo-buffer + (let ((entry (cdr (org-id-find id)))) + (goto-char entry) + (org-todo) + (scrumelo--send-json + httpcon (list (cons :state (org-entry-get (point) "TODO")))))))))) + (defun scrumelo--send-json (httpcon obj) "Respond to HTTPCON with OBJ converted to a json structure." (elnode-http-start httpcon 200 '("Content-Type" . "text/json")) @@ -161,6 +174,7 @@ (concat scrumelo--base-dir "js/main.js"))) ("^/stories/$" . scrumelo-main-json) ("^/stories/new/$" . scrumelo-new-story) + ("^/stories/state/$" . scrumelo-change-state) ("^/stories/\\([a-z0-9:-]+\\)/$" . scrumelo-story-json)))) (elnode-start 'scrumelo-handler :port 8028 :host "0.0.0.0") |