From 6994df13a433719de2cc19ee4fccb89727083147 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Wed, 10 Jul 2024 16:36:24 -0600 Subject: [PATCH] Make a stupid page with a layout template --- assets/.init.lua | 7 +++---- assets/tmpl/layout.tmpl | 13 +++++++++++++ assets/tmpl/opendb.tmpl | 4 ++++ 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 assets/tmpl/layout.tmpl create mode 100644 assets/tmpl/opendb.tmpl diff --git a/assets/.init.lua b/assets/.init.lua index 92904e8..4c5cc1d 100644 --- a/assets/.init.lua +++ b/assets/.init.lua @@ -1,4 +1,4 @@ --- LaunchBrowser() +LaunchBrowser() local migrate = require "migrate" @@ -10,10 +10,9 @@ db:exec("PRAGMA foreign_keys") migrate.migrate(db) fm = require "fullmoon" -fm.setTemplate("hello", "Hello, {%& name %}") +fm.setTemplate({"/tmpl/", tmpl = "fmt"}) fm.setRoute("/hello/:name", function(r) return fm.serveContent("hello", {name = r.params.name}) end) -fm.setTemplate("itworks", "

It works!

") -fm.setRoute("/", fm.serveContent("itworks")) +fm.setRoute("/", fm.serveContent("opendb")) fm.run() \ No newline at end of file diff --git a/assets/tmpl/layout.tmpl b/assets/tmpl/layout.tmpl new file mode 100644 index 0000000..a40a924 --- /dev/null +++ b/assets/tmpl/layout.tmpl @@ -0,0 +1,13 @@ + + + + Everything is Peachy + + + {% function block.pagebody() %} +

It works!

+

But something seems to be missing…

+ {% end %} + {% block.pagebody() %} + + \ No newline at end of file diff --git a/assets/tmpl/opendb.tmpl b/assets/tmpl/opendb.tmpl new file mode 100644 index 0000000..5eac089 --- /dev/null +++ b/assets/tmpl/opendb.tmpl @@ -0,0 +1,4 @@ +{% function block.pagebody() %} +

Please select a database file to load.

+{% end %} +{% render('layout') %} \ No newline at end of file