liquid_feedback_frontend
annotate app/main/issue/show_tab.lua @ 118:93f4e465b50d
add initiator support in delegation
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Mon Sep 20 20:32:04 2010 +0200 (2010-09-20) |
parents | 0849be391140 |
children | 2dc13655afca |
rev | line source |
---|---|
bsw/jbe@19 | 1 local issue |
bsw/jbe@19 | 2 if request.get_json_request_slots() then |
bsw/jbe@19 | 3 issue = Issue:by_id(param.get("issue_id")) |
bsw/jbe@19 | 4 else |
bsw/jbe@19 | 5 issue = param.get("issue", "table") |
bsw/jbe@19 | 6 end |
bsw/jbe@19 | 7 |
bsw/jbe@19 | 8 local voting_requested_percentage = 0 |
bsw/jbe@19 | 9 if issue.vote_later and issue.population and issue.population > 0 then |
bsw/jbe@19 | 10 voting_requested_percentage = math.ceil(issue.vote_later / issue.population * 100) |
bsw/jbe@19 | 11 end |
bsw/jbe@19 | 12 |
bsw/jbe@19 | 13 local interested_members_selector = issue:get_reference_selector("interested_members_snapshot") |
bsw/jbe@19 | 14 :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id") |
bsw/jbe@19 | 15 :add_field("direct_interest_snapshot.weight") |
bsw/jbe@19 | 16 :add_where("direct_interest_snapshot.event = issue.latest_snapshot_event") |
bsw/jbe@19 | 17 |
bsw/jbe@19 | 18 local voting_requests_selector = issue:get_reference_selector("interested_members_snapshot") |
bsw/jbe@19 | 19 :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id") |
bsw/jbe@19 | 20 :add_where("direct_interest_snapshot.voting_requested = false") |
bsw@41 | 21 :add_where("direct_interest_snapshot.event = issue.latest_snapshot_event") |
bsw/jbe@19 | 22 |
bsw/jbe@19 | 23 local delegations_selector = issue:get_reference_selector("delegations") |
bsw/jbe@19 | 24 |
bsw@51 | 25 local tabs = { |
bsw/jbe@19 | 26 module = "issue", |
bsw/jbe@19 | 27 view = "show_tab", |
bsw/jbe@19 | 28 static_params = { issue_id = issue.id }, |
bsw@51 | 29 } |
bsw@51 | 30 |
bsw@51 | 31 if app.session.member_id then |
bsw@51 | 32 tabs[#tabs+1] = |
bsw@51 | 33 { |
bsw@51 | 34 name = "interested_members", |
bsw@51 | 35 label = _"Interested members" .. " (" .. tostring(interested_members_selector:count()) .. ")" , |
bsw@51 | 36 icon = { static = "icons/16/eye.png" }, |
bsw@51 | 37 module = "member", |
bsw@51 | 38 view = "_list", |
bsw@51 | 39 params = { |
bsw@51 | 40 issue = issue, |
bsw@51 | 41 members_selector = interested_members_selector |
bsw@51 | 42 } |
bsw/jbe@19 | 43 } |
bsw@51 | 44 |
bsw@51 | 45 tabs[#tabs+1] = |
bsw@51 | 46 { |
bsw@51 | 47 name = "voting_requests", |
bsw@51 | 48 label = _"Vote later requests" .. " (" .. tostring(voting_requests_selector:count()) .. ") (" .. tostring(voting_requested_percentage) .. "%)", |
bsw@51 | 49 icon = { static = "icons/16/clock_play.png" }, |
bsw@51 | 50 module = "member", |
bsw@51 | 51 view = "_list", |
bsw@51 | 52 params = { |
bsw@51 | 53 issue = issue, |
bsw@51 | 54 members_selector = voting_requests_selector |
bsw@51 | 55 } |
bsw/jbe@19 | 56 } |
bsw@51 | 57 |
bsw@51 | 58 tabs[#tabs+1] = |
bsw@51 | 59 { |
bsw@51 | 60 name = "delegations", |
bsw@51 | 61 label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")" , |
bsw@51 | 62 icon = { static = "icons/16/table_go.png" }, |
bsw@51 | 63 module = "delegation", |
bsw@51 | 64 view = "_list", |
bsw@51 | 65 params = { delegations_selector = delegations_selector } |
bsw@51 | 66 } |
bsw@51 | 67 end |
bsw@51 | 68 |
bsw@51 | 69 tabs[#tabs+1] = |
bsw/jbe@19 | 70 { |
bsw/jbe@19 | 71 name = "details", |
bsw/jbe@19 | 72 label = _"Details", |
bsw/jbe@19 | 73 icon = { static = "icons/16/magnifier.png" }, |
bsw/jbe@19 | 74 module = "issue", |
bsw/jbe@19 | 75 view = "_details", |
bsw/jbe@19 | 76 params = { issue = issue } |
bsw@51 | 77 } |
bsw@51 | 78 |
bsw@51 | 79 ui.tabs(tabs) |
bsw/jbe@19 | 80 |
bsw/jbe@19 | 81 |