liquid_feedback_frontend

diff app/main/vote/_action/update.lua @ 519:7492497005bd

Fixed voting for non javascript capable browser, removed browser warning
author bsw
date Mon Apr 16 23:27:07 2012 +0200 (2012-04-16)
parents b77e6a17ca77
children 75a95999a410
line diff
     1.1 --- a/app/main/vote/_action/update.lua	Sun Apr 15 18:26:06 2012 +0200
     1.2 +++ b/app/main/vote/_action/update.lua	Mon Apr 16 23:27:07 2012 +0200
     1.3 @@ -15,9 +15,22 @@
     1.4  end
     1.5  
     1.6  
     1.7 +local move_up 
     1.8 +local move_down
     1.9  
    1.10 -local move_up = param.get("move_up", atom.integer)
    1.11 -local move_down = param.get("move_down", atom.integer)
    1.12 +local tempvoting_string = param.get("scoring")
    1.13 +
    1.14 +local tempvotings = {}
    1.15 +for match in tempvoting_string:gmatch("([^;]+)") do
    1.16 +  for initiative_id, grade in match:gmatch("([^:;]+):([^:;]+)") do
    1.17 +    tempvotings[tonumber(initiative_id)] = tonumber(grade)
    1.18 +    if param.get("move_up_" .. initiative_id .. ".x", atom.integer) then
    1.19 +      move_up = tonumber(initiative_id)
    1.20 +    elseif param.get("move_down_" .. initiative_id .. ".x", atom.integer) then
    1.21 +      move_down = tonumber(initiative_id)
    1.22 +    end
    1.23 +  end
    1.24 +end
    1.25  
    1.26  if not move_down and not move_up then
    1.27    local direct_voter = DirectVoter:by_pk(issue.id, app.session.member_id)
    1.28 @@ -60,15 +73,6 @@
    1.29  
    1.30  else
    1.31  
    1.32 -  local tempvoting_string = param.get("scoring")
    1.33 -
    1.34 -  local tempvotings = {}
    1.35 -  for match in tempvoting_string:gmatch("([^;]+)") do
    1.36 -    for initiative_id, grade in match:gmatch("([^:;]+):([^:;]+)") do
    1.37 -      tempvotings[tonumber(initiative_id)] = tonumber(grade)
    1.38 -    end
    1.39 -  end
    1.40 -
    1.41    local current_initiative_id = move_up or move_down
    1.42  
    1.43    local current_grade = tempvotings[current_initiative_id] or 0

Impressum / About Us