rev |
line source |
bsw@211
|
1 local initiative = param.get("initiative", "table")
|
bsw@211
|
2
|
bsw@211
|
3 local drafts = Draft:new_selector()
|
bsw@211
|
4 :add_where{ "draft.initiative_id = ?", initiative.id }
|
bsw@211
|
5 :add_order_by("id DESC")
|
bsw@211
|
6 :exec()
|
bsw@211
|
7
|
bsw@211
|
8 ui.container{ attr = { class = "boxhead" }, content = _"Draft revisions" }
|
bsw@211
|
9
|
bsw@211
|
10 ui.box{ class = "drafts", content = function()
|
bsw@211
|
11 if drafts then
|
bsw@211
|
12 ui.form{
|
bsw@211
|
13 method = "get",
|
bsw@211
|
14 module = "draft",
|
bsw@211
|
15 view = "diff",
|
bsw@211
|
16 content = function()
|
bsw@211
|
17 ui.box_row{ class = "", content = function()
|
bsw@211
|
18 ui.box_col{ class = "scrolled", content = function()
|
bsw@211
|
19
|
bsw@211
|
20 for i, draft in ipairs(drafts) do
|
bsw@211
|
21 ui.box_row{ class = "draft", content = function()
|
bsw@211
|
22 ui.box_col{ class = "left", content = function()
|
bsw@211
|
23 ui.link{
|
bsw@211
|
24 attr = { class = "created" },
|
bsw@211
|
25 text = format.timestamp(draft.created),
|
bsw@211
|
26 module = "draft",
|
bsw@211
|
27 view = "show",
|
bsw@211
|
28 id = draft.id
|
bsw@211
|
29 }
|
bsw@211
|
30 slot.put("<br />")
|
bsw@211
|
31 ui.tag{ content = _"by" }
|
bsw@211
|
32 slot.put(" ")
|
bsw@211
|
33 ui.link{
|
bsw@211
|
34 attr = { class = "author_name" },
|
bsw@211
|
35 module = "lf2", view = "issue", id = initiative.issue_id,
|
bsw@211
|
36 params = { member_id = author_id },
|
bsw@211
|
37 text = draft.author.name
|
bsw@211
|
38 }
|
bsw@211
|
39 end }
|
bsw@211
|
40 ui.box_col{ class = "right", content = function()
|
bsw@211
|
41 slot.put('<input type="radio" name="old_draft_id" value="' .. tostring(draft.id) .. '">')
|
bsw@211
|
42 slot.put('<input type="radio" name="new_draft_id" value="' .. tostring(draft.id) .. '">')
|
bsw@211
|
43 end }
|
bsw@211
|
44 end }
|
bsw@211
|
45 end
|
bsw@211
|
46 end } end }
|
bsw@211
|
47
|
bsw@211
|
48 ui.box_row{ content = function() ui.box_col{ class = "right", content = function()
|
bsw@211
|
49 ui.submit{ text = _"Compare selected" }
|
bsw@211
|
50 end } end }
|
bsw@211
|
51 end
|
bsw@211
|
52 }
|
bsw@211
|
53 else
|
bsw@211
|
54 end
|
bsw@211
|
55 end }
|