Use closure-templates
This commit is contained in:
parent
89eab56796
commit
7d9cf5b897
3 changed files with 115 additions and 51 deletions
|
@ -7,8 +7,11 @@
|
||||||
:description "Scrum with Lisp"
|
:description "Scrum with Lisp"
|
||||||
:author "Tom Willemse"
|
:author "Tom Willemse"
|
||||||
:license "AGPLv3"
|
:license "AGPLv3"
|
||||||
:depends-on (:restas :sexml :postmodern :cl-json :drakma)
|
:depends-on (:restas :sexml :postmodern :cl-json :drakma
|
||||||
:components ((:file "defmodule")
|
:closure-template)
|
||||||
|
:defsystem-depends-on (:closure-template)
|
||||||
|
:components ((:closure-template "templates/scrumli")
|
||||||
|
(:file "defmodule")
|
||||||
(:file "pg-datastore")
|
(:file "pg-datastore")
|
||||||
(:file "util")
|
(:file "util")
|
||||||
(:file "scrumli")))
|
(:file "scrumli")))
|
||||||
|
|
58
scrumli.lisp
58
scrumli.lisp
|
@ -31,7 +31,7 @@
|
||||||
(hunchentoot:session-value :username))
|
(hunchentoot:session-value :username))
|
||||||
|
|
||||||
(defun page-title (title)
|
(defun page-title (title)
|
||||||
(<:title (concatenate 'string title " | scrumli")))
|
(concatenate 'string title " | scrumli"))
|
||||||
|
|
||||||
(defun css (&rest sheets)
|
(defun css (&rest sheets)
|
||||||
(apply 'concatenate 'string
|
(apply 'concatenate 'string
|
||||||
|
@ -54,28 +54,18 @@
|
||||||
|
|
||||||
(define-route main ("")
|
(define-route main ("")
|
||||||
(if (logged-in-p)
|
(if (logged-in-p)
|
||||||
(<:html
|
(scrumli-templates:main
|
||||||
(<:head (page-title "Backlog")
|
`(:title ,(page-title "Backlog")
|
||||||
(css *scrumli-bootstrap-css-location*
|
:csss ,(list *scrumli-bootstrap-css-location*
|
||||||
*scrumli-font-awesome-css-location*
|
*scrumli-font-awesome-css-location*
|
||||||
(genurl 'scrumli-css))
|
(genurl 'scrumli-css))
|
||||||
(js *scrumli-bootstrap-js-location*
|
:jss ,(list *scrumli-bootstrap-js-location*
|
||||||
*scrumli-jquery-js-location*
|
*scrumli-jquery-js-location*
|
||||||
*scrumli-react-js-location*
|
*scrumli-react-js-location*
|
||||||
*scrumli-jsxtransformer-js-location*))
|
*scrumli-jsxtransformer-js-location*)
|
||||||
(<:body
|
:username ,(hunchentoot:session-value :username)
|
||||||
(navbar (<:div :class "pull-right"
|
:ulogout ,(genurl 'logout-page)
|
||||||
(<:span :class "navbar-text"
|
:umainjs ,(genurl 'main-js)))
|
||||||
(hunchentoot:session-value :username))
|
|
||||||
(<:ul :class "nav pull-right"
|
|
||||||
(<:li :class "divider-vertical")
|
|
||||||
(<:li (<:a :href (genurl 'logout-page)
|
|
||||||
"Logout"))
|
|
||||||
(<:li :class "divider-vertical"))))
|
|
||||||
(<:div :class "container"
|
|
||||||
(<:h1 "Backlog")
|
|
||||||
(<:div :id "content")
|
|
||||||
(<:script :type "text/jsx" :src (genurl 'main-js)))))
|
|
||||||
(redirect 'login-page)))
|
(redirect 'login-page)))
|
||||||
|
|
||||||
(defmacro serve-static (name relpath)
|
(defmacro serve-static (name relpath)
|
||||||
|
@ -162,32 +152,12 @@
|
||||||
|
|
||||||
(define-route login-page ("login")
|
(define-route login-page ("login")
|
||||||
(if (not (logged-in-p))
|
(if (not (logged-in-p))
|
||||||
(<:html :lang "en"
|
(scrumli-templates:login
|
||||||
(<:head (<:meta :charset "utf-8")
|
`(:title ,(page-title "Login")
|
||||||
(page-title "Login")
|
:csss ,(list *scrumli-bootstrap-css-location*)
|
||||||
(css *scrumli-bootstrap-css-location*)
|
:jss ,(list *scrumli-bootstrap-js-location*
|
||||||
(js *scrumli-bootstrap-js-location*
|
|
||||||
"https://login.persona.org/include.js"
|
"https://login.persona.org/include.js"
|
||||||
(genurl 'login-js)))
|
(genurl 'login-js))))
|
||||||
(<:body
|
|
||||||
(navbar (<:ul :class "nav pull-right"
|
|
||||||
(<:li :class "divider-vertical")
|
|
||||||
(<:li (<:a :href "javascript:login()"
|
|
||||||
"Login"))
|
|
||||||
(<:li :class "divider-vertical")))
|
|
||||||
(<:div :class "container"
|
|
||||||
(<:br)
|
|
||||||
(<:div :class "hero-unit"
|
|
||||||
(<:h1 "Scrumli")
|
|
||||||
(<:p "As a " (<:em "developer") " I "
|
|
||||||
(<:em "love") " to " (<:em "scrum")
|
|
||||||
"...")
|
|
||||||
(<:a :class "btn btn-primary btn-large"
|
|
||||||
:href "javascript:login()"
|
|
||||||
"Login")))
|
|
||||||
(<:form :id "login-form" :method "POST" :action ""
|
|
||||||
(<:input :id "assertion-field" :type "hidden"
|
|
||||||
:name "assertion" :value ""))))
|
|
||||||
(redirect 'main)))
|
(redirect 'main)))
|
||||||
|
|
||||||
(define-route logout-page ("logout")
|
(define-route logout-page ("logout")
|
||||||
|
|
91
templates/scrumli.tmpl
Normal file
91
templates/scrumli.tmpl
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
{namespace scrumli-templates}
|
||||||
|
|
||||||
|
{template main}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>{$title}</title>
|
||||||
|
{foreach $css in $csss}
|
||||||
|
<link href="{$css}" rel="stylesheet" type="text/css">
|
||||||
|
{/foreach}
|
||||||
|
{foreach $js in $jss}
|
||||||
|
<script src="{$js}" type="text/javascript" language="javascript">
|
||||||
|
</script>
|
||||||
|
{/foreach}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="navbar navbar-static-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand">scrumli</a>
|
||||||
|
<div class="pull-right">
|
||||||
|
<span class="navbar-text">
|
||||||
|
{$username}
|
||||||
|
</span>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li class="divider-vertical"></li>
|
||||||
|
<li><a href="{$ulogout}">Logout</a></li>
|
||||||
|
<li class="divider-vertical"></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<h1>Backlog</h1>
|
||||||
|
<div id="content"></div>
|
||||||
|
<script src="{$umainjs}" type="text/jsx"></script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
{/template}
|
||||||
|
|
||||||
|
{template login}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>{$title}</title>
|
||||||
|
{foreach $css in $csss}
|
||||||
|
<link href="{$css}" rel="stylesheet" type="text/css">
|
||||||
|
{/foreach}
|
||||||
|
{foreach $js in $jss}
|
||||||
|
<script src="{$js}" type="text/javascript" language="javascript">
|
||||||
|
</script>
|
||||||
|
{/foreach}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="navbar navbar-static-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand">scrumli</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li class="divider-vertical"></li>
|
||||||
|
<li><a href="javascript:login()">Login</a></li>
|
||||||
|
<li class="divider-vertical"></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<br />
|
||||||
|
<div class="hero-unit">
|
||||||
|
<h1>Scrumli</h1>
|
||||||
|
<p>
|
||||||
|
As a <em>developer</em> I <em>love</em>
|
||||||
|
to <em>scrum</em>...
|
||||||
|
</p>
|
||||||
|
<a class="btn btn-primary btn-large" href="javascript:login()">
|
||||||
|
Login
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form id="login-form" method="POST" action="">
|
||||||
|
<input id="assertion-field" type="hidden" name="assertion" />
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
{/template}
|
Loading…
Reference in a new issue