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