liquid_feedback_frontend

view app/main/lf2/_issues.lua @ 211:4993b71b383f

First checkin of lf2 (frontend second generation) prototype
author bsw
date Wed Mar 02 20:06:26 2011 +0100 (2011-03-02)
parents
children 3e4ad069847a
line source
1 local issues = param.get("issues", "table")
3 for i, issue in ipairs(issues) do
4 local initiatives = issue.initiatives
6 local interested_members = issue.interested_members
8 -- prepare interest of current user
9 local interest = issue.interest
11 -- prepare trustees
12 local trustees = Member:new_selector()
13 :add_field("delegation_chain.*")
14 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, " .. tostring(issue.id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id")
15 :add_order_by("index")
16 :exec()
18 local global_delegation
19 local area_delegation
20 local issue_delegation
22 for i, delegation in ipairs(issue.outgoing_delegations) do
23 if delegation.scope == "global" then global_delegation = delegation
24 elseif delegation.scope == "area" then area_delegation = delegation
25 elseif delegation.scope == "issue" then issue_delegation = delegation
26 end
27 end
29 local delegation = issue_delegation or area_delegation or global_delegation
31 local delegating_interest = issue.delegating_interest
33 ui.box{ class = "issue", content = function()
35 ui.box_row{ class = "head", content = function()
37 ui.box_col{ class = "issue_id left", content = function()
38 ui.link{
39 module = "lf2", view = "issue", id = issue.id,
40 content = _("Issue ##{id}", { id = issue.id })
41 }
42 end }
44 ui.box_col{ class = "unit_name right", content = function()
45 ui.link{
46 module = "lf2", view = "unit", id = 1,
47 content = "Dummy unit name"
48 }
49 end }
50 ui.box_col{ class = "area_name right clearright", content = function()
51 ui.link{
52 module = "lf2", view = "area_name", id = issue.area_id,
53 content = issue.area.name
54 }
55 end }
56 ui.box_col{ class = "policy_name left clearleft first", content = function()
57 ui.link{
58 module = "lf2", view = "policy", id = issue.policy_id,
59 content = issue.policy.name
60 }
61 end }
63 end }
65 ui.box_row{ class = "head2", content = function()
67 ui.box_col{ class = "state_name left", content = function()
68 ui.tag{ content = issue.state_name }
69 slot.put(" · ")
70 ui.tag{ content = issue.closed and _("since #{date}", { date = format.date(issue.closed.date) }) or _("#{time_left} left", { time_left = issue.state_time_left }) }
71 end }
72 end }
74 if interest or delegation then
75 ui.box_row{ class = "head2", content = function()
76 ui.box_col{ class = "interest left", content = function()
77 if interest then
78 ui.image{ static = "lf2/icon_star.png" }
79 if issue.closed then
80 slot.put(" ", _"You were interested in this issue")
81 else
82 slot.put(" ", _"You are interested in this issue")
83 end
84 elseif delegating_interest then
85 ui.image{ static = "lf2/icon_delegated_star.png" }
86 if issue.closed then
87 slot.put(" ", _"You were interested in this issue by delegation")
88 else
89 slot.put(" ", _"You are interested in this issue by delegation")
90 end
91 elseif trustees then
92 slot.put(_"You have delegated this issue")
93 else
94 slot.put(_"You are not interested in this issue")
95 end
96 end }
97 -- TODO if delegation ist falsch
98 if delegation then
99 slot.put(tostring(delegation.id))
100 ui.box_col{ class = "delegation right", content = function()
101 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } }
102 end }
103 end
104 end }
105 end
107 for i, initiative in ipairs(issue.initiatives) do
108 ui.box_row{ class = "initiative", content = function() ui.box_col { content = function()
109 execute.view{ module = "lf2", view = "_initiative", params = { initiative = initiative } }
110 end } end }
111 end
113 end }
114 end

Impressum / About Us