Hide new story form

Use jQuery to allow it to be toggled between visible and invisible.
This commit is contained in:
Tom Willemse 2013-05-21 21:19:29 +02:00
parent bf8518848d
commit a5eb8e2da5
2 changed files with 17 additions and 4 deletions

8
js/scrumelo.js Normal file
View file

@ -0,0 +1,8 @@
(function ($) {
$(document).ready(function () {
$(".hide").hide();
$(".toggle").click(function () {
$(document.getElementById($(this).data("show"))).toggle();
});
});
})(jQuery);

View file

@ -59,7 +59,8 @@
(defun scrumelo--js-list () (defun scrumelo--js-list ()
"Return a list of all required JS files." "Return a list of all required JS files."
(list (scrumelo--js scrumelo-bootstrap-js-location) (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 () (defun scrumelo--story ()
"Return a description of the current org heading as a scrum story." "Return a description of the current org heading as a scrum story."
@ -101,8 +102,11 @@
`(form (@ (method "POST") `(form (@ (method "POST")
(action "/stories/new/")) (action "/stories/new/"))
(fieldset (fieldset
(legend "New story") (legend (@ (class "toggle")
(div (@ (style "text-align: center;")) (data-show "new-story")) "New story")
(div (@ (id "new-story")
(class "hide")
(style "text-align: center;"))
(div (@ (class "input-prepend input-append")) (div (@ (class "input-prepend input-append"))
(span (@ (class "add-on")) "As a ") (span (@ (class "add-on")) "As a ")
(input (@ (class "input-medium") (type "text") (input (@ (class "input-medium") (type "text")
@ -150,7 +154,8 @@
"Send the right requests in HTTPCON to the right functions." "Send the right requests in HTTPCON to the right functions."
(elnode-dispatcher (elnode-dispatcher
httpcon httpcon
'(("^/$" . scrumelo-backlog-page) `(("^/$" . scrumelo-backlog-page)
("^/js/scrumelo.js" . ,(elnode-make-send-file "js/scrumelo.js"))
("^/stories/new/$" . scrumelo-new-story)))) ("^/stories/new/$" . scrumelo-new-story))))
(elnode-start 'scrumelo-handler :port 8028 :host "localhost") (elnode-start 'scrumelo-handler :port 8028 :host "localhost")