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