liquid_feedback_frontend
diff app/main/initiative/show.lua @ 3:768faea1096d
Version alpha4
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
author | bsw |
---|---|
date | Mon Nov 30 12:00:00 2009 +0100 (2009-11-30) |
parents | 5c601807d397 |
children | 80c215dbf076 |
line diff
1.1 --- a/app/main/initiative/show.lua Mon Nov 23 12:00:00 2009 +0100 1.2 +++ b/app/main/initiative/show.lua Mon Nov 30 12:00:00 2009 +0100 1.3 @@ -1,6 +1,6 @@ 1.4 local initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec() 1.5 1.6 -slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(initiative.id) .. '.rss" />') 1.7 +--slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(initiative.id) .. '.rss" />') 1.8 1.9 execute.view{ 1.10 module = "supporter", 1.11 @@ -40,7 +40,9 @@ 1.12 1.13 slot.select("actions", function() 1.14 1.15 - if Initiator:by_pk(initiative.id, app.session.member.id) then 1.16 + local initiator = Initiator:by_pk(initiative.id, app.session.member.id) 1.17 + 1.18 + if initiator then 1.19 ui.link{ 1.20 content = function() 1.21 ui.image{ static = "icons/16/script_add.png" } 1.22 @@ -52,8 +54,41 @@ 1.23 } 1.24 end 1.25 1.26 - ui.twitter("http://example.com/i" .. tostring(initiative.id) .. " " .. initiative.name) 1.27 + if not initiative.issue.fully_frozen and not initiative.issue.closed then 1.28 + ui.link{ 1.29 + attr = { class = "action" }, 1.30 + content = function() 1.31 + ui.image{ static = "icons/16/script_add.png" } 1.32 + slot.put(_"Create alternative initiative" ) 1.33 + end, 1.34 + module = "initiative", 1.35 + view = "new", 1.36 + params = { issue_id = initiative.issue.id } 1.37 + } 1.38 + end 1.39 +-- ui.twitter("http://example.com/i" .. tostring(initiative.id) .. " " .. initiative.name) 1.40 1.41 + if initiative.discussion_url and #initiative.discussion_url > 0 then 1.42 + ui.link{ 1.43 + attr = { 1.44 + target = _"blank", 1.45 + title = initiative.discussion_url 1.46 + }, 1.47 + content = function() 1.48 + ui.image{ static = "icons/16/comments.png" } 1.49 + slot.put(_"External discussion") 1.50 + end, 1.51 + external = initiative.discussion_url 1.52 + } 1.53 + end 1.54 + if initiator then 1.55 + ui.link{ 1.56 + content = _"(change)", 1.57 + module = "initiative", 1.58 + view = "edit", 1.59 + id = initiative.id 1.60 + } 1.61 + end 1.62 end) 1.63 1.64 1.65 @@ -178,7 +213,18 @@ 1.66 name = "supporter", 1.67 label = _"Supporter", 1.68 content = function() 1.69 - execute.view{ module = "member", view = "_list", params = { members_selector = initiative:get_reference_selector("supporting_members") } } 1.70 + execute.view{ 1.71 + module = "member", 1.72 + view = "_list", 1.73 + params = { 1.74 + initiative = initiative, 1.75 + members_selector = initiative:get_reference_selector("supporting_members_snapshot") 1.76 + :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id") 1.77 + :join("direct_population_snapshot", nil, "direct_population_snapshot.event = issue.latest_snapshot_event AND direct_population_snapshot.issue_id = issue.id AND direct_population_snapshot.member_id = member.id") 1.78 + :add_field("direct_population_snapshot.weight") 1.79 + :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event") 1.80 + } 1.81 + } 1.82 end 1.83 }, 1.84 {