liquid_feedback_frontend
diff app/main/index/index.lua @ 5:afd9f769c7ae
Version beta1
Final voting with Schulze-Method is now possible
Many bug fixes and code cleanup
Registration with invite codes
More sort and filter options
Seperated display of "supporters" and "potential supporters"
Optical changes
Flood limit / initiative contigent is now checked by frontend
Neccessary changes to access core beta11
Final voting with Schulze-Method is now possible
Many bug fixes and code cleanup
Registration with invite codes
More sort and filter options
Seperated display of "supporters" and "potential supporters"
Optical changes
Flood limit / initiative contigent is now checked by frontend
Neccessary changes to access core beta11
author | bsw/jbe |
---|---|
date | Fri Dec 25 12:00:00 2009 +0100 (2009-12-25) |
parents | 80c215dbf076 |
children | 8d91bccab0bf |
line diff
1.1 --- a/app/main/index/index.lua Thu Dec 10 12:00:00 2009 +0100 1.2 +++ b/app/main/index/index.lua Fri Dec 25 12:00:00 2009 +0100 1.3 @@ -96,6 +96,90 @@ 1.4 1.5 util.help("index.index", _"Home") 1.6 1.7 + 1.8 +local selector = Area:new_selector() 1.9 + :reset_fields() 1.10 + :add_field("area.id", nil, { "grouped" }) 1.11 + :add_field("area.name", nil, { "grouped" }) 1.12 + :add_field("membership.member_id NOTNULL", "is_member", { "grouped" }) 1.13 + :add_field("count(issue.id)", "issues_to_vote_count") 1.14 + :add_field("count(interest.member_id)", "interested_issues_to_vote_count") 1.15 + :join("issue", nil, "issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL") 1.16 + :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) 1.17 + :add_where{ "direct_voter.member_id ISNULL" } 1.18 + :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id }) 1.19 + :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id }) 1.20 + 1.21 +local areas = {} 1.22 +for i, area in ipairs(selector:exec()) do 1.23 + if area.is_member or area.interested_issues_to_vote_count > 0 then 1.24 + areas[#areas+1] = area 1.25 + end 1.26 +end 1.27 + 1.28 +if #areas > 0 then 1.29 + ui.container{ 1.30 + attr = { style = "font-weight: bold;" }, 1.31 + content = _"Current votings in areas you are member of and issues you are interested in:" 1.32 + } 1.33 + 1.34 + ui.list{ 1.35 + records = areas, 1.36 + columns = { 1.37 + { 1.38 + name = "name" 1.39 + }, 1.40 + { 1.41 + content = function(record) 1.42 + if record.is_member and record.issues_to_vote_count > 0 then 1.43 + ui.link{ 1.44 + content = function() 1.45 + if record.issues_to_vote_count > 1 then 1.46 + slot.put(_("#{issues_to_vote_count} issue(s)", { issues_to_vote_count = record.issues_to_vote_count })) 1.47 + else 1.48 + slot.put(_("One issue")) 1.49 + end 1.50 + end, 1.51 + module = "area", 1.52 + view = "show", 1.53 + id = record.id, 1.54 + params = { 1.55 + filter = "frozen", 1.56 + filter_voting = "not_voted" 1.57 + } 1.58 + } 1.59 + else 1.60 + slot.put(_"Not a member") 1.61 + end 1.62 + end 1.63 + }, 1.64 + { 1.65 + content = function(record) 1.66 + if record.interested_issues_to_vote_count > 0 then 1.67 + ui.link{ 1.68 + content = function() 1.69 + if record.interested_issues_to_vote_count > 1 then 1.70 + slot.put(_("#{interested_issues_to_vote_count} issue(s) you are interested in", { interested_issues_to_vote_count = record.interested_issues_to_vote_count })) 1.71 + else 1.72 + slot.put(_"One issue you are interested in") 1.73 + end 1.74 + end, 1.75 + module = "area", 1.76 + view = "show", 1.77 + id = record.id, 1.78 + params = { 1.79 + filter = "frozen", 1.80 + filter_interest = "my", 1.81 + filter_voting = "not_voted" 1.82 + } 1.83 + } 1.84 + end 1.85 + end 1.86 + }, 1.87 + } 1.88 + } 1.89 +end 1.90 + 1.91 execute.view{ 1.92 module = "member", 1.93 view = "_show",