Mercurial Hosting > luan
annotate examples/blog/src/new.luan @ 802:3428c60d7cfc
replace jetty jars with source
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 07 Sep 2016 21:15:48 -0600 |
parents | c38f6619feb9 |
children | 21d157b153fe |
rev | line source |
---|---|
693
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
596
diff
changeset
|
1 local Luan = require "luan:Luan.luan" |
596 | 2 local error = Luan.error |
693
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
596
diff
changeset
|
3 local Io = require "luan:Io.luan" |
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
596
diff
changeset
|
4 local Http = require "luan:http/Http.luan" |
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
596
diff
changeset
|
5 local Post = require "site:/lib/Post.luan" |
596 | 6 |
7 | |
8 return function() | |
9 local subject = Http.request.parameter.subject | |
10 local content = Http.request.parameter.content | |
11 if Http.request.parameter.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 <html> | |
21 <head> | |
22 <style> | |
23 @import "/site.css"; | |
24 </style> | |
25 </head> | |
26 <body> | |
27 <h1>Make New Post</h1> | |
28 | |
29 <form method=post> | |
30 <p>Subject: <input name=subject size=50 type=text></p> | |
777
1460d297e960
add bbcode to blog example
Franklin Schmidt <fschmidt@gmail.com>
parents:
693
diff
changeset
|
31 <p><textarea name=content rows=20 cols=90></textarea><br>bbcode works</p> |
596 | 32 <p> |
33 <input type=submit name=save value=Submit> | |
34 </p> | |
35 </form> | |
36 | |
37 </body> | |
38 </html> | |
39 <% | |
40 end |