liquid_feedback_frontend

changeset 111:bf885faf3452

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.
author Daniel Poelzleithner <poelzi@poelzi.org>
date Mon Sep 20 20:32:04 2010 +0200 (2010-09-20)
parents 10b7329ab0a2
children 29519f2f9929
files app/main/delegation/_show_box.lua app/main/delegation/new.lua app/main/initiative/show_static.lua app/main/issue/_show_head.lua locale/translations.de.lua locale/translations.en.lua
line diff
     1.1 --- a/app/main/delegation/_show_box.lua	Sun Sep 19 04:56:11 2010 +0200
     1.2 +++ b/app/main/delegation/_show_box.lua	Mon Sep 20 20:32:04 2010 +0200
     1.3 @@ -1,4 +1,4 @@
     1.4 -function change_delegation(scope, area_id, issue, delegation)
     1.5 +function change_delegation(scope, area_id, issue, delegation, initiative_id)
     1.6    local image
     1.7    local text
     1.8    if scope == "global" and delegation then
     1.9 @@ -34,6 +34,7 @@
    1.10          view = "new",
    1.11          params = {
    1.12            issue_id = issue and issue.id or nil,
    1.13 +          initiative_id = initiative_id or nil,
    1.14            area_id = area_id
    1.15          },
    1.16        }
    1.17 @@ -62,11 +63,13 @@
    1.18  local delegation
    1.19  local area_id
    1.20  local issue_id
    1.21 +local initiative_id
    1.22  
    1.23  local scope = "global"
    1.24  
    1.25  if param.get("initiative_id", atom.integer) then
    1.26 -  issue_id = Initiative:by_id(param.get("initiative_id", atom.integer)).issue_id
    1.27 +  initiative_id = param.get("initiative_id", atom.integer)
    1.28 +  issue_id = Initiative:by_id(initiative_id).issue_id
    1.29    scope = "issue"
    1.30  end
    1.31  
    1.32 @@ -84,6 +87,7 @@
    1.33  
    1.34  local delegation
    1.35  local issue
    1.36 +
    1.37  if issue_id then
    1.38    issue = Issue:by_id(issue_id)
    1.39    delegation = Delegation:by_pk(app.session.member.id, nil, issue_id)
    1.40 @@ -149,7 +153,7 @@
    1.41                :exec()
    1.42      
    1.43              if not issue or (issue.state ~= "finished" and issue.state ~= "cancelled") then
    1.44 -              change_delegation(scope, area_id, issue, delegation)
    1.45 +              change_delegation(scope, area_id, issue, delegation, initiative_id)
    1.46              end
    1.47  
    1.48              for i, record in ipairs(delegation_chain) do
    1.49 @@ -210,6 +214,6 @@
    1.50        end
    1.51      }
    1.52    else
    1.53 -    change_delegation(scope, area_id, issue)
    1.54 +    change_delegation(scope, area_id, issue, nil, initiative_id)
    1.55    end
    1.56  end)
     2.1 --- a/app/main/delegation/new.lua	Sun Sep 19 04:56:11 2010 +0200
     2.2 +++ b/app/main/delegation/new.lua	Mon Sep 20 20:32:04 2010 +0200
     2.3 @@ -10,6 +10,8 @@
     2.4    util.help("delegation.new.issue")
     2.5  end
     2.6  
     2.7 +local initiative = Initiative:by_id(param.get("initiative_id", atom.integer))
     2.8 +
     2.9  if not area and not issue then
    2.10    slot.put_into("title", encode.html(_"Set global delegation"))
    2.11    util.help("delegation.new.global")
    2.12 @@ -80,9 +82,21 @@
    2.13          name = _"No delegation"
    2.14        }
    2.15      }
    2.16 +
    2.17      for i, record in ipairs(contact_members) do
    2.18        records[#records+1] = record
    2.19      end
    2.20 +    disabled_records = {}
    2.21 +    -- add initiative authors
    2.22 +    if initiative then
    2.23 +      records[#records+1] = {id="_", name=_"--- Initiators ---"}
    2.24 +      disabled_records["_"] = true
    2.25 +      for i,record in ipairs(initiative.initiators) do
    2.26 +        trace.debug(record)
    2.27 +        trace.debug(record.member.name)
    2.28 +        records[#records+1] = record.member
    2.29 +      end
    2.30 +    end
    2.31  
    2.32      ui.field.select{
    2.33        label = _"Trustee",
    2.34 @@ -90,7 +104,9 @@
    2.35        foreign_records = records,
    2.36        foreign_id = "id",
    2.37        foreign_name = "name",
    2.38 +      disabled_records = disabled_records
    2.39      }
    2.40 +
    2.41      ui.submit{ text = _"Save" }
    2.42    end
    2.43  }
     3.1 --- a/app/main/initiative/show_static.lua	Sun Sep 19 04:56:11 2010 +0200
     3.2 +++ b/app/main/initiative/show_static.lua	Mon Sep 20 20:32:04 2010 +0200
     3.3 @@ -19,7 +19,8 @@
     3.4  execute.view{
     3.5    module = "issue",
     3.6    view = "_show_head",
     3.7 -  params = { issue = initiative.issue }
     3.8 +  params = { issue = initiative.issue,
     3.9 +             initiative = initiative }
    3.10  }
    3.11  
    3.12  --slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(initiative.id) .. '.rss" />')
     4.1 --- a/app/main/issue/_show_head.lua	Sun Sep 19 04:56:11 2010 +0200
     4.2 +++ b/app/main/issue/_show_head.lua	Mon Sep 20 20:32:04 2010 +0200
     4.3 @@ -1,4 +1,5 @@
     4.4  local issue = param.get("issue", "table")
     4.5 +local initiative = param.get("initiative", "table")
     4.6  
     4.7  local direct_voter
     4.8  
     4.9 @@ -68,7 +69,8 @@
    4.10        execute.view{
    4.11          module = "delegation",
    4.12          view = "_show_box",
    4.13 -        params = { issue_id = issue.id }
    4.14 +        params = { issue_id = issue.id,
    4.15 +                   initiative_id = initiative and initiative.id or nil}
    4.16        }
    4.17      end
    4.18  
     5.1 --- a/locale/translations.de.lua	Sun Sep 19 04:56:11 2010 +0200
     5.2 +++ b/locale/translations.de.lua	Mon Sep 20 20:32:04 2010 +0200
     5.3 @@ -1,5 +1,6 @@
     5.4  #!/usr/bin/env lua
     5.5  return {
     5.6 +["--- Initiators ---"] = "--- Initiatoren ---";
     5.7  ["##{id}"] = false;
     5.8  ["##{issue_id}.#{id} #{name}"] = false;
     5.9  ["#{interested_issues_to_vote_count} issue(s) you are interested in"] = "#{interested_issues_to_vote_count} Themen, die Dich interessieren";
     6.1 --- a/locale/translations.en.lua	Sun Sep 19 04:56:11 2010 +0200
     6.2 +++ b/locale/translations.en.lua	Mon Sep 20 20:32:04 2010 +0200
     6.3 @@ -1,5 +1,6 @@
     6.4  #!/usr/bin/env lua
     6.5  return {
     6.6 +["--- Initiators ---"] = false;
     6.7  ["##{id}"] = false;
     6.8  ["##{issue_id}.#{id} #{name}"] = false;
     6.9  ["#{interested_issues_to_vote_count} issue(s) you are interested in"] = false;

Impressum / About Us