liquid_feedback_frontend
diff app/main/issue/_show_head.lua @ 127:4fb486bce608
add pageinator to issue view.
this "paginator" shows links to the prev/area/next issues that have the same
state then the current one. This helps a lot when inspecting new issues or voting.
The voting filter works a little bit different, as he also activtes the not_voted subfilter
because it is most likely only not voted issues are interessting to the user
this "paginator" shows links to the prev/area/next issues that have the same
state then the current one. This helps a lot when inspecting new issues or voting.
The voting filter works a little bit different, as he also activtes the not_voted subfilter
because it is most likely only not voted issues are interessting to the user
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Tue Oct 05 04:44:06 2010 +0200 (2010-10-05) |
parents | bf885faf3452 |
children | 850d02b1fc6d |
line diff
1.1 --- a/app/main/issue/_show_head.lua Mon Oct 04 15:52:22 2010 +0200 1.2 +++ b/app/main/issue/_show_head.lua Tue Oct 05 04:44:06 2010 +0200 1.3 @@ -37,6 +37,111 @@ 1.4 end) 1.5 1.6 1.7 +slot.select("content_navigation", function() 1.8 + 1.9 + if app.session.member_id then 1.10 + 1.11 + local this = 0 1.12 + local issues_selector = Issue:new_selector() 1.13 + 1.14 + -- FIXME: !DRY 1.15 + local issue_filter_map = { 1.16 + new = "new.png", 1.17 + accepted = "comments.png", 1.18 + half_frozen = "lock.png", 1.19 + frozen ="email_open.png", 1.20 + finished = "tick.png", 1.21 + cancelled = "cross.png", 1.22 + } 1.23 + 1.24 + 1.25 + local mk_link = function(index, text, icon, ltr) 1.26 + content = function() 1.27 + if ltr then 1.28 + slot.put(text) 1.29 + ui.image{ static = "icons/16/"..icon } 1.30 + else 1.31 + ui.image{ static = "icons/16/"..icon } 1.32 + slot.put(text) 1.33 + end 1.34 + end 1.35 + if records[this+index] then 1.36 + ui.link{ 1.37 + content = content, 1.38 + module = "issue", 1.39 + view = "show", 1.40 + id = records[this+index].id, 1.41 + } 1.42 + else 1.43 + ui.container{ 1.44 + content = content, 1.45 + } 1.46 + end 1.47 + end 1.48 + 1.49 + issues_selector 1.50 + :add_where{"issue.area_id = ?", issue.area.id} 1.51 + 1.52 + local filters = execute.load_chunk{module="issue", chunk="_filters.lua", params = {filter = "frozen"}} 1.53 + 1.54 + local state = issue.state 1.55 + 1.56 + -- FIXME: fix filter names to reflect issue.state values 1.57 + if state == "voting" then 1.58 + state = "frozen" 1.59 + elseif state == "frozen" then 1.60 + state = "half_frozen" 1.61 + end 1.62 + 1.63 + filter = filters:get_filter("filter", state) 1.64 + if filter then 1.65 + filter.selector_modifier(issues_selector) 1.66 + 1.67 + -- add subfilter to voting pager, so only not voted entries will be shown 1.68 + -- as this seems the most usefull exception 1.69 + if filter.name == "frozen" then 1.70 + filter_voting_name = "not_voted" 1.71 + local vfilter = filters:get_filter("filter_voting", "not_voted") 1.72 + if vfilter then 1.73 + vfilter.selector_modifier(issues_selector) 1.74 + end 1.75 + end 1.76 + end 1.77 + 1.78 + records = issues_selector:exec() 1.79 + 1.80 + for i,cissue in ipairs(records) do 1.81 + if cissue.id == issue.id then 1.82 + this = i 1.83 + break 1.84 + end 1.85 + end 1.86 + 1.87 + mk_link(-1, "Previous", "resultset_previous.png") 1.88 + if issue.area then 1.89 + ui.link{ 1.90 + content = function() 1.91 + if issue_filter_map[state] then 1.92 + ui.image{ static = "icons/16/"..issue_filter_map[state] } 1.93 + end 1.94 + slot.put(issue.area.name) 1.95 + end, 1.96 + module = "area", 1.97 + view = "show", 1.98 + id = issue.area.id, 1.99 + params = { 1.100 + filter = filter and filter.name or nil, 1.101 + filter_voting = filter_voting_name, 1.102 + tab = "issues" 1.103 + } 1.104 + } 1.105 + end 1.106 + mk_link(1, "Next", "resultset_next.png", 1) 1.107 + end 1.108 +end 1.109 + 1.110 +) 1.111 + 1.112 slot.select("actions", function() 1.113 1.114 if app.session.member_id then