liquid_feedback_frontend

diff app/main/delegation/_show_box.lua @ 5:afd9f769c7ae

Version beta1

Final voting with Schulze-Method is now possible

Many bug fixes and code cleanup

Registration with invite codes

More sort and filter options

Seperated display of "supporters" and "potential supporters"

Optical changes

Flood limit / initiative contigent is now checked by frontend

Neccessary changes to access core beta11
author bsw/jbe
date Fri Dec 25 12:00:00 2009 +0100 (2009-12-25)
parents 80c215dbf076
children 00d1004545f1
line diff
     1.1 --- a/app/main/delegation/_show_box.lua	Thu Dec 10 12:00:00 2009 +0100
     1.2 +++ b/app/main/delegation/_show_box.lua	Fri Dec 25 12:00:00 2009 +0100
     1.3 @@ -1,48 +1,47 @@
     1.4  slot.select("actions", function()
     1.5  
     1.6 -  ui.container{
     1.7 -    attr = { class = "delegation vote_info"},
     1.8 -    content = function()
     1.9 -    
    1.10 -      local delegation
    1.11 -      local area_id
    1.12 -      local issue_id
    1.13 -    
    1.14 -      local scope = "global"
    1.15 -    
    1.16 -      if param.get("initiative_id", atom.integer) then
    1.17 -        issue_id = Initiative:by_id(param.get("initiative_id", atom.integer)).issue_id
    1.18 -        scope = "issue"
    1.19 -      end
    1.20 -    
    1.21 -      if param.get("issue_id", atom.integer) then
    1.22 -        issue_id = param.get("issue_id", atom.integer)
    1.23 -        scope = "issue"
    1.24 -      end
    1.25 -    
    1.26 -      if param.get("area_id", atom.integer) then
    1.27 -        area_id = param.get("area_id", atom.integer)
    1.28 -        scope = "area"
    1.29 -      end
    1.30 -    
    1.31 -    
    1.32 -    
    1.33 -      local delegation
    1.34 -    
    1.35 -      if issue_id then
    1.36 -        delegation = Delegation:by_pk(app.session.member.id, nil, issue_id)
    1.37 -        if not delegation then
    1.38 -          local issue = Issue:by_id(issue_id)
    1.39 -          delegation = Delegation:by_pk(app.session.member.id, issue.area_id)
    1.40 -        end
    1.41 -      elseif area_id then
    1.42 -        delegation = Delegation:by_pk(app.session.member.id, area_id)
    1.43 -      end
    1.44 -    
    1.45 -      if not delegation then
    1.46 -        delegation = Delegation:by_pk(app.session.member.id)
    1.47 -      end
    1.48 -      if delegation then
    1.49 +  local delegation
    1.50 +  local area_id
    1.51 +  local issue_id
    1.52 +
    1.53 +  local scope = "global"
    1.54 +
    1.55 +  if param.get("initiative_id", atom.integer) then
    1.56 +    issue_id = Initiative:by_id(param.get("initiative_id", atom.integer)).issue_id
    1.57 +    scope = "issue"
    1.58 +  end
    1.59 +
    1.60 +  if param.get("issue_id", atom.integer) then
    1.61 +    issue_id = param.get("issue_id", atom.integer)
    1.62 +    scope = "issue"
    1.63 +  end
    1.64 +
    1.65 +  if param.get("area_id", atom.integer) then
    1.66 +    area_id = param.get("area_id", atom.integer)
    1.67 +    scope = "area"
    1.68 +  end
    1.69 +
    1.70 +
    1.71 +
    1.72 +  local delegation
    1.73 +  local issue
    1.74 +  if issue_id then
    1.75 +    issue = Issue:by_id(issue_id)
    1.76 +    delegation = Delegation:by_pk(app.session.member.id, nil, issue_id)
    1.77 +    if not delegation then
    1.78 +      delegation = Delegation:by_pk(app.session.member.id, issue.area_id)
    1.79 +    end
    1.80 +  elseif area_id then
    1.81 +    delegation = Delegation:by_pk(app.session.member.id, area_id)
    1.82 +  end
    1.83 +
    1.84 +  if not delegation then
    1.85 +    delegation = Delegation:by_pk(app.session.member.id)
    1.86 +  end
    1.87 +  if delegation then
    1.88 +    ui.container{
    1.89 +      attr = { class = "delegation vote_info"},
    1.90 +      content = function()
    1.91          ui.container{
    1.92            attr = {
    1.93              title = _"Click for details",
    1.94 @@ -117,25 +116,27 @@
    1.95                        end
    1.96                      }
    1.97                      if i == 2 then
    1.98 -                      ui.link{
    1.99 -                        attr = { class = "revoke" },
   1.100 -                        content = function()
   1.101 -                          ui.image{ static = "icons/16/delete.png" }
   1.102 -                          slot.put(_"Revoke")
   1.103 -                        end,
   1.104 -                        module = "delegation",
   1.105 -                        action = "update",
   1.106 -                        params = { issue_id = delegation.issue_id, area_id = delegation.area_id, delete = true },
   1.107 -                        routing = {
   1.108 -                          default = {
   1.109 -                            mode = "redirect",
   1.110 -                            module = request.get_module(),
   1.111 -                            view = request.get_view(),
   1.112 -                            id = param.get_id_cgi(),
   1.113 -                            params = param.get_all_cgi()
   1.114 +                      if not issue or (issue.state ~= "finished" and issue.state ~= "cancelled") then
   1.115 +                        ui.link{
   1.116 +                          attr = { class = "revoke" },
   1.117 +                          content = function()
   1.118 +                            ui.image{ static = "icons/16/delete.png" }
   1.119 +                            slot.put(_"Revoke")
   1.120 +                          end,
   1.121 +                          module = "delegation",
   1.122 +                          action = "update",
   1.123 +                          params = { issue_id = delegation.issue_id, area_id = delegation.area_id, delete = true },
   1.124 +                          routing = {
   1.125 +                            default = {
   1.126 +                              mode = "redirect",
   1.127 +                              module = request.get_module(),
   1.128 +                              view = request.get_view(),
   1.129 +                              id = param.get_id_cgi(),
   1.130 +                              params = param.get_all_cgi()
   1.131 +                            }
   1.132                            }
   1.133                          }
   1.134 -                      }
   1.135 +                      end
   1.136                      end
   1.137                    end
   1.138                  }
   1.139 @@ -163,30 +164,39 @@
   1.140            end
   1.141          }
   1.142        end
   1.143 -      ui.link{
   1.144 -        content = function()
   1.145 +    }
   1.146 +
   1.147 +
   1.148 +  end
   1.149 +  ui.link{
   1.150 +    content = function()
   1.151 +      if scope == "global" and delegation then
   1.152 +        ui.image{ static = "icons/16/table_go.png" }
   1.153 +        slot.put(_"Change global delegation")
   1.154 +      elseif scope == "global" and not delegation then
   1.155 +        ui.image{ static = "icons/16/table_go.png" }
   1.156 +        slot.put(_"Set global delegation")
   1.157 +      elseif scope == "area" and delegation and delegation.area_id then
   1.158 +        ui.image{ static = "icons/16/table_go.png" }
   1.159 +        slot.put(_"Change area delegation")
   1.160 +      elseif scope == "area" and not (delegation and delegation.area_id) then
   1.161 +        ui.image{ static = "icons/16/table_go.png" }
   1.162 +        slot.put(_"Set area delegation")
   1.163 +      elseif scope == "issue" then
   1.164 +        if delegation and delegation.issue_id then
   1.165            ui.image{ static = "icons/16/table_go.png" }
   1.166 -          if scope == "global" and delegation then
   1.167 -            slot.put(_"Change global delegation")
   1.168 -          elseif scope == "global" and not delegation then
   1.169 -            slot.put(_"Set global delegation")
   1.170 -          elseif scope == "area" and delegation and delegation.area_id then
   1.171 -            slot.put(_"Change area delegation")
   1.172 -          elseif scope == "area" and not (delegation and delegation.area_id) then
   1.173 -            slot.put(_"Set area delegation")
   1.174 -          elseif scope == "issue" and delegation and delegation.issue_id then
   1.175 -            slot.put(_"Change issue delegation")
   1.176 -          elseif scope == "issue" and not (delegation and delegation.issue_id) then
   1.177 -            slot.put(_"Set issue delegation")
   1.178 -          end
   1.179 -        end,
   1.180 -        module = "delegation",
   1.181 -        view = "new",
   1.182 -        params = {
   1.183 -          area_id = area_id,
   1.184 -          issue_id = issue_id 
   1.185 -        }
   1.186 -      }
   1.187 -    end
   1.188 +          slot.put(_"Change issue delegation")
   1.189 +        elseif issue.state ~= "finished" and issue.state ~= "cancelled" then
   1.190 +          ui.image{ static = "icons/16/table_go.png" }
   1.191 +          slot.put(_"Set issue delegation")
   1.192 +        end
   1.193 +      end
   1.194 +    end,
   1.195 +    module = "delegation",
   1.196 +    view = "new",
   1.197 +    params = {
   1.198 +      area_id = area_id,
   1.199 +      issue_id = issue_id 
   1.200 +    }
   1.201    }
   1.202  end)

Impressum / About Us