diff options
author | Tom Willemse | 2013-05-19 16:35:14 +0200 |
---|---|---|
committer | Tom Willemse | 2013-05-19 16:35:14 +0200 |
commit | 6cd2241d51e4b38acd8d7801736cde8245bae47e (patch) | |
tree | b5d6afc3c1fbb1e44c5a732cb23f8ded4afb09ef /scrumelo.el | |
download | scrumelo-6cd2241d51e4b38acd8d7801736cde8245bae47e.tar.gz scrumelo-6cd2241d51e4b38acd8d7801736cde8245bae47e.zip |
Initial commit
Diffstat (limited to 'scrumelo.el')
-rw-r--r-- | scrumelo.el | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/scrumelo.el b/scrumelo.el new file mode 100644 index 0000000..711075a --- /dev/null +++ b/scrumelo.el @@ -0,0 +1,56 @@ +;;; scrumelo.el --- Scrum with elnode and org-mode + +;; Copyright (C) 2013 Tom Willemse + +;; Author: Tom Willemse <tom@ryuslash.org> +;; Keywords: tools, hypermedia, outlines, comm + +;;; Commentary: + +;; A scrum web app. + +(require 'elnode) +(require 'esxml) +(require 'org) + +;;; Code: + +(defvar scrum-project-file "~/projects/scrumelo/aeos.org" + "The file containing the scrumm backlog.") + +(defun scrumelo-backlog-page (httpcon) + "Send the backlog overview over HTTPCON." + (let ((buffer (find-file-noselect scrum-project-file))) + (elnode-http-start httpcon 200 '("Content-Type" . "text/html")) + (elnode-http-return + httpcon + (concat + "<!DOCTYPE html>\n" + (sxml-to-xml + `(html (head (title "Scrumelo") + (link (@ (href "http://ryuslash.org/bootstrap2/css/bootstrap.min.css") + (type "text/css") (rel "stylesheet")))) + (body + (div (@ (class "container")) + (table (@ (class "table")) + ,@(with-current-buffer buffer + (delq nil + (org-map-entries + (lambda () + (when (= (car (org-heading-components)) 1) + `(tr (td ,(org-entry-get (point) "TODO")) + (td ,(format "As a %s, I %s to %s" + (org-entry-get (point) "Role") + (org-entry-get (point) "Necessity") + (nth 4 (org-heading-components))))))) nil nil 'comment)))))))))))) + +(defun scrumelo-handler (httpcon) + "Send the right requests in HTTPCON to the right functions." + (elnode-dispatcher + httpcon + '(("^/$" . scrumelo-backlog-page)))) + +(elnode-start 'scrumelo-handler :port 8028 :host "localhost") + +(provide 'scrumelo) +;;; scrumelo.el ends here |