summaryrefslogtreecommitdiff
path: root/blueprints/anmeldelse.lua
blob: 9f637452dce85844fc51b2d5d1ec6defa5c1fb60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
local artikkel = blueprint("anmeldelse")

local TERMS = {
  ['regissør'] = 'Regissør',
  manus = 'Manus',
  medvirkende = 'Medvirkende',
  sjanger = 'Sjanger',
  norgespremiere = 'Norgespremiere',
  aldersgrense = 'Aldersgrense'

}
--  'medvirkende',
--  'sjanger',
--  'norgespremiere',
--  'aldersgrense'

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 or "")
    return
  end
  
  html.print("<p class=figure>")
  html.img{src = 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>%s for %s</span>", data.author, data.group)

  html.print("<section class=content>")
  html.print("<aside>")
  if data.portrait then
    html.print("<img class='headshot' src='%s'>", data.portrait)
  end
  html.dl(data.info)

  html.print("<section class=body>")
  html.print("<p><b>" .. data.lead .. "</b>")
  html.marxup(body)
  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.label{text="Inline-bilde:"}
  html.orz{inline = true}

  html.print("<p id=lol>")
  html.textarea{name='lead', value=data.lead, rows=3}

  html.p{}
  html.textarea{name='text', value=body}

  html.p{}
  html.infobox{values=data.info, terms=TERMS}

  html.hidden{name='type', value='anmeldelse'}
end

return artikkel