liquid_feedback_frontend

view app/main/timeline/index.lua @ 10:72c5e0ee7c98

Version beta6

Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed

New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers

In area listing the number of closed issues is shown too

Renamed "author" field of initiative to "last author"

Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution

Help texts updated
author bsw
date Sun Jan 10 12:00:00 2010 +0100 (2010-01-10)
parents
children 77d58efe99fd
line source
2 local function format_dow(dow)
3 local dows = {
4 _"Monday",
5 _"Tuesday",
6 _"Wednesday",
7 _"Thursday",
8 _"Friday",
9 _"Saturday",
10 _"Sunday"
11 }
12 return dows[dow+1]
13 end
15 slot.put_into("title", _"Global timeline")
18 ui.form{
19 attr = { class = "vertical" },
20 module = "timeline",
21 view = "index",
22 method = "get",
23 content = function()
24 local tmp = db:query("select EXTRACT(DOW FROM date) as dow, date FROM (SELECT (now() - (to_char(days_before, '0') || ' days')::interval)::date as date from (select generate_series(0,7) as days_before) as series) as date; ")
25 local today = tmp[1].date
26 for i, record in ipairs(tmp) do
27 local content
28 if i == 1 then
29 content = _"Today"
30 elseif i == 2 then
31 content = _"Yesterday"
32 else
33 content = format_dow(record.dow)
34 end
35 ui.link{
36 content = content,
37 attr = { onclick = "el = document.getElementById('timeline_search_date'); el.value = '" .. tostring(record.date) .. "'; el.form.submit(); return(false);" },
38 module = "timeline",
39 view = "index",
40 params = { date = record.date }
41 }
42 slot.put(" ")
43 end
44 ui.field.hidden{
45 attr = { id = "timeline_search_date" },
46 name = "date",
47 value = param.get("date") or today
48 }
49 ui.field.select{
50 attr = { onchange = "this.form.submit();" },
51 name = "per_page",
52 label = _"Issues per page",
53 foreign_records = {
54 { id = "10", name = "10" },
55 { id = "25", name = "25" },
56 { id = "50", name = "50" },
57 { id = "100", name = "100" },
58 { id = "250", name = "250" },
59 { id = "all", name = _"All" },
60 },
61 foreign_id = "id",
62 foreign_name = "name",
63 value = param.get("per_page")
64 }
65 local initiatives_per_page = param.get("initiatives_per_page", atom.integer) or 3
67 ui.field.select{
68 attr = { onchange = "this.form.submit();" },
69 name = "initiatives_per_page",
70 label = _"Initiatives per page",
71 foreign_records = {
72 { id = 1, name = "1" },
73 { id = 3, name = "3" },
74 { id = 5, name = "5" },
75 { id = 10, name = "10" },
76 { id = 25, name = "25" },
77 { id = 50, name = "50" },
78 },
79 foreign_id = "id",
80 foreign_name = "name",
81 value = initiatives_per_page
82 }
83 end
84 }
86 local date = param.get("date")
87 if not date then
88 date = "today"
89 end
90 local issues_selector = db:new_selector()
91 issues_selector._class = Issue
93 issues_selector
94 :add_field("*")
95 :add_where{ "sort::date = ?", date }
96 :add_from{ "($) as issue", {
97 Issue:new_selector()
98 :add_field("''", "old_state")
99 :add_field("'new'", "new_state")
100 :add_field("created", "sort")
101 :union(Issue:new_selector()
102 :add_field("'new'", "old_state")
103 :add_field("'accepted'", "new_state")
104 :add_field("accepted", "sort")
105 :add_where("accepted NOTNULL")
106 ):union(Issue:new_selector()
107 :add_field("'accepted'", "old_state")
108 :add_field("'frozen'", "new_state")
109 :add_field("half_frozen", "sort")
110 :add_where("half_frozen NOTNULL")
111 ):union(Issue:new_selector()
112 :add_field("'frozen'", "old_state")
113 :add_field("'voting'", "new_state")
114 :add_field("fully_frozen", "sort")
115 :add_where("fully_frozen NOTNULL")
116 ):union(Issue:new_selector()
117 :add_field("'new'", "old_state")
118 :add_field("'cancelled'", "new_state")
119 :add_field("closed", "sort")
120 :add_where("closed NOTNULL AND accepted ISNULL")
121 ):union(Issue:new_selector()
122 :add_field("'accepted'", "old_state")
123 :add_field("'cancelled'", "new_state")
124 :add_field("closed", "sort")
125 :add_where("closed NOTNULL AND half_frozen ISNULL AND accepted NOTNULL")
126 ):union(Issue:new_selector()
127 :add_field("'frozen'", "old_state")
128 :add_field("'cancelled'", "new_state")
129 :add_field("closed", "sort")
130 :add_where("closed NOTNULL AND fully_frozen ISNULL AND half_frozen NOTNULL")
131 ):union(Issue:new_selector()
132 :add_field("'voting'", "old_state")
133 :add_field("'finished'", "new_state")
134 :add_field("closed", "sort")
135 :add_where("closed NOTNULL AND fully_frozen NOTNULL AND half_frozen ISNULL")
136 )
137 }
138 }
140 execute.view{
141 module = "issue",
142 view = "_list",
143 params = {
144 issues_selector = issues_selector,
145 initiatives_per_page = param.get("initiatives_per_page", atom.number),
146 initiatives_no_sort = true,
147 no_filter = true,
148 no_sort = true,
149 per_page = param.get("per_page"),
150 }
151 }

Impressum / About Us