liquid_feedback_frontend

diff app/main/vote/_action/non_voter.lua @ 886:2e9d39b53b64

Added support for setting/removing of beeing a non voter
author bsw
date Mon Aug 20 02:39:13 2012 +0200 (2012-08-20)
parents
children 941941955c0e
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/vote/_action/non_voter.lua	Mon Aug 20 02:39:13 2012 +0200
     1.3 @@ -0,0 +1,21 @@
     1.4 +local issue = Issue:new_selector():add_where{ "id = ?", param.get("issue_id", atom.integer) }:for_share():single_object_mode():exec()
     1.5 +
     1.6 +local direct_voter = DirectVoter:by_pk(issue.id, app.session.member_id)
     1.7 +
     1.8 +if direct_voter then
     1.9 +  slot.select("error", function()
    1.10 +    ui.tag{ content = _"You already voted this issue" }
    1.11 +  end )
    1.12 +  return false
    1.13 +end
    1.14 +
    1.15 +local non_voter = NonVoter:by_pk(issue.id, app.session.member_id)
    1.16 +
    1.17 +if non_voter and param.get("delete", atom.boolean) then
    1.18 +  non_voter:destroy()
    1.19 +elseif not non_voter then
    1.20 +  non_voter = NonVoter:new()
    1.21 +  non_voter.issue_id = issue.id
    1.22 +  non_voter.member_id = app.session.member_id
    1.23 +  non_voter:save()
    1.24 +end
    1.25 \ No newline at end of file

Impressum / About Us