summaryrefslogtreecommitdiffstats
path: root/lbu-commit-html.lsp
blob: c5e1ff29beeda543e6d4f7e1282d88c35fe628c1 (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
<?
local view = ...

local function packURL(script, prefix, controller, action, extra)
    ret = script .. "/" .. prefix .. controller .. "/" .. action
    sep = '?'
    for k,v in pairs(extra) do
        ret = ret .. sep .. k .. '=' .. v
        sep = '&'
    end
    return ret
end

--[[
view
  script, prefix, controller, action
  data[]
    name, 
    status
  title
  text[]
    label
    content
--]]
?><h1><?= view.title
?></h1><?

--Status Block
    for i,item in ipairs(view.note or {}) do
        ?><p class='error'><?= item.content ?></p><?
    end

?><table><?
for i,item in ipairs(view.data) do
    ?><tr><td><?= item.status ?><td><?= item.name ?><?
end
?></table><?
?><?= html.form.start {
    method="POST",
    action = packURL(view.script, view.prefix,
        view.controller, view.action, {})
    }
?><?= html.form.submit { name = view.action, value = view.action }
?><?= html.form.stop() ?><?
for i,item in ipairs(view.text) do
    if item.label then
        ?><h2><?= item.label ?></h2><?
    end
    ?><pre><?= item.content ?></pre><?
end
-- vim: set filetype=lua :
?>