liquid_feedback_frontend
changeset 297:c4dd225578d4
Show only member with voting rights in unit for delegation
author | bsw |
---|---|
date | Sat Feb 25 22:25:46 2012 +0100 (2012-02-25) |
parents | d39fa6c0ff0b |
children | 724ac69b7c97 |
files | app/main/delegation/new.lua model/member.lua |
line diff
1.1 --- a/app/main/delegation/new.lua Sat Feb 25 22:20:38 2012 +0100 1.2 +++ b/app/main/delegation/new.lua Sat Feb 25 22:25:46 2012 +0100 1.3 @@ -1,17 +1,22 @@ 1.4 +local voting_right_unit_id 1.5 + 1.6 local unit = Unit:by_id(param.get("unit_id", atom.integer)) 1.7 if unit then 1.8 + voting_right_unit_id = unit.id 1.9 slot.put_into("title", encode.html(config.single_unit_id and _"Set global delegation" or _"Set unit delegation")) 1.10 util.help("delegation.new.unit") 1.11 end 1.12 1.13 local area = Area:by_id(param.get("area_id", atom.integer)) 1.14 if area then 1.15 + voting_right_unit_id = area.unit_id 1.16 slot.put_into("title", encode.html(_"Set delegation for Area '#{name}'":gsub("#{name}", area.name))) 1.17 util.help("delegation.new.area") 1.18 end 1.19 1.20 local issue = Issue:by_id(param.get("issue_id", atom.integer)) 1.21 if issue then 1.22 + voting_right_unit_id = issue.area.unit_id 1.23 slot.put_into("title", encode.html(_"Set delegation for Issue ##{number} in Area '#{area_name}'":gsub("#{number}", issue.id):gsub("#{area_name}", issue.area.name))) 1.24 util.help("delegation.new.issue") 1.25 end 1.26 @@ -54,6 +59,7 @@ 1.27 1.28 local contact_members = Member:build_selector{ 1.29 is_contact_of_member_id = app.session.member_id, 1.30 + voting_right_for_unit_id = voting_right_unit_id, 1.31 order = "name" 1.32 }:exec() 1.33
2.1 --- a/model/member.lua Sat Feb 25 22:20:38 2012 +0100 2.2 +++ b/model/member.lua Sat Feb 25 22:25:46 2012 +0100 2.3 @@ -249,6 +249,9 @@ 2.4 selector:join("contact", "__model_member__contact", "member.id = __model_member__contact.other_member_id") 2.5 selector:add_where{ "__model_member__contact.member_id = ?", args.is_contact_of_member_id } 2.6 end 2.7 + if args.voting_right_for_unit_id then 2.8 + selector:join("privilege", "__model_member__privilege", "member.id = __model_member__privilege.member_id AND __model_member__privilege.voting_right") 2.9 + end 2.10 if args.order then 2.11 if args.order == "id" then 2.12 selector:add_order_by("id")