liquid_feedback_frontend
view app/main/issue/_show_head.lua @ 111:bf885faf3452
add initiator support in delegation
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
| author | Daniel Poelzleithner <poelzi@poelzi.org> | 
|---|---|
| date | Mon Sep 20 20:32:04 2010 +0200 (2010-09-20) | 
| parents | 7bc629bc1c20 | 
| children | 4fb486bce608 | 
 line source
     1 local issue = param.get("issue", "table")
     2 local initiative = param.get("initiative", "table")
     4 local direct_voter
     6 if app.session.member_id then
     7   direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
     8 end
    10 if config.feature_rss_enabled then
    11   util.html_rss_head{ title = _"Initiatives in this issue (last created first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id } }
    12   util.html_rss_head{ title = _"Initiatives in this issue (last updated first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id, order = "last_updated" } }
    13 end
    15 slot.select("path", function()
    16 end)
    18 slot.select("title", function()
    19   ui.link{
    20     content = issue.area.name,
    21     module = "area",
    22     view = "show",
    23     id = issue.area.id
    24   }
    25   slot.put(" · ")
    26   ui.link{
    27     content = _("Issue ##{id}", { id = issue.id }),
    28     module = "issue",
    29     view = "show",
    30     id = issue.id
    31   }
    32   slot.put(" · ")
    33   ui.tag{
    34     tag = "span",
    35     content = issue.state_name,
    36   }
    37 end)
    40 slot.select("actions", function()
    42   if app.session.member_id then
    44     if issue.state == 'voting' then
    45       local text
    46       if not direct_voter then
    47         text = _"Vote now"
    48       else
    49         text = _"Change vote"
    50       end
    51       ui.link{
    52         content = function()
    53           ui.image{ static = "icons/16/email_open.png" }
    54           slot.put(text)
    55         end,
    56         module = "vote",
    57         view = "list",
    58         params = { issue_id = issue.id }
    59       }
    60     end
    62     execute.view{
    63       module = "interest",
    64       view = "_show_box",
    65       params = { issue = issue }
    66     }
    68     if not issue.closed then
    69       execute.view{
    70         module = "delegation",
    71         view = "_show_box",
    72         params = { issue_id = issue.id,
    73                    initiative_id = initiative and initiative.id or nil}
    74       }
    75     end
    77     execute.view{
    78       module = "issue",
    79       view = "_show_vote_later_box",
    80       params = { issue = issue }
    81     }
    83   end
    85   if config.issue_discussion_url_func then
    86     local url = config.issue_discussion_url_func(issue)
    87     ui.link{
    88       attr = { target = "_blank" },
    89       external = url,
    90       content = function()
    91         ui.image{ static = "icons/16/comments.png" }
    92         slot.put(_"Discussion on issue")
    93       end,
    94     }
    95   end
    96 end)
    99 execute.view{
   100   module = "issue",
   101   view = "_show_box",
   102   params = { issue = issue }
   103 }
   105 --  ui.twitter("http://example.com/t" .. tostring(issue.id))
   107 if config.public_access_issue_head and not app.session.member_id then
   108   config.public_access_issue_head(issue)
   109 end
   111 if app.session.member_id and issue.state == 'voting' and not direct_voter then
   112   ui.container{
   113     attr = { class = "voting_active_info" },
   114     content = function()
   115       slot.put(_"Voting for this issue is currently running!")
   116       slot.put(" ")
   117       if app.session.member_id then
   118         ui.link{
   119           content = function()
   120             slot.put(_"Vote now")
   121           end,
   122           module = "vote",
   123           view = "list",
   124           params = { issue_id = issue.id }
   125         }
   126       end
   127     end
   128   }
   129   slot.put("<br />")
   130 end
