Make a stupid page with a layout template
This commit is contained in:
parent
38e9df8251
commit
6994df13a4
@ -1,4 +1,4 @@
|
|||||||
-- LaunchBrowser()
|
LaunchBrowser()
|
||||||
|
|
||||||
local migrate = require "migrate"
|
local migrate = require "migrate"
|
||||||
|
|
||||||
@ -10,10 +10,9 @@ db:exec("PRAGMA foreign_keys")
|
|||||||
migrate.migrate(db)
|
migrate.migrate(db)
|
||||||
|
|
||||||
fm = require "fullmoon"
|
fm = require "fullmoon"
|
||||||
fm.setTemplate("hello", "Hello, {%& name %}")
|
fm.setTemplate({"/tmpl/", tmpl = "fmt"})
|
||||||
fm.setRoute("/hello/:name", function(r)
|
fm.setRoute("/hello/:name", function(r)
|
||||||
return fm.serveContent("hello", {name = r.params.name})
|
return fm.serveContent("hello", {name = r.params.name})
|
||||||
end)
|
end)
|
||||||
fm.setTemplate("itworks", "<h1>It works!</h1>")
|
fm.setRoute("/", fm.serveContent("opendb"))
|
||||||
fm.setRoute("/", fm.serveContent("itworks"))
|
|
||||||
fm.run()
|
fm.run()
|
13
assets/tmpl/layout.tmpl
Normal file
13
assets/tmpl/layout.tmpl
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Everything is Peachy</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% function block.pagebody() %}
|
||||||
|
<h1>It works!</h1>
|
||||||
|
<p>But something seems to be missing…</p>
|
||||||
|
{% end %}
|
||||||
|
{% block.pagebody() %}
|
||||||
|
</body>
|
||||||
|
</html>
|
4
assets/tmpl/opendb.tmpl
Normal file
4
assets/tmpl/opendb.tmpl
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{% function block.pagebody() %}
|
||||||
|
<p>Please select a database file to load.</p>
|
||||||
|
{% end %}
|
||||||
|
{% render('layout') %}
|
Loading…
Reference in New Issue
Block a user