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