liquid_feedback_frontend

annotate app/main/issue/_show_head.lua @ 266:aab7b0c5543f

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

Impressum / About Us