From a5eb8e2da51934ee10f0aa17496838c3999bd5c5 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 21 May 2013 21:19:29 +0200 Subject: [PATCH] Hide new story form Use jQuery to allow it to be toggled between visible and invisible. --- js/scrumelo.js | 8 ++++++++ scrumelo.el | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 js/scrumelo.js diff --git a/js/scrumelo.js b/js/scrumelo.js new file mode 100644 index 0000000..055652a --- /dev/null +++ b/js/scrumelo.js @@ -0,0 +1,8 @@ +(function ($) { + $(document).ready(function () { + $(".hide").hide(); + $(".toggle").click(function () { + $(document.getElementById($(this).data("show"))).toggle(); + }); + }); +})(jQuery); diff --git a/scrumelo.el b/scrumelo.el index aedcb2e..52b1493 100644 --- a/scrumelo.el +++ b/scrumelo.el @@ -59,7 +59,8 @@ (defun scrumelo--js-list () "Return a list of all required JS files." (list (scrumelo--js scrumelo-bootstrap-js-location) - (scrumelo--js scrumelo-jquery-js-location))) + (scrumelo--js scrumelo-jquery-js-location) + (scrumelo--js "js/scrumelo.js"))) (defun scrumelo--story () "Return a description of the current org heading as a scrum story." @@ -101,8 +102,11 @@ `(form (@ (method "POST") (action "/stories/new/")) (fieldset - (legend "New story") - (div (@ (style "text-align: center;")) + (legend (@ (class "toggle") + (data-show "new-story")) "New story") + (div (@ (id "new-story") + (class "hide") + (style "text-align: center;")) (div (@ (class "input-prepend input-append")) (span (@ (class "add-on")) "As a ") (input (@ (class "input-medium") (type "text") @@ -150,7 +154,8 @@ "Send the right requests in HTTPCON to the right functions." (elnode-dispatcher httpcon - '(("^/$" . scrumelo-backlog-page) + `(("^/$" . scrumelo-backlog-page) + ("^/js/scrumelo.js" . ,(elnode-make-send-file "js/scrumelo.js")) ("^/stories/new/$" . scrumelo-new-story)))) (elnode-start 'scrumelo-handler :port 8028 :host "localhost")