# HG changeset patch # User Daniel Poelzleithner # Date 1285007524 -7200 # Node ID bf885faf3452d48a9acff28aaed33cb548c8931d # Parent 10b7329ab0a2a0fe484d4e1476de941ef9783070 add initiator support in delegation if a delegation is issued from the initiative view, the initiators from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list. diff -r 10b7329ab0a2 -r bf885faf3452 app/main/delegation/_show_box.lua --- a/app/main/delegation/_show_box.lua Sun Sep 19 04:56:11 2010 +0200 +++ b/app/main/delegation/_show_box.lua Mon Sep 20 20:32:04 2010 +0200 @@ -1,4 +1,4 @@ -function change_delegation(scope, area_id, issue, delegation) +function change_delegation(scope, area_id, issue, delegation, initiative_id) local image local text if scope == "global" and delegation then @@ -34,6 +34,7 @@ view = "new", params = { issue_id = issue and issue.id or nil, + initiative_id = initiative_id or nil, area_id = area_id }, } @@ -62,11 +63,13 @@ local delegation local area_id local issue_id +local initiative_id local scope = "global" if param.get("initiative_id", atom.integer) then - issue_id = Initiative:by_id(param.get("initiative_id", atom.integer)).issue_id + initiative_id = param.get("initiative_id", atom.integer) + issue_id = Initiative:by_id(initiative_id).issue_id scope = "issue" end @@ -84,6 +87,7 @@ local delegation local issue + if issue_id then issue = Issue:by_id(issue_id) delegation = Delegation:by_pk(app.session.member.id, nil, issue_id) @@ -149,7 +153,7 @@ :exec() if not issue or (issue.state ~= "finished" and issue.state ~= "cancelled") then - change_delegation(scope, area_id, issue, delegation) + change_delegation(scope, area_id, issue, delegation, initiative_id) end for i, record in ipairs(delegation_chain) do @@ -210,6 +214,6 @@ end } else - change_delegation(scope, area_id, issue) + change_delegation(scope, area_id, issue, nil, initiative_id) end end) diff -r 10b7329ab0a2 -r bf885faf3452 app/main/delegation/new.lua --- a/app/main/delegation/new.lua Sun Sep 19 04:56:11 2010 +0200 +++ b/app/main/delegation/new.lua Mon Sep 20 20:32:04 2010 +0200 @@ -10,6 +10,8 @@ util.help("delegation.new.issue") end +local initiative = Initiative:by_id(param.get("initiative_id", atom.integer)) + if not area and not issue then slot.put_into("title", encode.html(_"Set global delegation")) util.help("delegation.new.global") @@ -80,9 +82,21 @@ name = _"No delegation" } } + for i, record in ipairs(contact_members) do records[#records+1] = record end + disabled_records = {} + -- add initiative authors + if initiative then + records[#records+1] = {id="_", name=_"--- Initiators ---"} + disabled_records["_"] = true + for i,record in ipairs(initiative.initiators) do + trace.debug(record) + trace.debug(record.member.name) + records[#records+1] = record.member + end + end ui.field.select{ label = _"Trustee", @@ -90,7 +104,9 @@ foreign_records = records, foreign_id = "id", foreign_name = "name", + disabled_records = disabled_records } + ui.submit{ text = _"Save" } end } diff -r 10b7329ab0a2 -r bf885faf3452 app/main/initiative/show_static.lua --- a/app/main/initiative/show_static.lua Sun Sep 19 04:56:11 2010 +0200 +++ b/app/main/initiative/show_static.lua Mon Sep 20 20:32:04 2010 +0200 @@ -19,7 +19,8 @@ execute.view{ module = "issue", view = "_show_head", - params = { issue = initiative.issue } + params = { issue = initiative.issue, + initiative = initiative } } --slot.put_into("html_head", '') diff -r 10b7329ab0a2 -r bf885faf3452 app/main/issue/_show_head.lua --- a/app/main/issue/_show_head.lua Sun Sep 19 04:56:11 2010 +0200 +++ b/app/main/issue/_show_head.lua Mon Sep 20 20:32:04 2010 +0200 @@ -1,4 +1,5 @@ local issue = param.get("issue", "table") +local initiative = param.get("initiative", "table") local direct_voter @@ -68,7 +69,8 @@ execute.view{ module = "delegation", view = "_show_box", - params = { issue_id = issue.id } + params = { issue_id = issue.id, + initiative_id = initiative and initiative.id or nil} } end diff -r 10b7329ab0a2 -r bf885faf3452 locale/translations.de.lua --- a/locale/translations.de.lua Sun Sep 19 04:56:11 2010 +0200 +++ b/locale/translations.de.lua Mon Sep 20 20:32:04 2010 +0200 @@ -1,5 +1,6 @@ #!/usr/bin/env lua return { +["--- Initiators ---"] = "--- Initiatoren ---"; ["##{id}"] = false; ["##{issue_id}.#{id} #{name}"] = false; ["#{interested_issues_to_vote_count} issue(s) you are interested in"] = "#{interested_issues_to_vote_count} Themen, die Dich interessieren"; diff -r 10b7329ab0a2 -r bf885faf3452 locale/translations.en.lua --- a/locale/translations.en.lua Sun Sep 19 04:56:11 2010 +0200 +++ b/locale/translations.en.lua Mon Sep 20 20:32:04 2010 +0200 @@ -1,5 +1,6 @@ #!/usr/bin/env lua return { +["--- Initiators ---"] = false; ["##{id}"] = false; ["##{issue_id}.#{id} #{name}"] = false; ["#{interested_issues_to_vote_count} issue(s) you are interested in"] = false;