bsw@211: local initiative = param.get("initiative", "table")
bsw@211:
bsw@211: local drafts = Draft:new_selector()
bsw@211: :add_where{ "draft.initiative_id = ?", initiative.id }
bsw@211: :add_order_by("id DESC")
bsw@211: :exec()
bsw@211:
bsw@215: ui.form{
bsw@215: method = "get",
bsw@215: module = "draft",
bsw@215: view = "diff",
bsw@215: content = function()
bsw@215: ui.box{ class = "drafts", content = function()
bsw@215: if drafts then
bsw@211:
bsw@212: ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = _"Draft revisions" } end }
bsw@211:
bsw@215: ui.box_row{ content = function() ui.box_col{ class = "scrolled", content = function()
bsw@215: for i, draft in ipairs(drafts) do
bsw@215: local class = "draft"
bsw@215: if i == 1 then class = class .. " first" end
bsw@215: ui.box_row{ class = class, content = function()
bsw@215: ui.box_col{ class = "left", content = function()
bsw@215: ui.link{
bsw@215: attr = { class = "created" },
bsw@215: text = format.timestamp(draft.created),
bsw@215: module = "draft",
bsw@215: view = "show",
bsw@215: id = draft.id
bsw@215: }
bsw@215: ui.container{ attr = { class = "authors" }, content = function()
bsw@211: ui.tag{ content = _"by" }
bsw@211: slot.put(" ")
bsw@211: ui.link{
bsw@211: module = "lf2", view = "issue", id = initiative.issue_id,
bsw@211: params = { member_id = author_id },
bsw@211: text = draft.author.name
bsw@211: }
bsw@211: end }
bsw@215: end }
bsw@215: ui.box_col{ class = "right", content = function()
bsw@215: slot.put('')
bsw@215: slot.put('')
bsw@211: end }
bsw@215: end }
bsw@215: end
bsw@215: end } end }
bsw@211:
bsw@215: ui.box_row{ class = "last", content = function() ui.box_col{ class = "right", content = function()
bsw@211: ui.submit{ text = _"Compare selected" }
bsw@211: end } end }
bsw@215:
bsw@211: end
bsw@215: end }
bsw@211: end
bsw@215: }