liquid_feedback_frontend

annotate app/main/issue/_show_head.lua @ 298:724ac69b7c97

Fix voting_right_for_unit_id argument for member selector builder
author bsw
date Sat Feb 25 22:27:03 2012 +0100 (2012-02-25)
parents c587d8762e62
children 22e4e26717ac
rev   line source
bsw/jbe@4 1 local issue = param.get("issue", "table")
poelzi@111 2 local initiative = param.get("initiative", "table")
bsw/jbe@4 3
bsw@51 4 local direct_voter
bsw@51 5
bsw@51 6 if app.session.member_id then
bsw@51 7 direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
bsw@51 8 end
bsw/jbe@19 9
bsw/jbe@52 10 if config.feature_rss_enabled then
bsw/jbe@52 11 util.html_rss_head{ title = _"Initiatives in this issue (last created first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id } }
bsw/jbe@52 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" } }
bsw/jbe@52 13 end
bsw/jbe@4 14
bsw/jbe@19 15 slot.select("title", function()
bsw@271 16 ui.link{
bsw@271 17 content = _("Issue ##{id}", { id = issue.id }),
bsw@271 18 module = "issue",
bsw@271 19 view = "show",
bsw@271 20 id = issue.id
bsw@271 21 }
bsw@273 22 slot.put(" · ")
bsw/jbe@4 23 ui.link{
bsw/jbe@19 24 content = issue.area.name,
bsw/jbe@4 25 module = "area",
bsw/jbe@4 26 view = "show",
bsw/jbe@4 27 id = issue.area.id
bsw/jbe@4 28 }
bsw@271 29 if not config.single_unit_id then
bsw@271 30 slot.put(" · ")
bsw@271 31 ui.link{
bsw@271 32 content = issue.area.unit.name,
bsw@271 33 module = "area",
bsw@271 34 view = "list",
bsw@271 35 params = { unit_id = issue.area.unit_id }
bsw@271 36 }
bsw@271 37 end
bsw/jbe@5 38 end)
bsw/jbe@5 39
bsw/jbe@4 40
bsw@271 41 slot.select("title2", function()
bsw@271 42 ui.tag{
bsw@271 43 tag = "div",
bsw@271 44 content = function()
bsw@272 45
bsw@272 46 ui.link{
bsw@272 47 text = issue.policy.name,
bsw@272 48 module = "policy",
bsw@272 49 view = "show",
bsw@272 50 id = issue.policy.id
bsw@272 51 }
bsw@272 52
bsw@271 53 slot.put(" · ")
bsw@271 54 ui.tag{ content = issue.state_name }
bsw@271 55
bsw@273 56 if issue.state_time_left then
bsw@273 57 slot.put(" · ")
bsw@273 58 ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left }) }
bsw@271 59 end
bsw@271 60
bsw@271 61 end
bsw@271 62 }
bsw@271 63
bsw@271 64
bsw@271 65 end)
bsw@271 66
bsw/jbe@4 67 slot.select("actions", function()
bsw/jbe@5 68
bsw@51 69 if app.session.member_id then
bsw@51 70
bsw@281 71 if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
bsw@51 72 local text
bsw@51 73 if not direct_voter then
bsw@51 74 text = _"Vote now"
bsw@51 75 else
bsw@51 76 text = _"Change vote"
bsw@51 77 end
bsw@51 78 ui.link{
bsw@51 79 content = function()
bsw@51 80 ui.image{ static = "icons/16/email_open.png" }
bsw@51 81 slot.put(text)
bsw@51 82 end,
bsw@51 83 module = "vote",
bsw@51 84 view = "list",
bsw@51 85 params = { issue_id = issue.id }
bsw@51 86 }
bsw/jbe@19 87 end
bsw/jbe@5 88
bsw/jbe@5 89 execute.view{
bsw@51 90 module = "interest",
bsw/jbe@5 91 view = "_show_box",
bsw@51 92 params = { issue = issue }
bsw/jbe@5 93 }
bsw@7 94
bsw@51 95 if not issue.closed then
bsw@51 96 execute.view{
bsw@51 97 module = "delegation",
bsw@51 98 view = "_show_box",
poelzi@111 99 params = { issue_id = issue.id,
poelzi@111 100 initiative_id = initiative and initiative.id or nil}
bsw@51 101 }
bsw@51 102 end
bsw@51 103
bsw@51 104 end
bsw/jbe@4 105
bsw@10 106 if config.issue_discussion_url_func then
bsw@10 107 local url = config.issue_discussion_url_func(issue)
bsw@10 108 ui.link{
bsw@10 109 attr = { target = "_blank" },
bsw@10 110 external = url,
bsw@10 111 content = function()
bsw@10 112 ui.image{ static = "icons/16/comments.png" }
bsw@10 113 slot.put(_"Discussion on issue")
bsw@10 114 end,
bsw@10 115 }
bsw@10 116 end
bsw@286 117
bsw@286 118 if config.etherpad and app.session.member then
bsw@286 119 local url = config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. issue.id
bsw@286 120 ui.link{
bsw@286 121 attr = { target = "_blank" },
bsw@286 122 external = url,
bsw@286 123 content = function()
bsw@286 124 ui.image{ static = "icons/16/comments.png" }
bsw@286 125 slot.put(_"Issue pad")
bsw@286 126 end,
bsw@286 127 }
bsw@286 128 end
bsw@286 129
bsw/jbe@4 130 end)
bsw/jbe@4 131
bsw@281 132 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
bsw@272 133 slot.select("actions", function()
bsw@272 134 if not issue.fully_frozen and not issue.closed then
bsw@272 135 ui.link{
bsw@272 136 image = { static = "icons/16/script_add.png" },
bsw@272 137 attr = { class = "action" },
bsw@272 138 text = _"Create alternative initiative",
bsw@272 139 module = "initiative",
bsw@272 140 view = "new",
bsw@272 141 params = { issue_id = issue.id }
bsw@272 142 }
bsw@272 143 end
bsw@272 144 end)
bsw@272 145 end
bsw/jbe@4 146
bsw@271 147 local issue = param.get("issue", "table")
bsw@271 148
bsw@60 149 if config.public_access_issue_head and not app.session.member_id then
bsw@60 150 config.public_access_issue_head(issue)
bsw@60 151 end
bsw/jbe@6 152
bsw@281 153 if app.session.member_id and issue.state == 'voting' and not direct_voter
bsw@281 154 and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
bsw@281 155 then
bsw/jbe@6 156 ui.container{
bsw/jbe@6 157 attr = { class = "voting_active_info" },
bsw/jbe@6 158 content = function()
bsw/jbe@6 159 slot.put(_"Voting for this issue is currently running!")
bsw/jbe@6 160 slot.put(" ")
bsw@51 161 if app.session.member_id then
bsw@51 162 ui.link{
bsw@51 163 content = function()
bsw@51 164 slot.put(_"Vote now")
bsw@51 165 end,
bsw@51 166 module = "vote",
bsw@51 167 view = "list",
bsw@51 168 params = { issue_id = issue.id }
bsw@51 169 }
bsw@51 170 end
bsw/jbe@6 171 end
bsw/jbe@6 172 }
bsw/jbe@6 173 slot.put("<br />")
bsw/jbe@6 174 end
bsw/jbe@6 175

Impressum / About Us