Mercurial Hosting > luan
comparison examples/blog/src/new.html.luan @ 1217:4c2972f4d862
.html in examples
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 20 Mar 2018 15:43:16 -0600 |
parents | examples/blog/src/new.luan@5dbb552075ff |
children | ad5647031343 |
comparison
equal
deleted
inserted
replaced
1216:5dbb552075ff | 1217:4c2972f4d862 |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local Io = require "luan:Io.luan" | |
4 local Http = require "luan:http/Http.luan" | |
5 local Post = require "site:/lib/Post.luan" | |
6 | |
7 | |
8 return function() | |
9 local subject = Http.request.parameters.subject | |
10 local content = Http.request.parameters.content | |
11 if Http.request.parameters.save ~= nil then | |
12 local post = Post.new{ subject=subject, content=content } | |
13 post.save() | |
14 Http.response.send_redirect("/") | |
15 return | |
16 end | |
17 | |
18 Io.stdout = Http.response.text_writer() | |
19 %> | |
20 <!doctype html> | |
21 <html> | |
22 <head> | |
23 <style> | |
24 @import "/site.css"; | |
25 </style> | |
26 </head> | |
27 <body> | |
28 <h1>Make New Post</h1> | |
29 | |
30 <form method=post> | |
31 <p>Subject: <input name=subject size=50 type=text></p> | |
32 <p><textarea name=content rows=20 cols=90></textarea><br>bbcode works</p> | |
33 <p> | |
34 <input type=submit name=save value=Submit> | |
35 </p> | |
36 </form> | |
37 | |
38 </body> | |
39 </html> | |
40 <% | |
41 end |