liquid_feedback_frontend

diff app/main/initiative/_action/add_support.lua @ 148:034f96181e59

gui part for autosupport

autosupport lets you automaticly support any new draft of an initiative
author Daniel Poelzleithner <poelzi@poelzi.org>
date Fri Oct 08 02:49:53 2010 +0200 (2010-10-08)
parents 72c5e0ee7c98
children 6d30e49ad609
line diff
     1.1 --- a/app/main/initiative/_action/add_support.lua	Thu Oct 07 04:45:06 2010 +0200
     1.2 +++ b/app/main/initiative/_action/add_support.lua	Fri Oct 08 02:49:53 2010 +0200
     1.3 @@ -1,4 +1,5 @@
     1.4  local initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec()
     1.5 +local auto_support = param.get("auto_support", atom.boolean)
     1.6  
     1.7  -- TODO important m1 selectors returning result _SET_!
     1.8  local issue = initiative:get_reference_selector("issue"):for_share():single_object_mode():exec()
     1.9 @@ -32,12 +33,26 @@
    1.10    supporter.member_id = member.id
    1.11    supporter.initiative_id = initiative.id
    1.12    supporter.draft_id = last_draft.id
    1.13 +  supporter.auto_support = auto_support
    1.14    supporter:save()
    1.15    slot.put_into("notice", _"Your support has been added to this initiative")
    1.16 +  if supporter.auto_active then
    1.17 +    slot.put_into("notice", _"Auto support is now enabled")
    1.18 +  end
    1.19 +elseif (auto_support ~= nil and supporter.auto_support ~= auto_support) and config.auto_support then
    1.20 +  supporter.auto_support = auto_support
    1.21 +  if auto_support then
    1.22 +    slot.put_into("notice", _"Auto support is now enabled")
    1.23 +  else
    1.24 +    slot.put_into("notice", _"Auto support is now disabled")
    1.25 +  end
    1.26 +  supporter.draft_id = last_draft.id
    1.27 +  supporter:save()
    1.28  elseif supporter.draft_id ~= last_draft.id then
    1.29    supporter.draft_id = last_draft.id
    1.30    supporter:save()
    1.31    slot.put_into("notice", _"Your support has been updated to the latest draft")
    1.32  else
    1.33    slot.put_into("notice", _"You are already supporting the latest draft")
    1.34 -end
    1.35 \ No newline at end of file
    1.36 +end
    1.37 +

Impressum / About Us