| 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
|
|
bsw@211
|
9 ui.box{ class = "drafts", content = function()
|
|
bsw@211
|
10 if drafts then
|
|
bsw@211
|
11 ui.form{
|
|
bsw@211
|
12 method = "get",
|
|
bsw@211
|
13 module = "draft",
|
|
bsw@211
|
14 view = "diff",
|
|
bsw@211
|
15 content = function()
|
|
bsw@212
|
16 ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = _"Draft revisions" } end }
|
|
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@212
|
21 local class = "draft"
|
|
bsw@212
|
22 if i == 1 then class = class .. " first" end
|
|
bsw@212
|
23 ui.box_row{ class = class, content = function()
|
|
bsw@211
|
24 ui.box_col{ class = "left", content = function()
|
|
bsw@211
|
25 ui.link{
|
|
bsw@211
|
26 attr = { class = "created" },
|
|
bsw@211
|
27 text = format.timestamp(draft.created),
|
|
bsw@211
|
28 module = "draft",
|
|
bsw@211
|
29 view = "show",
|
|
bsw@211
|
30 id = draft.id
|
|
bsw@211
|
31 }
|
|
bsw@211
|
32 slot.put("<br />")
|
|
bsw@211
|
33 ui.tag{ content = _"by" }
|
|
bsw@211
|
34 slot.put(" ")
|
|
bsw@211
|
35 ui.link{
|
|
bsw@211
|
36 attr = { class = "author_name" },
|
|
bsw@211
|
37 module = "lf2", view = "issue", id = initiative.issue_id,
|
|
bsw@211
|
38 params = { member_id = author_id },
|
|
bsw@211
|
39 text = draft.author.name
|
|
bsw@211
|
40 }
|
|
bsw@211
|
41 end }
|
|
bsw@211
|
42 ui.box_col{ class = "right", content = function()
|
|
bsw@211
|
43 slot.put('<input type="radio" name="old_draft_id" value="' .. tostring(draft.id) .. '">')
|
|
bsw@211
|
44 slot.put('<input type="radio" name="new_draft_id" value="' .. tostring(draft.id) .. '">')
|
|
bsw@211
|
45 end }
|
|
bsw@211
|
46 end }
|
|
bsw@211
|
47 end
|
|
bsw@211
|
48 end } end }
|
|
bsw@211
|
49
|
|
bsw@211
|
50 ui.box_row{ content = function() ui.box_col{ class = "right", content = function()
|
|
bsw@211
|
51 ui.submit{ text = _"Compare selected" }
|
|
bsw@211
|
52 end } end }
|
|
bsw@211
|
53 end
|
|
bsw@211
|
54 }
|
|
bsw@211
|
55 else
|
|
bsw@211
|
56 end
|
|
bsw@211
|
57 end }
|