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