liquid_feedback_frontend

view app/main/opinion/_action/update.lua @ 0:3bfb2fcf7ab9

Version alpha1
author bsw/jbe
date Wed Nov 18 12:00:00 2009 +0100 (2009-11-18)
parents
children 768faea1096d
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 if opinion and param.get("delete") then
8 opinion:destroy()
9 slot.put_into("notice", _"Your opinion has been updated")
10 return
11 end
13 if not opinion then
14 opinion = Opinion:new()
15 opinion.member_id = member_id
16 opinion.suggestion_id = suggestion_id
17 opinion.fulfilled = false
18 end
20 local degree = param.get("degree", atom.number)
21 local fulfilled = param.get("fulfilled", atom.boolean)
23 if degree ~= nil then
24 opinion.degree = degree
25 end
27 if fulfilled ~= nil then
28 opinion.fulfilled = fulfilled
29 end
31 opinion:save()
33 slot.put_into("notice", _"Your opinion has been updated")

Impressum / About Us