liquid_feedback_frontend

view model/initiative.lua @ 6:8d91bccab0bf

Version beta2

Possibility to browse voters of a closed issue

Registration with invite code

Email confirmation and password recovery

Download function (for database dumps) added

Critical bug solved, which made it impossible to select your opinion on other peoples suggestions

Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted

Fixed wrong sorting order for "supporters" or "potential supporters"

Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)

Strip space characters from certain fields and ensure they contain at least 3 characters

Showing grade in opinion/list as clear text instead of integer value

More information on initiative is displayed while voting

Colored notification box shown on pages of issues or initiatives which are currently in voting state

Changed default filter for issues to "Open"

Back link on suggestion page

Some optical changes

Removed wrong space character in LICENSE file
author bsw/jbe
date Sat Jan 02 12:00:00 2010 +0100 (2010-01-02)
parents 80c215dbf076
children 72c5e0ee7c98
line source
1 Initiative = mondelefant.new_class()
2 Initiative.table = 'initiative'
4 Initiative:add_reference{
5 mode = 'm1',
6 to = "Issue",
7 this_key = 'issue_id',
8 that_key = 'id',
9 ref = 'issue',
10 }
12 Initiative:add_reference{
13 mode = '1m',
14 to = "Draft",
15 this_key = 'id',
16 that_key = 'initiative_id',
17 ref = 'drafts',
18 back_ref = 'initiative',
19 default_order = '"id"'
20 }
22 Initiative:add_reference{
23 mode = '1m',
24 to = "Suggestion",
25 this_key = 'id',
26 that_key = 'initiative_id',
27 ref = 'suggestions',
28 back_ref = 'initiative',
29 }
31 Initiative:add_reference{
32 mode = '1m',
33 to = "Initiator",
34 this_key = 'id',
35 that_key = 'initiative_id',
36 ref = 'initiators',
37 back_ref = 'initiative',
38 default_order = '"id"'
39 }
41 Initiative:add_reference{
42 mode = '1m',
43 to = "Supporter",
44 this_key = 'id',
45 that_key = 'initiative_id',
46 ref = 'supporters',
47 back_ref = 'initiative',
48 default_order = '"id"'
49 }
51 Initiative:add_reference{
52 mode = '1m',
53 to = "Opinion",
54 this_key = 'id',
55 that_key = 'initiative_id',
56 ref = 'opinions',
57 back_ref = 'initiative',
58 default_order = '"id"'
59 }
61 Initiative:add_reference{
62 mode = '1m',
63 to = "Vote",
64 this_key = 'id',
65 that_key = 'initiative_id',
66 ref = 'votes',
67 back_ref = 'initiative',
68 default_order = '"member_id"'
69 }
71 Initiative:add_reference{
72 mode = 'mm',
73 to = "Member",
74 this_key = 'id',
75 that_key = 'id',
76 connected_by_table = '"initiator"',
77 connected_by_this_key = 'initiative_id',
78 connected_by_that_key = 'member_id',
79 ref = 'initiating_members'
80 }
82 Initiative:add_reference{
83 mode = 'mm',
84 to = "Member",
85 this_key = 'id',
86 that_key = 'id',
87 connected_by_table = '"supporter"',
88 connected_by_this_key = 'initiative_id',
89 connected_by_that_key = 'member_id',
90 ref = 'supporting_members'
91 }
93 Initiative:add_reference{
94 mode = 'mm',
95 to = "Member",
96 this_key = 'id',
97 that_key = 'id',
98 connected_by_table = 'direct_supporter_snapshot',
99 connected_by_this_key = 'initiative_id',
100 connected_by_that_key = 'member_id',
101 ref = 'supporting_members_snapshot'
102 }
105 function Initiative:get_search_selector(search_string)
106 return self:new_selector()
107 :join("draft", nil, "draft.initiative_id = initiative.id")
108 :add_field( {'"highlight"("initiative"."name", ?)', search_string }, "name_highlighted")
109 :add_where{ '"initiative"."text_search_data" @@ "text_search_query"(?) OR "draft"."text_search_data" @@ "text_search_query"(?)', search_string, search_string }
110 :add_group_by('"initiative"."id"')
111 :add_group_by('"initiative"."issue_id"')
112 :add_group_by('"initiative"."name"')
113 :add_group_by('"initiative"."discussion_url"')
114 :add_group_by('"initiative"."created"')
115 :add_group_by('"initiative"."revoked"')
116 :add_group_by('"initiative"."admitted"')
117 :add_group_by('"initiative"."supporter_count"')
118 :add_group_by('"initiative"."informed_supporter_count"')
119 :add_group_by('"initiative"."satisfied_supporter_count"')
120 :add_group_by('"initiative"."satisfied_informed_supporter_count"')
121 :add_group_by('"initiative"."positive_votes"')
122 :add_group_by('"initiative"."negative_votes"')
123 :add_group_by('"initiative"."agreed"')
124 :add_group_by('"initiative"."rank"')
125 :add_group_by('"initiative"."text_search_data"')
126 :add_group_by('"issue"."population"')
127 end
129 function Member:get_search_selector(search_string)
130 return self:new_selector()
131 :add_where("active")
132 end
135 function Initiative.object_get:current_draft()
136 return Draft:new_selector()
137 :add_where{ '"initiative_id" = ?', self.id }
138 :add_order_by('"id" DESC')
139 :single_object_mode()
140 :exec()
141 end
143 function Initiative.object_get:shortened_name()
144 local name = self.name
145 if #name > 100 then
146 name = name:sub(1,100) .. "..."
147 end
148 return name
149 end

Impressum / About Us