liquid_feedback_frontend

annotate app/main/issue/_show_head.lua @ 271:d13b27a37ad5

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

Impressum / About Us