liquid_feedback_frontend

annotate app/main/issue/_show_head.lua @ 448:b04d1f79508e

Fixed wrong information about next state when state_time_left negative
author bsw
date Sun Mar 11 13:30:13 2012 +0100 (2012-03-11)
parents 3f2ae4f7a045
children
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@301 33 module = "unit",
bsw@301 34 view = "show",
bsw@301 35 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@317 44 attr = { class = "issue_policy_info" },
bsw@271 45 content = function()
bsw@272 46
bsw@272 47 ui.link{
bsw@272 48 text = issue.policy.name,
bsw@272 49 module = "policy",
bsw@272 50 view = "show",
bsw@272 51 id = issue.policy.id
bsw@272 52 }
bsw@272 53
bsw@271 54 slot.put(" · ")
bsw@271 55 ui.tag{ content = issue.state_name }
bsw@271 56
bsw@273 57 if issue.state_time_left then
bsw@273 58 slot.put(" · ")
bsw@448 59 if issue.state_time_left:sub(1,1) == "-" then
bsw@448 60 if issue.state == "new" then
bsw@448 61 ui.tag{ content = _("Discussion starts soon") }
bsw@448 62 elseif issue.state == "discussion" then
bsw@448 63 ui.tag{ content = _("Verification starts soon") }
bsw@448 64 elseif issue.state == "frozen" then
bsw@448 65 ui.tag{ content = _("Voting starts soon") }
bsw@448 66 elseif issue.state == "voting" then
bsw@448 67 ui.tag{ content = _("Counting starts soon") }
bsw@448 68 end
bsw@448 69 else
bsw@448 70 ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day") }) }
bsw@448 71 end
bsw@271 72 end
bsw@448 73
bsw@271 74 end
bsw@271 75 }
bsw@271 76
bsw@271 77
bsw@271 78 end)
bsw@271 79
bsw/jbe@4 80 slot.select("actions", function()
bsw/jbe@5 81
bsw@51 82 if app.session.member_id then
bsw@51 83
bsw@281 84 if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
bsw@51 85 local text
bsw@51 86 if not direct_voter then
bsw@51 87 text = _"Vote now"
bsw@51 88 else
bsw@51 89 text = _"Change vote"
bsw@51 90 end
bsw@51 91 ui.link{
bsw@51 92 content = function()
bsw@51 93 ui.image{ static = "icons/16/email_open.png" }
bsw@51 94 slot.put(text)
bsw@51 95 end,
bsw@51 96 module = "vote",
bsw@51 97 view = "list",
bsw@51 98 params = { issue_id = issue.id }
bsw@51 99 }
bsw/jbe@19 100 end
bsw/jbe@5 101
bsw/jbe@5 102 execute.view{
bsw@51 103 module = "interest",
bsw/jbe@5 104 view = "_show_box",
bsw@339 105 params = { issue = issue, initiative = initiative }
bsw/jbe@5 106 }
bsw@7 107
bsw@51 108 if not issue.closed then
bsw@51 109 execute.view{
bsw@51 110 module = "delegation",
bsw@51 111 view = "_show_box",
poelzi@111 112 params = { issue_id = issue.id,
poelzi@111 113 initiative_id = initiative and initiative.id or nil}
bsw@51 114 }
bsw@51 115 end
bsw@51 116
bsw@51 117 end
bsw/jbe@4 118
bsw@10 119 if config.issue_discussion_url_func then
bsw@10 120 local url = config.issue_discussion_url_func(issue)
bsw@10 121 ui.link{
bsw@10 122 attr = { target = "_blank" },
bsw@10 123 external = url,
bsw@10 124 content = function()
bsw@10 125 ui.image{ static = "icons/16/comments.png" }
bsw@10 126 slot.put(_"Discussion on issue")
bsw@10 127 end,
bsw@10 128 }
bsw@10 129 end
bsw@286 130
bsw@286 131 if config.etherpad and app.session.member then
bsw@286 132 local url = config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. issue.id
bsw@286 133 ui.link{
bsw@286 134 attr = { target = "_blank" },
bsw@286 135 external = url,
bsw@286 136 content = function()
bsw@286 137 ui.image{ static = "icons/16/comments.png" }
bsw@286 138 slot.put(_"Issue pad")
bsw@286 139 end,
bsw@286 140 }
bsw@286 141 end
bsw@286 142
bsw/jbe@4 143 end)
bsw/jbe@4 144
bsw@281 145 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
bsw@272 146 slot.select("actions", function()
bsw@272 147 if not issue.fully_frozen and not issue.closed then
bsw@272 148 ui.link{
bsw@272 149 image = { static = "icons/16/script_add.png" },
bsw@272 150 attr = { class = "action" },
bsw@272 151 text = _"Create alternative initiative",
bsw@272 152 module = "initiative",
bsw@272 153 view = "new",
bsw@272 154 params = { issue_id = issue.id }
bsw@272 155 }
bsw@272 156 end
bsw@272 157 end)
bsw@272 158 end
bsw/jbe@4 159
bsw@271 160 local issue = param.get("issue", "table")
bsw@271 161
bsw@60 162 if config.public_access_issue_head and not app.session.member_id then
bsw@60 163 config.public_access_issue_head(issue)
bsw@60 164 end
bsw/jbe@6 165
bsw@281 166 if app.session.member_id and issue.state == 'voting' and not direct_voter
bsw@281 167 and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
bsw@281 168 then
bsw/jbe@6 169 ui.container{
bsw/jbe@6 170 attr = { class = "voting_active_info" },
bsw/jbe@6 171 content = function()
bsw/jbe@6 172 slot.put(_"Voting for this issue is currently running!")
bsw/jbe@6 173 slot.put(" ")
bsw@51 174 if app.session.member_id then
bsw@51 175 ui.link{
bsw@51 176 content = function()
bsw@51 177 slot.put(_"Vote now")
bsw@51 178 end,
bsw@51 179 module = "vote",
bsw@51 180 view = "list",
bsw@51 181 params = { issue_id = issue.id }
bsw@51 182 }
bsw@51 183 end
bsw/jbe@6 184 end
bsw/jbe@6 185 }
bsw/jbe@6 186 slot.put("<br />")
bsw/jbe@6 187 end
bsw/jbe@6 188

Impressum / About Us