aboutsummaryrefslogtreecommitdiffstats
path: root/scrumelo.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2013-05-22 21:50:56 +0200
committerGravatar Tom Willemse2013-05-22 21:50:56 +0200
commit2a9822daac3a77551f0bef4f714294eb0d3d5798 (patch)
tree09b23346862f1e30403e0baa21163d55fbdcbad0 /scrumelo.el
parent77eebc036114247a0ea34bf0a2d8369b3c7f041c (diff)
downloadscrumelo-2a9822daac3a77551f0bef4f714294eb0d3d5798.tar.gz
scrumelo-2a9822daac3a77551f0bef4f714294eb0d3d5798.zip
Get data on a story from the server
Uses a GET request to get extra data about a story, if that story already exists it removes it so users can hide/show as much as they like.
Diffstat (limited to 'scrumelo.el')
-rw-r--r--scrumelo.el23
1 files changed, 22 insertions, 1 deletions
diff --git a/scrumelo.el b/scrumelo.el
index 1e4c070..78aa058 100644
--- a/scrumelo.el
+++ b/scrumelo.el
@@ -85,7 +85,9 @@
(let ((state (org-entry-get (point) "TODO")))
`(tr (td (i (@ (class ,(scrumelo--task-state-class state))) "")
" " ,state)
- (td ,(scrumelo--story)))))
+ (td (a (@ (id ,(org-id-get))
+ (onclick "return get_story_info(this)"))
+ ,(scrumelo--story))))))
(defun scrumelo--maybe-story-row ()
"If looking at a top level heading, return a table row for it."
@@ -156,6 +158,25 @@
(save-buffer))))
(elnode-send-redirect httpcon "/"))))
+(defun scrumelo--send-json (httpcon obj)
+ "Respond to HTTPCON with OBJ converted to a json structure."
+ (elnode-http-start httpcon 200 '("Contaent-Type" . "text/json"))
+ (elnode-http-return httpcon (json-encode obj)))
+
+(defun scrumelo-story-json (httpcon)
+ "Repsond to HTTPCON with some json info about a story."
+ (let* ((story (match-string 1 (elnode-http-mapping httpcon)))
+ (buffer (find-file-noselect scrumelo-project-file))
+ (entry (cdr (org-id-find story))))
+ (message "HI: %s" story)
+ (with-current-buffer buffer
+ (goto-char entry)
+ (scrumelo--send-json
+ httpcon (list (cons 'Assignee (org-entry-get (point) "Assignee"))
+ (cons 'content (buffer-substring-no-properties
+ (org-end-of-meta-data-and-drawers)
+ (org-entry-end-position))))))))
+
(defun scrumelo-handler (httpcon)
"Send the right requests in HTTPCON to the right functions."
(elnode-dispatcher