liquid_feedback_frontend
view app/main/issue/_show_head.lua @ 319:0306d1b14685
Fixed wrong style attribute
| author | bsw | 
|---|---|
| date | Tue Feb 28 16:02:51 2012 +0100 (2012-02-28) | 
| parents | 9c639a2f3262 | 
| children | f8481330f4c2 | 
 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         ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left }) }
    60       end
    62     end
    63   }
    66 end)
    68 slot.select("actions", function()
    70   if app.session.member_id then
    72     if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
    73       local text
    74       if not direct_voter then
    75         text = _"Vote now"
    76       else
    77         text = _"Change vote"
    78       end
    79       ui.link{
    80         content = function()
    81           ui.image{ static = "icons/16/email_open.png" }
    82           slot.put(text)
    83         end,
    84         module = "vote",
    85         view = "list",
    86         params = { issue_id = issue.id }
    87       }
    88     end
    90     execute.view{
    91       module = "interest",
    92       view = "_show_box",
    93       params = { issue = issue }
    94     }
    96     if not issue.closed then
    97       execute.view{
    98         module = "delegation",
    99         view = "_show_box",
   100         params = { issue_id = issue.id,
   101                    initiative_id = initiative and initiative.id or nil}
   102       }
   103     end
   105   end
   107   if config.issue_discussion_url_func then
   108     local url = config.issue_discussion_url_func(issue)
   109     ui.link{
   110       attr = { target = "_blank" },
   111       external = url,
   112       content = function()
   113         ui.image{ static = "icons/16/comments.png" }
   114         slot.put(_"Discussion on issue")
   115       end,
   116     }
   117   end
   119   if config.etherpad and app.session.member then
   120     local url = config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. issue.id
   121     ui.link{
   122       attr = { target = "_blank" },
   123       external = url,
   124       content = function()
   125         ui.image{ static = "icons/16/comments.png" }
   126         slot.put(_"Issue pad")
   127       end,
   128     }
   129   end
   131 end)
   133 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
   134   slot.select("actions", function()
   135     if not issue.fully_frozen and not issue.closed then
   136       ui.link{
   137         image  = { static = "icons/16/script_add.png" },
   138         attr   = { class = "action" },
   139         text   = _"Create alternative initiative",
   140         module = "initiative",
   141         view   = "new",
   142         params = { issue_id = issue.id }
   143       }
   144     end
   145   end)
   146 end
   148 local issue = param.get("issue", "table")
   150 if config.public_access_issue_head and not app.session.member_id then
   151   config.public_access_issue_head(issue)
   152 end
   154 if app.session.member_id and issue.state == 'voting' and not direct_voter
   155   and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
   156 then
   157   ui.container{
   158     attr = { class = "voting_active_info" },
   159     content = function()
   160       slot.put(_"Voting for this issue is currently running!")
   161       slot.put(" ")
   162       if app.session.member_id then
   163         ui.link{
   164           content = function()
   165             slot.put(_"Vote now")
   166           end,
   167           module = "vote",
   168           view = "list",
   169           params = { issue_id = issue.id }
   170         }
   171       end
   172     end
   173   }
   174   slot.put("<br />")
   175 end
