liquid_feedback_frontend

annotate app/main/lf2/_sidebar_drafts.lua @ 291:71eed60f6a41

Closed branch of experimental frontend
author jbe
date Sat Feb 25 15:56:55 2012 +0100 (2012-02-25)
parents 1dab81353eb1
children
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@215 8 ui.form{
bsw@215 9 method = "get",
bsw@215 10 module = "draft",
bsw@215 11 view = "diff",
bsw@215 12 content = function()
bsw@215 13 ui.box{ class = "drafts", content = function()
bsw@215 14 if drafts then
bsw@211 15
bsw@212 16 ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = _"Draft revisions" } end }
bsw@211 17
bsw@215 18 ui.box_row{ content = function() ui.box_col{ class = "scrolled", content = function()
bsw@215 19 for i, draft in ipairs(drafts) do
bsw@215 20 local class = "draft"
bsw@215 21 if i == 1 then class = class .. " first" end
bsw@215 22 ui.box_row{ class = class, content = function()
bsw@215 23 ui.box_col{ class = "left", content = function()
bsw@215 24 ui.link{
bsw@215 25 attr = { class = "created" },
bsw@215 26 text = format.timestamp(draft.created),
bsw@215 27 module = "draft",
bsw@215 28 view = "show",
bsw@215 29 id = draft.id
bsw@215 30 }
bsw@215 31 ui.container{ attr = { class = "authors" }, content = function()
bsw@211 32 ui.tag{ content = _"by" }
bsw@211 33 slot.put(" ")
bsw@211 34 ui.link{
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@215 40 end }
bsw@215 41 ui.box_col{ class = "right", content = function()
bsw@215 42 slot.put('<input type="radio" name="old_draft_id" value="' .. tostring(draft.id) .. '">')
bsw@215 43 slot.put('<input type="radio" name="new_draft_id" value="' .. tostring(draft.id) .. '">')
bsw@211 44 end }
bsw@215 45 end }
bsw@215 46 end
bsw@215 47 end } end }
bsw@211 48
bsw@215 49 ui.box_row{ class = "last", content = function() ui.box_col{ class = "right", content = function()
bsw@211 50 ui.submit{ text = _"Compare selected" }
bsw@211 51 end } end }
bsw@215 52
bsw@211 53 end
bsw@215 54 end }
bsw@211 55 end
bsw@215 56 }

Impressum / About Us