liquid_feedback_frontend

annotate app/main/issue/_show_head.lua @ 277:bde068b37608

Dropdown boxes except of delegation box removed, optical enhancements and repositioning of elements
author bsw
date Mon Feb 13 00:16:42 2012 +0100 (2012-02-13)
parents aec9df5b4cd3
children fecd4c13054a
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@271 67
bsw@271 68 --[[
poelzi@127 69 slot.select("content_navigation", function()
poelzi@127 70
poelzi@127 71 if app.session.member_id then
poelzi@150 72 local records
poelzi@127 73 local this = 0
poelzi@127 74 local issues_selector = Issue:new_selector()
poelzi@127 75
poelzi@127 76 -- FIXME: !DRY
poelzi@127 77 local issue_filter_map = {
poelzi@127 78 new = "new.png",
poelzi@127 79 accepted = "comments.png",
poelzi@127 80 half_frozen = "lock.png",
poelzi@127 81 frozen ="email_open.png",
poelzi@127 82 finished = "tick.png",
poelzi@127 83 cancelled = "cross.png",
poelzi@127 84 }
poelzi@127 85
poelzi@127 86
poelzi@150 87 local mk_link = function(index, text, icon, module)
poelzi@127 88 content = function()
poelzi@150 89 if index > 0 then
poelzi@127 90 slot.put(text)
poelzi@127 91 ui.image{ static = "icons/16/"..icon }
poelzi@127 92 else
poelzi@127 93 ui.image{ static = "icons/16/"..icon }
poelzi@127 94 slot.put(text)
poelzi@127 95 end
poelzi@127 96 end
poelzi@127 97 if records[this+index] then
poelzi@127 98 ui.link{
poelzi@127 99 content = content,
poelzi@150 100 module = module,
poelzi@127 101 view = "show",
poelzi@127 102 id = records[this+index].id,
poelzi@127 103 }
poelzi@127 104 else
poelzi@127 105 ui.container{
poelzi@127 106 content = content,
poelzi@127 107 }
poelzi@127 108 end
poelzi@127 109 end
poelzi@127 110
poelzi@127 111 issues_selector
poelzi@127 112 :add_where{"issue.area_id = ?", issue.area.id}
poelzi@127 113
poelzi@127 114 local filters = execute.load_chunk{module="issue", chunk="_filters.lua", params = {filter = "frozen"}}
poelzi@127 115
poelzi@127 116 local state = issue.state
poelzi@127 117
poelzi@127 118 -- FIXME: fix filter names to reflect issue.state values
poelzi@127 119 if state == "voting" then
poelzi@127 120 state = "frozen"
poelzi@127 121 elseif state == "frozen" then
poelzi@127 122 state = "half_frozen"
poelzi@127 123 end
poelzi@127 124
poelzi@127 125 filter = filters:get_filter("filter", state)
poelzi@127 126 if filter then
poelzi@127 127 filter.selector_modifier(issues_selector)
poelzi@127 128
poelzi@127 129 -- add subfilter to voting pager, so only not voted entries will be shown
poelzi@127 130 -- as this seems the most usefull exception
poelzi@127 131 if filter.name == "frozen" then
poelzi@127 132 filter_voting_name = "not_voted"
poelzi@127 133 local vfilter = filters:get_filter("filter_voting", "not_voted")
poelzi@127 134 if vfilter then
poelzi@127 135 vfilter.selector_modifier(issues_selector)
poelzi@127 136 end
poelzi@127 137 end
poelzi@127 138 end
poelzi@127 139
poelzi@127 140 records = issues_selector:exec()
poelzi@127 141
poelzi@127 142 for i,cissue in ipairs(records) do
poelzi@127 143 if cissue.id == issue.id then
poelzi@127 144 this = i
poelzi@127 145 break
poelzi@127 146 end
poelzi@127 147 end
poelzi@127 148
poelzi@150 149 mk_link(-1, _("Previous issue"), "resultset_previous.png", "issue")
poelzi@127 150 if issue.area then
poelzi@127 151 ui.link{
poelzi@127 152 content = function()
poelzi@127 153 if issue_filter_map[state] then
poelzi@127 154 ui.image{ static = "icons/16/"..issue_filter_map[state] }
poelzi@127 155 end
poelzi@127 156 slot.put(issue.area.name)
poelzi@127 157 end,
poelzi@127 158 module = "area",
poelzi@127 159 view = "show",
poelzi@127 160 id = issue.area.id,
poelzi@127 161 params = {
poelzi@127 162 filter = filter and filter.name or nil,
poelzi@127 163 filter_voting = filter_voting_name,
poelzi@127 164 tab = "issues"
poelzi@127 165 }
poelzi@127 166 }
poelzi@127 167 end
poelzi@150 168 mk_link(1, _("Next issue"), "resultset_next.png", "issue")
poelzi@150 169
poelzi@150 170 -- show pager for initiatives if available
poelzi@150 171 if initiative then
poelzi@150 172 ui.container{ content = function() end, attr = {class = "content_navigation_seperator"}}
poelzi@150 173
poelzi@150 174 records = issue:get_reference_selector("initiatives"):exec()
poelzi@150 175 for i,cissue in ipairs(records) do
poelzi@150 176 if cissue.id == initiative.id then
poelzi@150 177 this = i
poelzi@150 178 break
poelzi@150 179 end
poelzi@150 180 end
poelzi@150 181 mk_link(-1, _("Previous initiative"), "resultset_previous.png", "initiative")
poelzi@150 182 mk_link(1, _("Next initiative"), "resultset_next.png", "initiative")
poelzi@150 183 end
poelzi@127 184 end
poelzi@127 185 end
poelzi@127 186
poelzi@127 187 )
bsw@271 188 --]]
poelzi@127 189
bsw/jbe@4 190 slot.select("actions", function()
bsw/jbe@5 191
bsw@51 192 if app.session.member_id then
bsw@51 193
bsw@51 194 if issue.state == 'voting' then
bsw@51 195 local text
bsw@51 196 if not direct_voter then
bsw@51 197 text = _"Vote now"
bsw@51 198 else
bsw@51 199 text = _"Change vote"
bsw@51 200 end
bsw@51 201 ui.link{
bsw@51 202 content = function()
bsw@51 203 ui.image{ static = "icons/16/email_open.png" }
bsw@51 204 slot.put(text)
bsw@51 205 end,
bsw@51 206 module = "vote",
bsw@51 207 view = "list",
bsw@51 208 params = { issue_id = issue.id }
bsw@51 209 }
bsw/jbe@19 210 end
bsw/jbe@5 211
bsw/jbe@5 212 execute.view{
bsw@51 213 module = "interest",
bsw/jbe@5 214 view = "_show_box",
bsw@51 215 params = { issue = issue }
bsw/jbe@5 216 }
bsw@7 217
bsw@51 218 if not issue.closed then
bsw@51 219 execute.view{
bsw@51 220 module = "delegation",
bsw@51 221 view = "_show_box",
poelzi@111 222 params = { issue_id = issue.id,
poelzi@111 223 initiative_id = initiative and initiative.id or nil}
bsw@51 224 }
bsw@51 225 end
bsw@51 226
bsw@51 227 end
bsw/jbe@4 228
bsw@10 229 if config.issue_discussion_url_func then
bsw@10 230 local url = config.issue_discussion_url_func(issue)
bsw@10 231 ui.link{
bsw@10 232 attr = { target = "_blank" },
bsw@10 233 external = url,
bsw@10 234 content = function()
bsw@10 235 ui.image{ static = "icons/16/comments.png" }
bsw@10 236 slot.put(_"Discussion on issue")
bsw@10 237 end,
bsw@10 238 }
bsw@10 239 end
bsw/jbe@4 240 end)
bsw/jbe@4 241
bsw@272 242 if app.session.member_id then
bsw@272 243 slot.select("actions", function()
bsw@272 244 if not issue.fully_frozen and not issue.closed then
bsw@272 245 ui.link{
bsw@272 246 image = { static = "icons/16/script_add.png" },
bsw@272 247 attr = { class = "action" },
bsw@272 248 text = _"Create alternative initiative",
bsw@272 249 module = "initiative",
bsw@272 250 view = "new",
bsw@272 251 params = { issue_id = issue.id }
bsw@272 252 }
bsw@272 253 end
bsw@272 254 end)
bsw@272 255 end
bsw/jbe@4 256
bsw@271 257 local issue = param.get("issue", "table")
bsw@271 258
bsw@271 259
bsw/jbe@4 260
bsw/jbe@4 261 -- ui.twitter("http://example.com/t" .. tostring(issue.id))
bsw/jbe@6 262
bsw@60 263 if config.public_access_issue_head and not app.session.member_id then
bsw@60 264 config.public_access_issue_head(issue)
bsw@60 265 end
bsw/jbe@6 266
bsw@60 267 if app.session.member_id and issue.state == 'voting' and not direct_voter then
bsw/jbe@6 268 ui.container{
bsw/jbe@6 269 attr = { class = "voting_active_info" },
bsw/jbe@6 270 content = function()
bsw/jbe@6 271 slot.put(_"Voting for this issue is currently running!")
bsw/jbe@6 272 slot.put(" ")
bsw@51 273 if app.session.member_id then
bsw@51 274 ui.link{
bsw@51 275 content = function()
bsw@51 276 slot.put(_"Vote now")
bsw@51 277 end,
bsw@51 278 module = "vote",
bsw@51 279 view = "list",
bsw@51 280 params = { issue_id = issue.id }
bsw@51 281 }
bsw@51 282 end
bsw/jbe@6 283 end
bsw/jbe@6 284 }
bsw/jbe@6 285 slot.put("<br />")
bsw/jbe@6 286 end
bsw/jbe@6 287

Impressum / About Us