view blog/src/index.html.luan @ 598:e930f92d0f61

add blog test
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 16 Sep 2015 14:32:52 -0600
parents 6bb0c83116e9
children 50540f0813e2
line wrap: on
line source

local Luan = require "luan:Luan"
local error = Luan.error
local ipairs = Luan.ipairs or error()
local Time = require "luan:Time"
local Io = require "luan:Io"
local Http = require "luan:http/Http"
local Post = require "site:/lib/Post"


return function()
	Io.stdout = Http.response.text_writer()
%>
<html>
	<head>
		<style>
			@import "/site.css";
		</style>
	</head>
	<body>
		<h1>Demo Blog App</h1>

		<div><a href="new">Make New Post</a></div>

		<%
		for _, post in ipairs(Post.get_all()) do
			%>
			<a name="p<%= post.id %>">
			<h2><%= post.subject %></h2>
			<p><%= Time.format(post.date) %> - <a href="edit?post=<%= post.id %>">Edit</a></p>
			<pre><%= post.content %></pre>
			<hr>
			<%
		end
		%>

	</body>
</html>
<%
end