liquid_feedback_frontend
diff app/main/lf2/_sidebar_issue.lua @ 213:acf92c2d33f4
Seperated css and fixed issue delegations for second generation frontend
| author | bsw |
|---|---|
| date | Thu Mar 03 21:26:35 2011 +0100 (2011-03-03) |
| parents | 3e4ad069847a |
| children | 1dab81353eb1 |
line diff
1.1 --- a/app/main/lf2/_sidebar_issue.lua Thu Mar 03 18:39:00 2011 +0100 1.2 +++ b/app/main/lf2/_sidebar_issue.lua Thu Mar 03 21:26:35 2011 +0100 1.3 @@ -1,4 +1,5 @@ 1.4 local issue = param.get("issue", "table") 1.5 +local initiative_id = param.get("initiative_id", atom.integer) 1.6 1.7 local initiatives = issue.initiatives 1.8 1.9 @@ -10,27 +11,12 @@ 1.10 1.11 local interest = issue.interest 1.12 1.13 -local delegations = issue.delegations 1.14 - 1.15 local trustees = Member:new_selector() 1.16 :add_field("delegation_chain.*") 1.17 :join("delegation_chain(" .. tostring(app.session.member.id) .. ", NULL, " .. tostring(issue.id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id") 1.18 :add_order_by("index") 1.19 :exec() 1.20 1.21 -local global_delegation 1.22 -local area_delegation 1.23 -local issue_delegation 1.24 - 1.25 -for i, delegation in ipairs(issue.delegations) do 1.26 - if delegation.scope == "global" then global_delegation = delegation 1.27 - elseif delegation.scope == "area" then area_delegation = delegation 1.28 - elseif delegation.scope == "issue" then issue_delegation = delegation 1.29 - end 1.30 -end 1.31 - 1.32 -local delegation = issue_delegation or area_delegation or global_delegation 1.33 - 1.34 local delegating_interest = issue.delegating_interest 1.35 1.36 ui.box{ class = "issue", content = function() 1.37 @@ -42,21 +28,21 @@ 1.38 } 1.39 end } end } 1.40 1.41 - ui.box_row{ class = "unit_name", content = function() ui.box_col{ content = function() 1.42 + ui.box_row{ class = "unit_name head2", content = function() ui.box_col{ content = function() 1.43 ui.link{ 1.44 module = "lf2", view = "unit", id = 1, 1.45 content = "DE / Berlin / Friedrichshain-Kreuzberg" 1.46 } 1.47 end } end } 1.48 1.49 - ui.box_row{ class = "area_name", content = function() ui.box_col{ content = function() 1.50 + ui.box_row{ class = "area_name head2", content = function() ui.box_col{ content = function() 1.51 ui.link{ 1.52 module = "lf2", view = "area", id = issue.area_id, 1.53 content = issue.area.name 1.54 } 1.55 end } end } 1.56 1.57 - ui.box_row{ class = "policy_name", content = function() ui.box_col{ content = function() 1.58 + ui.box_row{ class = "policy_name head2", content = function() ui.box_col{ content = function() 1.59 ui.link{ 1.60 module = "lf2", view = "policy", id = issue.policy_id, 1.61 content = issue.policy.name 1.62 @@ -76,7 +62,9 @@ 1.63 slot.put(" ", _"You are interested in this issue") 1.64 end 1.65 else 1.66 - ui.image{ static = "lf2/icon_star_grey.png" } 1.67 + if not issue.closed and not issue.fully_frozen then 1.68 + ui.image{ static = "lf2/icon_star_grey.png" } 1.69 + end 1.70 slot.put(_"You are not interested in this issue") 1.71 end 1.72 1.73 @@ -97,7 +85,7 @@ 1.74 ui.link{ 1.75 module = "interest", action = "update", params = { issue_id = issue.id, delete = true }, 1.76 routing = { default = { 1.77 - mode = "redirect", module = "lf2", view = "issue", id = issue.id 1.78 + mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id, 1.79 } }, 1.80 attr = { class = "hoverbutton red"}, 1.81 content = function() 1.82 @@ -112,7 +100,7 @@ 1.83 ui.link{ 1.84 module = "interest", action = "update", params = { issue_id = issue.id }, 1.85 routing = { default = { 1.86 - mode = "redirect", module = "lf2", view = "issue", id = issue.id 1.87 + mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id, 1.88 } }, 1.89 attr = { class = "hoverbutton green"}, 1.90 content = function() 1.91 @@ -128,13 +116,23 @@ 1.92 end } end } 1.93 1.94 ui.box_row{ class = "delegation hoverbutton_container", content = function() ui.box_col{ content = function() 1.95 - if delegation then 1.96 - if delegation.issue_id then 1.97 - slot.put(encode.html(_"You have delegated this issue")) 1.98 - elseif delegation.area_id then 1.99 - slot.put(encode.html(_"You have delegated this area")) 1.100 - elseif delegation then 1.101 - slot.put(encode.html(_"You have delegated globally")) 1.102 + if trustees[1].scope_out then 1.103 + if trustees[1].disabled_out == false then 1.104 + if trustees[1].scope_out == "issue" then 1.105 + slot.put(encode.html(_"You have delegated this issue")) 1.106 + elseif trustees[1].scope_out == "area" then 1.107 + slot.put(encode.html(_"You have delegated this area")) 1.108 + elseif trustees[1].scope_out == "global" then 1.109 + slot.put(encode.html(_"You have delegated globally")) 1.110 + end 1.111 + else 1.112 + if trustees[1].scope_out == "issue" then 1.113 + slot.put(encode.html(_"Issue delegation abandoned")) 1.114 + elseif trustees[1].scope_out == "area" then 1.115 + slot.put(encode.html(_"Area delegation abandoned")) 1.116 + elseif trustees[1].scope_out == "global" then 1.117 + slot.put(encode.html(_"Global delegation abandoned")) 1.118 + end 1.119 end 1.120 else 1.121 slot.put(encode.html(_"No delegation active")) 1.122 @@ -147,19 +145,25 @@ 1.123 end } 1.124 end } 1.125 else 1.126 - if delegation then 1.127 - ui.link{ attr = { class = "hoverbutton red"}, content = function() 1.128 + if #trustees > 1 then 1.129 + ui.link{ 1.130 + module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id }, 1.131 + attr = { class = "hoverbutton red"}, content = function() 1.132 ui.container{ attr = { class = "content"}, content = function() 1.133 ui.image{ static = "lf2/icon_delegation.png" } 1.134 - slot.put(" ", encode.html(_"Change delegation...")) 1.135 + slot.put(" ", encode.html(_"Change issue delegation...")) 1.136 end } 1.137 end } 1.138 1.139 else 1.140 - ui.link{ attr = { class = "hoverbutton green"}, content = function() 1.141 + ui.link{ 1.142 + module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id }, 1.143 + attr = { class = "hoverbutton green"}, content = function() 1.144 ui.container{ attr = { class = "content"}, content = function() 1.145 ui.image{ static = "lf2/icon_delegation.png" } 1.146 - slot.put(" ", encode.html(_"Delegate issue")) 1.147 + slot.put(" ") 1.148 + slot.put(" ", encode.html(_"Set issue delegation...")) 1.149 + 1.150 end } 1.151 end } 1.152 1.153 @@ -167,8 +171,8 @@ 1.154 end 1.155 1.156 end } end } 1.157 - 1.158 - if delegation then 1.159 + 1.160 + if #trustees > 1 then 1.161 ui.box_row{ class = "delegation", content = function() ui.box_col{ content = function() 1.162 execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } } 1.163 end } end }