# HG changeset patch # User bsw # Date 1345226081 -7200 # Node ID a1ff5d08f0f4540da39c73436c485a4f52f780a1 # Parent 3c91b7678cabbacbf8d048011fb6cc80c8229172 Displays correct avatar when showing delegation chain preview for other member diff -r 3c91b7678cab -r a1ff5d08f0f4 app/main/event/_list.lua --- a/app/main/event/_list.lua Fri Aug 17 19:51:40 2012 +0200 +++ b/app/main/event/_list.lua Fri Aug 17 19:54:41 2012 +0200 @@ -138,7 +138,7 @@ ui.container{ attr = { class = "issue" }, content = function() - execute.view{ module = "delegation", view = "_info", params = { issue = event.issue } } + execute.view{ module = "delegation", view = "_info", params = { issue = event.issue, member = for_member } } ui.container{ attr = { class = "content" }, content = function() ui.link{ @@ -171,7 +171,8 @@ issue = event.issue, initiatives_selector = initiatives_selector, no_sort = true, - limit = 5 + limit = 5, + for_member = for_member } } else local initiatives_selector = Initiative:new_selector() @@ -179,7 +180,8 @@ execute.view{ module = "initiative", view = "_list", params = { initiatives_selector = initiatives_selector, no_sort = true, - hide_more_initiatives = true + hide_more_initiatives = true, + for_member = for_member } } end end } diff -r 3c91b7678cab -r a1ff5d08f0f4 app/main/initiative/_list.lua --- a/app/main/initiative/_list.lua Fri Aug 17 19:51:40 2012 +0200 +++ b/app/main/initiative/_list.lua Fri Aug 17 19:54:41 2012 +0200 @@ -57,6 +57,7 @@ params = { initiative = initiative, selected = highlight_initiative and highlight_initiative.id == initiative.id or nil, + for_member = for_member } } end diff -r 3c91b7678cab -r a1ff5d08f0f4 app/main/initiative/_list_element.lua --- a/app/main/initiative/_list_element.lua Fri Aug 17 19:51:40 2012 +0200 +++ b/app/main/initiative/_list_element.lua Fri Aug 17 19:54:41 2012 +0200 @@ -1,5 +1,6 @@ local initiative = param.get("initiative", "table") local selected = param.get("selected", atom.boolean) +local for_member = param.get("for_member", "table") or app.session.member local class = "initiative" @@ -66,20 +67,33 @@ if app.session.member_id then ui.container{ attr = { class = "interest" }, content = function() if initiative.member_info.initiated then - local label = _"You are initiator of this initiative" + local label + if for_member and for_member.id ~= app.session.member_id then + label = _"This member is initiator of this initiative" + else + label = _"You are initiator of this initiative" + end ui.image{ attr = { alt = label, title = label }, static = "icons/16/user_edit.png" } elseif initiative.member_info.directly_supported then if initiative.member_info.satisfied then - local label = _"You are supporter of this initiative" + if for_member and for_member.id ~= app.session.member_id then + label = _"This member is supporter of this initiative" + else + local label = _"You are supporter of this initiative" + end ui.image{ attr = { alt = label, title = label }, static = "icons/16/thumb_up_green.png" } else - local label = _"You are potential supporter of this initiative" + if for_member and for_member.id ~= app.session.member_id then + label = _"This member is potential supporter of this initiative" + else + local label = _"You are potential supporter of this initiative" + end ui.image{ attr = { alt = label, title = label }, static = "icons/16/thumb_up.png" @@ -87,13 +101,21 @@ end elseif initiative.member_info.supported then if initiative.member_info.satisfied then - local label = _"You are supporter of this initiative via delegation" + if for_member and for_member.id ~= app.session.member_id then + label = _"This member is supporter of this initiative via delegation" + else + local label = _"You are supporter of this initiative via delegation" + end ui.image{ attr = { alt = label, title = label }, static = "icons/16/thumb_up_green_arrow.png" } else - local label = _"You are potential supporter of this initiative via delegation" + if for_member and for_member.id ~= app.session.member_id then + label = _"This member is potential supporter of this initiative via delegation" + else + local label = _"You are potential supporter of this initiative via delegation" + end ui.image{ attr = { alt = label, title = label }, static = "icons/16/thumb_up_arrow.png" diff -r 3c91b7678cab -r a1ff5d08f0f4 app/main/issue/_list.lua --- a/app/main/issue/_list.lua Fri Aug 17 19:51:40 2012 +0200 +++ b/app/main/issue/_list.lua Fri Aug 17 19:54:41 2012 +0200 @@ -38,7 +38,7 @@ for i, issue in ipairs(issues) do execute.view{ module = "issue", view = "_show", params = { - issue = issue, for_listing = true + issue = issue, for_listing = true, for_member = for_member } } end diff -r 3c91b7678cab -r a1ff5d08f0f4 app/main/issue/_show.lua --- a/app/main/issue/_show.lua Fri Aug 17 19:51:40 2012 +0200 +++ b/app/main/issue/_show.lua Fri Aug 17 19:54:41 2012 +0200 @@ -1,5 +1,6 @@ local issue = param.get("issue", "table") local initiative_limit = param.get("initiative_limit", atom.integer) +local for_member = param.get("for_member", "table") local for_listing = param.get("for_listing", atom.boolean) local for_initiative = param.get("for_initiative", "table") local for_initiative_id = for_initiative and for_initiative.id or nil @@ -24,7 +25,7 @@ ui.container{ attr = { class = class }, content = function() - execute.view{ module = "delegation", view = "_info", params = { issue = issue } } + execute.view{ module = "delegation", view = "_info", params = { issue = issue, member = for_member } } if for_listing then ui.container{ attr = { class = "content" }, content = function() @@ -83,15 +84,17 @@ local links = {} - if voteable then - links[#links+1] ={ - content = vote_link_text, - module = "vote", - view = "list", - params = { issue_id = issue.id } - } - end + if voteable then + links[#links+1] ={ + content = vote_link_text, + module = "vote", + view = "list", + params = { issue_id = issue.id } + } + end + if not for_member or for_member.id == app.session.member_id then + if app.session.member_id then if issue.member_info.own_participation then @@ -138,13 +141,13 @@ } end end - end - if not issue.closed and app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then - if issue.member_info.own_delegation_scope ~= "issue" then - links[#links+1] = { text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } - else - links[#links+1] = { text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } + if not issue.closed and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then + if issue.member_info.own_delegation_scope ~= "issue" then + links[#links+1] = { text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } + else + links[#links+1] = { text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id, initiative_id = for_initiative_id } } + end end end @@ -178,6 +181,8 @@ end end + end + ui.container{ attr = { class = "content actions" }, content = function() for i, link in ipairs(links) do if link.in_brackets then