summaryrefslogtreecommitdiff
path: root/blueprints/artikkel.lua
diff options
context:
space:
mode:
authorbie <bie@blekksprut.net>2017-06-04 21:47:59 +0900
committerbie <bie@blekksprut.net>2017-06-04 21:47:59 +0900
commit6079d8edb941c50e773579c39f5e588b8986c8d8 (patch)
tree612c192cc140c7ed6e395af2863dfc70855ba9d7 /blueprints/artikkel.lua
parent3a7cdeb20edf7c57cfec9ec7f68e0277240a3fb7 (diff)
downloadtears-6079d8edb941c50e773579c39f5e588b8986c8d8.tar.xz
tears er enda bedre
Diffstat (limited to 'blueprints/artikkel.lua')
-rw-r--r--blueprints/artikkel.lua65
1 files changed, 65 insertions, 0 deletions
diff --git a/blueprints/artikkel.lua b/blueprints/artikkel.lua
new file mode 100644
index 0000000..506c701
--- /dev/null
+++ b/blueprints/artikkel.lua
@@ -0,0 +1,65 @@
+local artikkel = blueprint("default")
+
+function artikkel.env(data)
+ data.image = os.getenv("POST_image")
+ data.published = os.getenv("POST_published")
+ data.lead = os.getenv("POST_lead")
+end
+
+function artikkel.html(body, data)
+ if data.mode == "title" then
+ html.h2(data.title)
+ return
+ end
+
+ if data.mode == "short" then
+ html.p()
+ html.print(body)
+ return
+ end
+
+ html.print("<p class=figure>")
+ html.img(data.image)
+
+ html.h2(data.title)
+
+ html.print("<p class=byline>")
+ if data.portrait then
+ html.print("<img class='headshot mini' src='%s'>", data.portrait)
+ end
+ html.print("<span class=navn>")
+ html.print("<a href='/folk/%s'>%s</a>", data.author, data.author)
+ html.print(" for ")
+ html.print("<a href='/redaksjoner/%s'>%s</a>", data.group, data.group)
+ html.print("</span>")
+
+ html.print("<section class=content>")
+ html.print("<aside>")
+ if data.portrait then
+ html.print("<img class='headshot' src='%s'>", data.portrait)
+ end
+ html.print("</aside>")
+
+ html.print("<section class=body>")
+ html.print("<p><b>" .. data.lead .. "</b>")
+ html.marxup(body or "")
+ html.print("</section>")
+
+ html.print("</section>")
+end
+
+function artikkel.form(body, data)
+ html.p{}
+ html.label{text="Overskrift:"}
+ html.text{name='title', value=data.title, size=32}
+ html.p{}
+ html.label{text="Bilde:"}
+ html.orz{name = "image", value = data.image}
+ html.p{}
+ html.textarea{name='lead', value=data.lead, rows=3}
+ html.p{}
+ html.textarea{name='text', value=body}
+end
+
+return artikkel
+