liquid_feedback_frontend
view app/main/issue/_show_head.lua @ 500:03c205fc17f0
Show blue quorum bar in bargraph more clear, fixed too big quorum in ie
| author | bsw | 
|---|---|
| date | Wed Mar 21 19:43:44 2012 +0100 (2012-03-21) | 
| parents | b04d1f79508e | 
| children | 
 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("title", function()
    16   ui.link{
    17     content = _("Issue ##{id}", { id = issue.id }),
    18     module = "issue",
    19     view = "show",
    20     id = issue.id
    21   }
    22   slot.put(" · ")
    23   ui.link{
    24     content = issue.area.name,
    25     module = "area",
    26     view = "show",
    27     id = issue.area.id
    28   }
    29   if not config.single_unit_id then
    30     slot.put(" · ")
    31     ui.link{
    32       content = issue.area.unit.name,
    33       module = "unit",
    34       view = "show",
    35       id = issue.area.unit_id
    36     }
    37   end
    38 end)
    41 slot.select("title2", function()
    42   ui.tag{
    43     tag = "div",
    44     attr = { class = "issue_policy_info" },
    45     content = function()
    47       ui.link{
    48         text = issue.policy.name,
    49         module = "policy",
    50         view = "show",
    51         id = issue.policy.id
    52       }
    54       slot.put(" · ")
    55       ui.tag{ content = issue.state_name }
    57       if issue.state_time_left then
    58         slot.put(" · ")
    59         if issue.state_time_left:sub(1,1) == "-" then
    60           if issue.state == "new" then
    61             ui.tag{ content = _("Discussion starts soon") }
    62           elseif issue.state == "discussion" then
    63             ui.tag{ content = _("Verification starts soon") }
    64           elseif issue.state == "frozen" then
    65             ui.tag{ content = _("Voting starts soon") }
    66           elseif issue.state == "voting" then
    67             ui.tag{ content = _("Counting starts soon") }
    68           end
    69         else
    70           ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day") }) }
    71         end
    72       end
    74     end
    75   }
    78 end)
    80 slot.select("actions", function()
    82   if app.session.member_id then
    84     if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
    85       local text
    86       if not direct_voter then
    87         text = _"Vote now"
    88       else
    89         text = _"Change vote"
    90       end
    91       ui.link{
    92         content = function()
    93           ui.image{ static = "icons/16/email_open.png" }
    94           slot.put(text)
    95         end,
    96         module = "vote",
    97         view = "list",
    98         params = { issue_id = issue.id }
    99       }
   100     end
   102     execute.view{
   103       module = "interest",
   104       view = "_show_box",
   105       params = { issue = issue, initiative = initiative }
   106     }
   108     if not issue.closed then
   109       execute.view{
   110         module = "delegation",
   111         view = "_show_box",
   112         params = { issue_id = issue.id,
   113                    initiative_id = initiative and initiative.id or nil}
   114       }
   115     end
   117   end
   119   if config.issue_discussion_url_func then
   120     local url = config.issue_discussion_url_func(issue)
   121     ui.link{
   122       attr = { target = "_blank" },
   123       external = url,
   124       content = function()
   125         ui.image{ static = "icons/16/comments.png" }
   126         slot.put(_"Discussion on issue")
   127       end,
   128     }
   129   end
   131   if config.etherpad and app.session.member then
   132     local url = config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. issue.id
   133     ui.link{
   134       attr = { target = "_blank" },
   135       external = url,
   136       content = function()
   137         ui.image{ static = "icons/16/comments.png" }
   138         slot.put(_"Issue pad")
   139       end,
   140     }
   141   end
   143 end)
   145 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
   146   slot.select("actions", function()
   147     if not issue.fully_frozen and not issue.closed then
   148       ui.link{
   149         image  = { static = "icons/16/script_add.png" },
   150         attr   = { class = "action" },
   151         text   = _"Create alternative initiative",
   152         module = "initiative",
   153         view   = "new",
   154         params = { issue_id = issue.id }
   155       }
   156     end
   157   end)
   158 end
   160 local issue = param.get("issue", "table")
   162 if config.public_access_issue_head and not app.session.member_id then
   163   config.public_access_issue_head(issue)
   164 end
   166 if app.session.member_id and issue.state == 'voting' and not direct_voter
   167   and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
   168 then
   169   ui.container{
   170     attr = { class = "voting_active_info" },
   171     content = function()
   172       slot.put(_"Voting for this issue is currently running!")
   173       slot.put(" ")
   174       if app.session.member_id then
   175         ui.link{
   176           content = function()
   177             slot.put(_"Vote now")
   178           end,
   179           module = "vote",
   180           view = "list",
   181           params = { issue_id = issue.id }
   182         }
   183       end
   184     end
   185   }
   186   slot.put("<br />")
   187 end
