liquid_feedback_frontend
diff app/main/lf2/_sidebar_drafts.lua @ 211:4993b71b383f
First checkin of lf2 (frontend second generation) prototype
author | bsw |
---|---|
date | Wed Mar 02 20:06:26 2011 +0100 (2011-03-02) |
parents | |
children | 3e4ad069847a |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/lf2/_sidebar_drafts.lua Wed Mar 02 20:06:26 2011 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +local initiative = param.get("initiative", "table") 1.5 + 1.6 +local drafts = Draft:new_selector() 1.7 + :add_where{ "draft.initiative_id = ?", initiative.id } 1.8 + :add_order_by("id DESC") 1.9 + :exec() 1.10 + 1.11 +ui.container{ attr = { class = "boxhead" }, content = _"Draft revisions" } 1.12 + 1.13 +ui.box{ class = "drafts", content = function() 1.14 + if drafts then 1.15 + ui.form{ 1.16 + method = "get", 1.17 + module = "draft", 1.18 + view = "diff", 1.19 + content = function() 1.20 + ui.box_row{ class = "", content = function() 1.21 + ui.box_col{ class = "scrolled", content = function() 1.22 + 1.23 + for i, draft in ipairs(drafts) do 1.24 + ui.box_row{ class = "draft", content = function() 1.25 + ui.box_col{ class = "left", content = function() 1.26 + ui.link{ 1.27 + attr = { class = "created" }, 1.28 + text = format.timestamp(draft.created), 1.29 + module = "draft", 1.30 + view = "show", 1.31 + id = draft.id 1.32 + } 1.33 + slot.put("<br />") 1.34 + ui.tag{ content = _"by" } 1.35 + slot.put(" ") 1.36 + ui.link{ 1.37 + attr = { class = "author_name" }, 1.38 + module = "lf2", view = "issue", id = initiative.issue_id, 1.39 + params = { member_id = author_id }, 1.40 + text = draft.author.name 1.41 + } 1.42 + end } 1.43 + ui.box_col{ class = "right", content = function() 1.44 + slot.put('<input type="radio" name="old_draft_id" value="' .. tostring(draft.id) .. '">') 1.45 + slot.put('<input type="radio" name="new_draft_id" value="' .. tostring(draft.id) .. '">') 1.46 + end } 1.47 + end } 1.48 + end 1.49 + end } end } 1.50 + 1.51 + ui.box_row{ content = function() ui.box_col{ class = "right", content = function() 1.52 + ui.submit{ text = _"Compare selected" } 1.53 + end } end } 1.54 + end 1.55 + } 1.56 + else 1.57 + end 1.58 +end }