liquid_feedback_frontend
view app/main/initiative/show_static.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 | d87097d3b6ec | 
| children | 1f7b38584c0d | 
 line source
     1 local initiative = param.get("initiative", "table")
     3 if not initiative then
     4   initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec()
     5 end
     7 slot.select("actions", function()
     8   ui.link{
     9     content = function()
    10       local count = Initiative:new_selector():add_where{ "issue_id = ?", initiative.issue.id}:count()-1
    11       ui.image{ static = "icons/16/script.png" }
    12       if count and count > 0 then
    13         slot.put(_("Show alternative initiatives (#{count})", {count=count}))
    14       else
    15         slot.put(_"Show alternative initiatives")
    16       end
    17     end,
    18     module = "issue",
    19     view = "show",
    20     id = initiative.issue.id
    21   }
    22 end)
    24 execute.view{
    25   module = "issue",
    26   view = "_show_head",
    27   params = { issue = initiative.issue,
    28              initiative = initiative }
    29 }
    31 --slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(initiative.id) .. '.rss" />')
    33 if app.session.member_id then
    34   slot.select("actions", function()
    35     if not initiative.issue.fully_frozen and not initiative.issue.closed then
    36       ui.link{
    37         image  = { static = "icons/16/script_add.png" },
    38         attr   = { class = "action" },
    39         text   = _"Create alternative initiative",
    40         module = "initiative",
    41         view   = "new",
    42         params = { issue_id = initiative.issue.id }
    43       }
    44     end
    45   end)
    46 end
    48 slot.put_into("sub_title", encode.html(_("Initiative: '#{name}'", { name = initiative.name }) ))
    50 execute.view{
    51   module = "initiative",
    52   view = "show_partial",
    53   params = {
    54     initiative = initiative,
    55     expanded = true
    56   }
    57 }
