liquid_feedback_frontend

annotate app/main/initiative/_action/add_support.lua @ 2:5c601807d397

Version alpha3

Dark green part of issue supporter bargraph represents all satisfied supporters, regardless of having seen the latest draft

Wiki formatting for drafts

Showing differences between two drafts of the same initiative

Display of outgoing delegation chains

Many other improvements
author bsw
date Mon Nov 23 12:00:00 2009 +0100 (2009-11-23)
parents 3bfb2fcf7ab9
children afd9f769c7ae
rev   line source
bsw/jbe@0 1 local initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec()
bsw/jbe@0 2
bsw/jbe@0 3 local member = app.session.member
bsw/jbe@0 4
bsw/jbe@0 5 local supporter = Supporter:by_pk(initiative.id, member.id)
bsw/jbe@0 6
bsw/jbe@0 7 local last_draft = Draft:new_selector()
bsw/jbe@0 8 :add_where{ "initiative_id = ?", initiative.id }
bsw/jbe@0 9 :add_order_by("id DESC")
bsw/jbe@0 10 :limit(1)
bsw/jbe@0 11 :single_object_mode()
bsw/jbe@0 12 :exec()
bsw/jbe@0 13
bsw/jbe@0 14 if not supporter then
bsw/jbe@0 15 supporter = Supporter:new()
bsw/jbe@0 16 supporter.member_id = member.id
bsw/jbe@0 17 supporter.initiative_id = initiative.id
bsw/jbe@0 18 supporter.draft_id = last_draft.id
bsw/jbe@0 19 supporter:save()
bsw/jbe@0 20 slot.put_into("notice", _"Your support has been added to this initiative")
bsw/jbe@0 21 elseif supporter.draft_id ~= last_draft.id then
bsw/jbe@0 22 supporter.draft_id = last_draft.id
bsw/jbe@0 23 supporter:save()
bsw/jbe@0 24 slot.put_into("notice", _"Your support has been updated to the latest draft")
bsw/jbe@0 25 else
bsw/jbe@0 26 slot.put_into("notice", _"You are already supporting the latest draft")
bsw/jbe@0 27 end

Impressum / About Us