view blog/src/new.luan @ 604:b73f005f3735 0.13

table constructor now uses end_of_line as a delimiter
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 24 Nov 2015 16:29:27 -0700
parents 6bb0c83116e9
children ca169567ce07
line wrap: on
line source

local Luan = require "luan:Luan"
local error = Luan.error
local Io = require "luan:Io"
local Http = require "luan:http/Http"
local Post = require "site:/lib/Post"


return function()
	local subject = Http.request.parameter.subject
	local content = Http.request.parameter.content
	if Http.request.parameter.save ~= nil then
		local post = Post.new{ subject=subject, content=content }
		post.save()
		Http.response.send_redirect("/")
		return
	end

	Io.stdout = Http.response.text_writer()
%>
<html>
	<head>
		<style>
			@import "/site.css";
		</style>
	</head>
	<body>
		<h1>Make New Post</h1>

		<form method=post>
			<p>Subject: <input name=subject size=50 type=text></p>
			<p><textarea name=content rows=20 cols=90></textarea></p>
			<p>
				<input type=submit name=save value=Submit>
			</p>
		</form>

	</body>
</html>
<%
end