liquid_feedback_frontend

view app/main/opinion/_action/update.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 768faea1096d
children 8d91bccab0bf
line source
1 local member_id = app.session.member.id
3 local suggestion_id = param.get("suggestion_id", atom.integer)
5 local opinion = Opinion:by_pk(member_id, suggestion_id)
7 -- TODO important m1 selectors returning result _SET_!
8 local issue = opinion.initiative:get_reference_selector("issue"):for_share():single_object_mode():exec()
10 if issue.closed then
11 slot.put_into("error", _"This issue is already closed.")
12 return false
13 elseif issue.fully_frozen then
14 slot.put_into("error", _"Voting for this issue has already begun.")
15 return false
16 end
20 if param.get("delete") then
21 if opinion then
22 opinion:destroy()
23 end
24 slot.put_into("notice", _"Your opinion has been deleted")
25 return
26 end
28 if not opinion then
29 opinion = Opinion:new()
30 opinion.member_id = member_id
31 opinion.suggestion_id = suggestion_id
32 opinion.fulfilled = false
33 end
35 local degree = param.get("degree", atom.number)
36 local fulfilled = param.get("fulfilled", atom.boolean)
38 if degree ~= nil then
39 opinion.degree = degree
40 end
42 if fulfilled ~= nil then
43 opinion.fulfilled = fulfilled
44 end
46 opinion:save()
48 slot.put_into("notice", _"Your opinion has been updated")

Impressum / About Us