liquid_feedback_frontend
changeset 862:a1ff5d08f0f4
Displays correct avatar when showing delegation chain preview for other member
author | bsw |
---|---|
date | Fri Aug 17 19:54:41 2012 +0200 (2012-08-17) |
parents | 3c91b7678cab |
children | 4ab1e6f5f039 |
files | app/main/event/_list.lua app/main/initiative/_list.lua app/main/initiative/_list_element.lua app/main/issue/_list.lua app/main/issue/_show.lua |
line diff
1.1 --- a/app/main/event/_list.lua Fri Aug 17 19:51:40 2012 +0200 1.2 +++ b/app/main/event/_list.lua Fri Aug 17 19:54:41 2012 +0200 1.3 @@ -138,7 +138,7 @@ 1.4 1.5 ui.container{ attr = { class = "issue" }, content = function() 1.6 1.7 - execute.view{ module = "delegation", view = "_info", params = { issue = event.issue } } 1.8 + execute.view{ module = "delegation", view = "_info", params = { issue = event.issue, member = for_member } } 1.9 1.10 ui.container{ attr = { class = "content" }, content = function() 1.11 ui.link{ 1.12 @@ -171,7 +171,8 @@ 1.13 issue = event.issue, 1.14 initiatives_selector = initiatives_selector, 1.15 no_sort = true, 1.16 - limit = 5 1.17 + limit = 5, 1.18 + for_member = for_member 1.19 } } 1.20 else 1.21 local initiatives_selector = Initiative:new_selector() 1.22 @@ -179,7 +180,8 @@ 1.23 execute.view{ module = "initiative", view = "_list", params = { 1.24 initiatives_selector = initiatives_selector, 1.25 no_sort = true, 1.26 - hide_more_initiatives = true 1.27 + hide_more_initiatives = true, 1.28 + for_member = for_member 1.29 } } 1.30 end 1.31 end }
2.1 --- a/app/main/initiative/_list.lua Fri Aug 17 19:51:40 2012 +0200 2.2 +++ b/app/main/initiative/_list.lua Fri Aug 17 19:54:41 2012 +0200 2.3 @@ -57,6 +57,7 @@ 2.4 params = { 2.5 initiative = initiative, 2.6 selected = highlight_initiative and highlight_initiative.id == initiative.id or nil, 2.7 + for_member = for_member 2.8 } 2.9 } 2.10 end
3.1 --- a/app/main/initiative/_list_element.lua Fri Aug 17 19:51:40 2012 +0200 3.2 +++ b/app/main/initiative/_list_element.lua Fri Aug 17 19:54:41 2012 +0200 3.3 @@ -1,5 +1,6 @@ 3.4 local initiative = param.get("initiative", "table") 3.5 local selected = param.get("selected", atom.boolean) 3.6 +local for_member = param.get("for_member", "table") or app.session.member 3.7 3.8 local class = "initiative" 3.9 3.10 @@ -66,20 +67,33 @@ 3.11 if app.session.member_id then 3.12 ui.container{ attr = { class = "interest" }, content = function() 3.13 if initiative.member_info.initiated then 3.14 - local label = _"You are initiator of this initiative" 3.15 + local label 3.16 + if for_member and for_member.id ~= app.session.member_id then 3.17 + label = _"This member is initiator of this initiative" 3.18 + else 3.19 + label = _"You are initiator of this initiative" 3.20 + end 3.21 ui.image{ 3.22 attr = { alt = label, title = label }, 3.23 static = "icons/16/user_edit.png" 3.24 } 3.25 elseif initiative.member_info.directly_supported then 3.26 if initiative.member_info.satisfied then 3.27 - local label = _"You are supporter of this initiative" 3.28 + if for_member and for_member.id ~= app.session.member_id then 3.29 + label = _"This member is supporter of this initiative" 3.30 + else 3.31 + local label = _"You are supporter of this initiative" 3.32 + end 3.33 ui.image{ 3.34 attr = { alt = label, title = label }, 3.35 static = "icons/16/thumb_up_green.png" 3.36 } 3.37 else 3.38 - local label = _"You are potential supporter of this initiative" 3.39 + if for_member and for_member.id ~= app.session.member_id then 3.40 + label = _"This member is potential supporter of this initiative" 3.41 + else 3.42 + local label = _"You are potential supporter of this initiative" 3.43 + end 3.44 ui.image{ 3.45 attr = { alt = label, title = label }, 3.46 static = "icons/16/thumb_up.png" 3.47 @@ -87,13 +101,21 @@ 3.48 end 3.49 elseif initiative.member_info.supported then 3.50 if initiative.member_info.satisfied then 3.51 - local label = _"You are supporter of this initiative via delegation" 3.52 + if for_member and for_member.id ~= app.session.member_id then 3.53 + label = _"This member is supporter of this initiative via delegation" 3.54 + else 3.55 + local label = _"You are supporter of this initiative via delegation" 3.56 + end 3.57 ui.image{ 3.58 attr = { alt = label, title = label }, 3.59 static = "icons/16/thumb_up_green_arrow.png" 3.60 } 3.61 else 3.62 - local label = _"You are potential supporter of this initiative via delegation" 3.63 + if for_member and for_member.id ~= app.session.member_id then 3.64 + label = _"This member is potential supporter of this initiative via delegation" 3.65 + else 3.66 + local label = _"You are potential supporter of this initiative via delegation" 3.67 + end 3.68 ui.image{ 3.69 attr = { alt = label, title = label }, 3.70 static = "icons/16/thumb_up_arrow.png"
4.1 --- a/app/main/issue/_list.lua Fri Aug 17 19:51:40 2012 +0200 4.2 +++ b/app/main/issue/_list.lua Fri Aug 17 19:54:41 2012 +0200 4.3 @@ -38,7 +38,7 @@ 4.4 for i, issue in ipairs(issues) do 4.5 4.6 execute.view{ module = "issue", view = "_show", params = { 4.7 - issue = issue, for_listing = true 4.8 + issue = issue, for_listing = true, for_member = for_member 4.9 } } 4.10 4.11 end
5.1 --- a/app/main/issue/_show.lua Fri Aug 17 19:51:40 2012 +0200 5.2 +++ b/app/main/issue/_show.lua Fri Aug 17 19:54:41 2012 +0200 5.3 @@ -1,5 +1,6 @@ 5.4 local issue = param.get("issue", "table") 5.5 local initiative_limit = param.get("initiative_limit", atom.integer) 5.6 +local for_member = param.get("for_member", "table") 5.7 local for_listing = param.get("for_listing", atom.boolean) 5.8 local for_initiative = param.get("for_initiative", "table") 5.9 local for_initiative_id = for_initiative and for_initiative.id or nil 5.10 @@ -24,7 +25,7 @@ 5.11 5.12 ui.container{ attr = { class = class }, content = function() 5.13 5.14 - execute.view{ module = "delegation", view = "_info", params = { issue = issue } } 5.15 + execute.view{ module = "delegation", view = "_info", params = { issue = issue, member = for_member } } 5.16 5.17 if for_listing then 5.18 ui.container{ attr = { class = "content" }, content = function() 5.19 @@ -83,15 +84,17 @@ 5.20 5.21 local links = {} 5.22 5.23 - if voteable then 5.24 - links[#links+1] ={ 5.25 - content = vote_link_text, 5.26 - module = "vote", 5.27 - view = "list", 5.28 - params = { issue_id = issue.id } 5.29 - } 5.30 - end 5.31 + if voteable then 5.32 + links[#links+1] ={ 5.33 + content = vote_link_text, 5.34 + module = "vote", 5.35 + view = "list", 5.36 + params = { issue_id = issue.id } 5.37 + } 5.38 + end 5.39 5.40 + if not for_member or for_member.id == app.session.member_id then 5.41 + 5.42 if app.session.member_id then 5.43 5.44 if issue.member_info.own_participation then 5.45 @@ -138,13 +141,13 @@ 5.46 } 5.47 end 5.48 end 5.49 - end 5.50 5.51 - if not issue.closed and app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 5.52 - if issue.member_info.own_delegation_scope ~= "issue" then 5.53 - links[#links+1] = { text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } 5.54 - else 5.55 - links[#links+1] = { text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } 5.56 + if not issue.closed and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 5.57 + if issue.member_info.own_delegation_scope ~= "issue" then 5.58 + links[#links+1] = { text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } 5.59 + else 5.60 + links[#links+1] = { text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } 5.61 + end 5.62 end 5.63 end 5.64 5.65 @@ -178,6 +181,8 @@ 5.66 end 5.67 end 5.68 5.69 + end 5.70 + 5.71 ui.container{ attr = { class = "content actions" }, content = function() 5.72 for i, link in ipairs(links) do 5.73 if link.in_brackets then