Created
October 30, 2013 13:05
-
-
Save fabioyamate/7232341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Hello world</title> | |
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css"> | |
</head> | |
<body> | |
<div class="pure-g-r" id="layout"> | |
<div class="pure-u-1"> | |
<div class="content"> | |
<div class="posts"> | |
<h1 class="content-subhead">Recent Posts</h1> | |
<section class="post"> | |
<header class="post-header"> | |
<img class="post-avatar" | |
alt="avatar" src="/img/common/avatar.png" | |
height="48" width="48"> | |
<h2 class="post-title">Post Title</h2> | |
<p class="post-meta"> | |
By <a class="post-author" href="#">Author</a> under <a class="post-category" href="#">Category</a> | |
</p> | |
</header> | |
<div class="post-description"> | |
<p> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. | |
</p> | |
</div> | |
</section> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; this is not executable, check http://github.com/swannodette/enlive-tutorial/ tutorial for some helper functions | |
(defn get-posts [] | |
(jdbc/query db-spec (sql/select * :posts (sql/order-by {:id :desc})))) | |
(html/defsnippet post "blog.html" [:.post] | |
[{avatar :avatar title :title author :author category :tag}] | |
[:.post-avatar] (html/set-attr :src (gravatar "fabioyamate@gmail.com")) | |
[:.post-title] (html/content title) | |
[:.post-author] (maybe-content author) | |
[:.post-category] (maybe-content category)) | |
(html/deftemplate blog "blog.html" | |
[ctxt] | |
[:title] (html/content "dsds") | |
[:.posts] (html/content (map post (get-posts)))) | |
(render-to-response (blog {})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment