liquid_feedback_frontend

view 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
author bsw/jbe
date Fri Dec 25 12:00:00 2009 +0100 (2009-12-25)
parents 80c215dbf076
children 8d91bccab0bf
line source
1 slot.select("title", function()
2 execute.view{
3 module = "member_image",
4 view = "_show",
5 params = {
6 member = app.session.member,
7 image_type = "avatar"
8 }
9 }
10 end)
12 slot.select("title", function()
13 ui.container{
14 attr = { class = "lang_chooser" },
15 content = function()
16 for i, lang in ipairs{"en", "de"} do
17 ui.link{
18 content = function()
19 ui.image{
20 static = "lang/" .. lang .. ".png",
21 attr = { style = "margin-left: 0.5em;", alt = lang }
22 }
23 end,
24 module = "index",
25 action = "set_lang",
26 params = { lang = lang },
27 routing = {
28 default = {
29 mode = "redirect",
30 module = request.get_module(),
31 view = request.get_view(),
32 id = param.get_id_cgi(),
33 params = param.get_all_cgi()
34 }
35 }
36 }
37 end
38 end
39 }
40 end)
42 slot.put_into("title", encode.html(config.app_title))
44 slot.select("actions", function()
46 ui.link{
47 content = function()
48 ui.image{ static = "icons/16/application_form.png" }
49 slot.put(_"Edit my profile")
50 end,
51 module = "member",
52 view = "edit"
53 }
55 ui.link{
56 content = function()
57 ui.image{ static = "icons/16/user_gray.png" }
58 slot.put(_"Upload images")
59 end,
60 module = "member",
61 view = "edit_images"
62 }
64 execute.view{
65 module = "delegation",
66 view = "_show_box"
67 }
69 ui.link{
70 content = function()
71 ui.image{ static = "icons/16/key.png" }
72 slot.put(_"Change password")
73 end,
74 module = "index",
75 view = "change_password"
76 }
78 end)
80 local lang = locale.get("lang")
81 local basepath = request.get_app_basepath()
82 local file_name = basepath .. "/locale/motd/" .. lang .. ".txt"
83 local file = io.open(file_name)
84 if file ~= nil then
85 local help_text = file:read("*a")
86 if #help_text > 0 then
87 ui.container{
88 attr = { class = "motd wiki" },
89 content = function()
90 slot.put(format.wiki_text(help_text))
91 end
92 }
93 end
94 end
97 util.help("index.index", _"Home")
100 local selector = Area:new_selector()
101 :reset_fields()
102 :add_field("area.id", nil, { "grouped" })
103 :add_field("area.name", nil, { "grouped" })
104 :add_field("membership.member_id NOTNULL", "is_member", { "grouped" })
105 :add_field("count(issue.id)", "issues_to_vote_count")
106 :add_field("count(interest.member_id)", "interested_issues_to_vote_count")
107 :join("issue", nil, "issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL")
108 :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id })
109 :add_where{ "direct_voter.member_id ISNULL" }
110 :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id })
111 :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id })
113 local areas = {}
114 for i, area in ipairs(selector:exec()) do
115 if area.is_member or area.interested_issues_to_vote_count > 0 then
116 areas[#areas+1] = area
117 end
118 end
120 if #areas > 0 then
121 ui.container{
122 attr = { style = "font-weight: bold;" },
123 content = _"Current votings in areas you are member of and issues you are interested in:"
124 }
126 ui.list{
127 records = areas,
128 columns = {
129 {
130 name = "name"
131 },
132 {
133 content = function(record)
134 if record.is_member and record.issues_to_vote_count > 0 then
135 ui.link{
136 content = function()
137 if record.issues_to_vote_count > 1 then
138 slot.put(_("#{issues_to_vote_count} issue(s)", { issues_to_vote_count = record.issues_to_vote_count }))
139 else
140 slot.put(_("One issue"))
141 end
142 end,
143 module = "area",
144 view = "show",
145 id = record.id,
146 params = {
147 filter = "frozen",
148 filter_voting = "not_voted"
149 }
150 }
151 else
152 slot.put(_"Not a member")
153 end
154 end
155 },
156 {
157 content = function(record)
158 if record.interested_issues_to_vote_count > 0 then
159 ui.link{
160 content = function()
161 if record.interested_issues_to_vote_count > 1 then
162 slot.put(_("#{interested_issues_to_vote_count} issue(s) you are interested in", { interested_issues_to_vote_count = record.interested_issues_to_vote_count }))
163 else
164 slot.put(_"One issue you are interested in")
165 end
166 end,
167 module = "area",
168 view = "show",
169 id = record.id,
170 params = {
171 filter = "frozen",
172 filter_interest = "my",
173 filter_voting = "not_voted"
174 }
175 }
176 end
177 end
178 },
179 }
180 }
181 end
183 execute.view{
184 module = "member",
185 view = "_show",
186 params = { member = app.session.member }
187 }

Impressum / About Us