liquid_feedback_frontend

changeset 529:5ca9de94cb13

Delegation preview when setting delegation, optical enhancements, typos fixed
author bsw
date Sun May 20 19:43:01 2012 +0200 (2012-05-20)
parents 305329da1c75
children c92e2f2dcc2e
files app/main/area/_head.lua app/main/area/show.lua app/main/delegation/_action/update.lua app/main/delegation/_info.lua app/main/delegation/show.lua app/main/interest/_show_box.lua app/main/issue/_show.lua app/main/member/_show_thumb.lua app/main/member/show.lua app/main/supporter/_show_box.lua app/main/unit/_head.lua app/main/unit/show.lua config/default.lua model/area.lua model/issue.lua model/member.lua model/unit.lua static/js/update_delegation_info.js static/style.css
line diff
     1.1 --- a/app/main/area/_head.lua	Fri May 18 21:03:10 2012 +0200
     1.2 +++ b/app/main/area/_head.lua	Sun May 20 19:43:01 2012 +0200
     1.3 @@ -1,5 +1,9 @@
     1.4  local area = param.get("area", "table")
     1.5  
     1.6 +local show_content = param.get("show_content", atom.boolean)
     1.7 +
     1.8 +area:load_delegation_info_once_for_member_id(app.session.member_id)
     1.9 +
    1.10  execute.view{ module = "unit", view = "_head", params = { unit = area.unit } }
    1.11  
    1.12  ui.container{ attr = { class = "area_head" }, content = function()
    1.13 @@ -14,27 +18,49 @@
    1.14      }
    1.15    end }
    1.16    
    1.17 -  ui.container{ attr = { class = "content" }, content = function()
    1.18 +  if show_content then
    1.19 +    
    1.20 +    ui.container{ attr = { class = "content" }, content = function()
    1.21  
    1.22 -    -- actions (members with appropriate voting right only)
    1.23 -    if app.session.member_id then
    1.24 +      -- actions (members with appropriate voting right only)
    1.25 +      if app.session.member_id then
    1.26  
    1.27 -      -- membership
    1.28 -      local membership = Membership:by_pk(area.id, app.session.member.id)
    1.29 +        -- membership
    1.30 +        local membership = Membership:by_pk(area.id, app.session.member.id)
    1.31  
    1.32 -      if membership then
    1.33 -        
    1.34 -        ui.tag{ content = _"You are participating in this area" }
    1.35 -        
    1.36 -        slot.put(" ")
    1.37 -        
    1.38 -        ui.tag{ content = function()
    1.39 -          slot.put("(")
    1.40 +        if membership then
    1.41 +          
    1.42 +          ui.tag{ content = _"You are participating in this area" }
    1.43 +          
    1.44 +          slot.put(" ")
    1.45 +          
    1.46 +          ui.tag{ content = function()
    1.47 +            slot.put("(")
    1.48 +            ui.link{
    1.49 +              text    = _"Withdraw",
    1.50 +              module  = "membership",
    1.51 +              action  = "update",
    1.52 +              params  = { area_id = area.id, delete = true },
    1.53 +              routing = {
    1.54 +                default = {
    1.55 +                  mode = "redirect",
    1.56 +                  module = request.get_module(),
    1.57 +                  view = request.get_view(),
    1.58 +                  id = param.get_id_cgi(),
    1.59 +                  params = param.get_all_cgi()
    1.60 +                }
    1.61 +              }
    1.62 +            }
    1.63 +            slot.put(")")
    1.64 +          end }
    1.65 +          
    1.66 +
    1.67 +        elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    1.68            ui.link{
    1.69 -            text    = _"Withdraw",
    1.70 -            module  = "membership",
    1.71 -            action  = "update",
    1.72 -            params  = { area_id = area.id, delete = true },
    1.73 +            text   = _"Participate in this area",
    1.74 +            module = "membership",
    1.75 +            action = "update",
    1.76 +            params = { area_id = area.id },
    1.77              routing = {
    1.78                default = {
    1.79                  mode = "redirect",
    1.80 @@ -45,46 +71,35 @@
    1.81                }
    1.82              }
    1.83            }
    1.84 -          slot.put(")")
    1.85 -        end }
    1.86 -        
    1.87 +
    1.88 +        end
    1.89 +
    1.90 +        slot.put(" · ")
    1.91 +        if area.delegation_info.own_delegation_scope ~= "area" then
    1.92 +          ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } }
    1.93 +        else
    1.94 +          ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } }
    1.95 +        end
    1.96          slot.put(" · ")
    1.97  
    1.98 -      elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    1.99 -        ui.link{
   1.100 -          text   = _"Participate in this area",
   1.101 -          module = "membership",
   1.102 -          action = "update",
   1.103 -          params = { area_id = area.id },
   1.104 -          routing = {
   1.105 -            default = {
   1.106 -              mode = "redirect",
   1.107 -              module = request.get_module(),
   1.108 -              view = request.get_view(),
   1.109 -              id = param.get_id_cgi(),
   1.110 -              params = param.get_all_cgi()
   1.111 -            }
   1.112 +        -- create new issue
   1.113 +        if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
   1.114 +          ui.link{
   1.115 +            content = function()
   1.116 +              slot.put(_"Create new issue")
   1.117 +            end,
   1.118 +            module = "initiative",
   1.119 +            view = "new",
   1.120 +            params = { area_id = area.id }
   1.121            }
   1.122 -        }
   1.123 -
   1.124 -        slot.put(" · ")
   1.125 +        end
   1.126  
   1.127        end
   1.128  
   1.129 -      -- create new issue
   1.130 -      if app.session.member:has_voting_right_for_unit_id(area.unit_id) then
   1.131 -        ui.link{
   1.132 -          content = function()
   1.133 -            slot.put(_"Create new issue")
   1.134 -          end,
   1.135 -          module = "initiative",
   1.136 -          view = "new",
   1.137 -          params = { area_id = area.id }
   1.138 -        }
   1.139 -      end
   1.140 +    end }
   1.141  
   1.142 -    end
   1.143 +  else
   1.144 +    slot.put("<br />")
   1.145 +  end
   1.146  
   1.147 -  end }
   1.148 -  
   1.149  end }
   1.150 \ No newline at end of file
     2.1 --- a/app/main/area/show.lua	Fri May 18 21:03:10 2012 +0200
     2.2 +++ b/app/main/area/show.lua	Sun May 20 19:43:01 2012 +0200
     2.3 @@ -14,7 +14,7 @@
     2.4  
     2.5  
     2.6  slot.select("head", function()
     2.7 -  execute.view{ module = "area", view = "_head", params = { area = area } }
     2.8 +  execute.view{ module = "area", view = "_head", params = { area = area, show_content = true } }
     2.9  end)
    2.10  
    2.11  ui.container{
     3.1 --- a/app/main/delegation/_action/update.lua	Fri May 18 21:03:10 2012 +0200
     3.2 +++ b/app/main/delegation/_action/update.lua	Sun May 20 19:43:01 2012 +0200
     3.3 @@ -12,24 +12,23 @@
     3.4    area_id = nil
     3.5  end
     3.6  
     3.7 +local preview = param.get("preview") 
     3.8 +
     3.9 +if preview == "1" then
    3.10 +  request.redirect{ module = "delegation", view = "show", params = {
    3.11 +    unit_id = unit_id, area_id = area_id, issue_id = issue_id, preview_trustee_id = trustee_id
    3.12 +  } }
    3.13 +  return
    3.14 +end
    3.15 +
    3.16 +
    3.17  local delegation = Delegation:by_pk(truster_id, unit_id, area_id, issue_id)
    3.18  
    3.19  
    3.20  if param.get("delete") or trustee_id == -1 then
    3.21  
    3.22    if delegation then
    3.23 -
    3.24      delegation:destroy()
    3.25 -
    3.26 ---[[
    3.27 -    if issue_id then
    3.28 -      slot.put_into("notice", _"Your delegation for this issue has been deleted.")
    3.29 -    elseif area_id then
    3.30 -      slot.put_into("notice", _"Your delegation for this area has been deleted.")
    3.31 -    else
    3.32 -      slot.put_into("notice", _"Your delegation for this unit has been deleted.")
    3.33 -    end
    3.34 ---]]
    3.35    end
    3.36  
    3.37  else
    3.38 @@ -82,14 +81,6 @@
    3.39    end
    3.40  
    3.41    delegation:save()
    3.42 ---[[
    3.43 -  if issue_id then
    3.44 -    slot.put_into("notice", _"Your delegation for this issue has been updated.")
    3.45 -  elseif area_id then
    3.46 -    slot.put_into("notice", _"Your delegation for this area has been updated.")
    3.47 -  else
    3.48 -    slot.put_into("notice", _"Your delegation for this unit has been updated.")
    3.49 -  end
    3.50 ---]]
    3.51 +
    3.52  end
    3.53  
     4.1 --- a/app/main/delegation/_info.lua	Fri May 18 21:03:10 2012 +0200
     4.2 +++ b/app/main/delegation/_info.lua	Sun May 20 19:43:01 2012 +0200
     4.3 @@ -14,7 +14,6 @@
     4.4  local delegation_text
     4.5  
     4.6  if unit then
     4.7 -  unit:load_delegation_info_once_for_member_id(app.session.member_id)
     4.8    info = unit.delegation_info
     4.9    delegation_text = _"Delegate unit"
    4.10  end
    4.11 @@ -31,136 +30,107 @@
    4.12    delegation_text = _"Delegate issue"
    4.13  end
    4.14  
    4.15 -ui.link{
    4.16 -  module = "delegation", view = "show", params = {
    4.17 -    unit_id = unit_id,
    4.18 -    area_id = area_id,
    4.19 -    issue_id = issue_id
    4.20 -  },
    4.21 -  attr = { class = "delegation_info" }, content = function()
    4.22 -    
    4.23 +if info.own_participation or info.first_trustee_id then
    4.24  
    4.25 -    local participant_occured = false
    4.26 -    
    4.27 -    if info.own_participation or info.first_trustee_id then
    4.28 -      
    4.29 -      local class = "micro_avatar"
    4.30 -      if info.own_participation then
    4.31 -        participant_occured = true
    4.32 -        class = class .. " highlighted"
    4.33 -      end
    4.34 +  ui.link{
    4.35 +    module = "delegation", view = "show", params = {
    4.36 +      unit_id = unit_id,
    4.37 +      area_id = area_id,
    4.38 +      issue_id = issue_id
    4.39 +    },
    4.40 +    attr = { class = "delegation_info" }, content = function()
    4.41        
    4.42 -      execute.view{ module = "member_image", view = "_show", params = {
    4.43 -        member = app.session.member, class = class, popup_text = app.session.member.name,
    4.44 -        image_type = "avatar", show_dummy = true,
    4.45 -      } }
    4.46  
    4.47 -    end
    4.48 -
    4.49 -    if not info.first_trustee_id and (not issue or not issue.closed) then
    4.50 -      slot.put(" ")
    4.51 -      ui.tag{ attr = { class = "link" }, content = delegation_text }
    4.52 -    end
    4.53 -
    4.54 -    if not (issue and issue.state == "voting" and info.own_participation) then
    4.55 +      local participant_occured = false
    4.56        
    4.57 -      if info.first_trustee_id then
    4.58 -      
    4.59 -        local text = _"delegates to"
    4.60 -        ui.image{
    4.61 -          attr = { class = "delegation_arrow", alt = text, title = text },
    4.62 -          static = "delegation_arrow_24_horizontal.png"
    4.63 -        }
    4.64 -
    4.65 +      if info.own_participation or info.first_trustee_id then
    4.66 +        
    4.67          local class = "micro_avatar"
    4.68 -        if not participant_occured and info.first_trustee_participation then
    4.69 +        if info.own_participation then
    4.70            participant_occured = true
    4.71            class = class .. " highlighted"
    4.72          end
    4.73          
    4.74          execute.view{ module = "member_image", view = "_show", params = {
    4.75 -          member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
    4.76 -          image_type = "avatar", show_dummy = true,
    4.77 -        } }
    4.78 -
    4.79 -      end
    4.80 -            
    4.81 -      if info.first_trustee_ellipsis then
    4.82 -
    4.83 -        local text = _"delegates to"
    4.84 -        ui.image{
    4.85 -          attr = { class = "delegation_arrow", alt = text, title = text },
    4.86 -          static = "delegation_arrow_24_horizontal.png"
    4.87 -        }
    4.88 -
    4.89 -        slot.put("...")
    4.90 -        
    4.91 -      end
    4.92 -      
    4.93 -      if info.other_trustee_id then
    4.94 -      
    4.95 -        local text = _"delegates to"
    4.96 -        ui.image{
    4.97 -          attr = { class = "delegation_arrow", alt = text, title = text },
    4.98 -          static = "delegation_arrow_24_horizontal.png"
    4.99 -        }
   4.100 -
   4.101 -        local class = "micro_avatar"
   4.102 -        if not participant_occured and info.other_trustee_participation then
   4.103 -          participant_occured = true
   4.104 -          class = class .. " highlighted"
   4.105 -        end
   4.106 -        
   4.107 -        execute.view{ module = "member_image", view = "_show", params = {
   4.108 -          member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
   4.109 +          member = app.session.member, class = class, popup_text = app.session.member.name,
   4.110            image_type = "avatar", show_dummy = true,
   4.111          } }
   4.112  
   4.113        end
   4.114 -            
   4.115 -      if info.other_trustee_ellipsis then
   4.116  
   4.117 -        local text = _"delegates to"
   4.118 -        ui.image{
   4.119 -          attr = { class = "delegation_arrow", alt = text, title = text },
   4.120 -          static = "delegation_arrow_24_horizontal.png"
   4.121 -        }
   4.122 +      if not (issue and issue.state == "voting" and info.own_participation) then
   4.123 +        
   4.124 +        if info.first_trustee_id then
   4.125 +        
   4.126 +          local text = _"delegates to"
   4.127 +          ui.image{
   4.128 +            attr = { class = "delegation_arrow", alt = text, title = text },
   4.129 +            static = "delegation_arrow_24_horizontal.png"
   4.130 +          }
   4.131  
   4.132 -        slot.put("...")
   4.133 -        
   4.134 -      end
   4.135 -      
   4.136 -      local trailing_ellipsis = info.other_trustee_ellipsis or
   4.137 -        (info.first_trustee_ellipsis and not info.other_trustee_id)
   4.138 -      
   4.139 -      if info.delegation_loop == "own" then
   4.140 +          local class = "micro_avatar"
   4.141 +          if not participant_occured and info.first_trustee_participation then
   4.142 +            participant_occured = true
   4.143 +            class = class .. " highlighted"
   4.144 +          end
   4.145 +          
   4.146 +          execute.view{ module = "member_image", view = "_show", params = {
   4.147 +            member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
   4.148 +            image_type = "avatar", show_dummy = true,
   4.149 +          } }
   4.150 +
   4.151 +        end
   4.152 +              
   4.153 +        if info.first_trustee_ellipsis then
   4.154 +
   4.155 +          local text = _"delegates to"
   4.156 +          ui.image{
   4.157 +            attr = { class = "delegation_arrow", alt = text, title = text },
   4.158 +            static = "delegation_arrow_24_horizontal.png"
   4.159 +          }
   4.160 +
   4.161 +          slot.put("...")
   4.162 +          
   4.163 +        end
   4.164          
   4.165 -        local text = _"delegates to"
   4.166 -        ui.image{
   4.167 -          attr = { class = "delegation_arrow", alt = text, title = text },
   4.168 -          static = "delegation_arrow_24_horizontal.png"
   4.169 -        }
   4.170 +        if info.other_trustee_id then
   4.171 +        
   4.172 +          local text = _"delegates to"
   4.173 +          ui.image{
   4.174 +            attr = { class = "delegation_arrow", alt = text, title = text },
   4.175 +            static = "delegation_arrow_24_horizontal.png"
   4.176 +          }
   4.177  
   4.178 -        execute.view{ module = "member_image", view = "_show", params = {
   4.179 -          member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name,
   4.180 -          image_type = "avatar", show_dummy = true,
   4.181 -        } }
   4.182 +          local class = "micro_avatar"
   4.183 +          if not participant_occured and info.other_trustee_participation then
   4.184 +            participant_occured = true
   4.185 +            class = class .. " highlighted"
   4.186 +          end
   4.187 +          
   4.188 +          execute.view{ module = "member_image", view = "_show", params = {
   4.189 +            member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
   4.190 +            image_type = "avatar", show_dummy = true,
   4.191 +          } }
   4.192  
   4.193 -      elseif info.delegation_loop == "first" then
   4.194 -        if info.first_trustee_ellipsis then
   4.195 -          if not trailing_ellipsis then
   4.196 +        end
   4.197 +              
   4.198 +        if info.other_trustee_ellipsis then
   4.199 +
   4.200 +          local text = _"delegates to"
   4.201 +          ui.image{
   4.202 +            attr = { class = "delegation_arrow", alt = text, title = text },
   4.203 +            static = "delegation_arrow_24_horizontal.png"
   4.204 +          }
   4.205  
   4.206 -            local text = _"delegates to"
   4.207 -            ui.image{
   4.208 -              attr = { class = "delegation_arrow", alt = text, title = text },
   4.209 -              static = "delegation_arrow_24_horizontal.png"
   4.210 -            }
   4.211 -
   4.212 -            slot.put("...")
   4.213 -          end
   4.214 -            
   4.215 -        else
   4.216 -            
   4.217 +          slot.put("...")
   4.218 +          
   4.219 +        end
   4.220 +        
   4.221 +        local trailing_ellipsis = info.other_trustee_ellipsis or
   4.222 +          (info.first_trustee_ellipsis and not info.other_trustee_id)
   4.223 +        
   4.224 +        if info.delegation_loop == "own" then
   4.225 +          
   4.226            local text = _"delegates to"
   4.227            ui.image{
   4.228              attr = { class = "delegation_arrow", alt = text, title = text },
   4.229 @@ -168,25 +138,52 @@
   4.230            }
   4.231  
   4.232            execute.view{ module = "member_image", view = "_show", params = {
   4.233 -            member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
   4.234 +            member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name,
   4.235              image_type = "avatar", show_dummy = true,
   4.236            } }
   4.237 +
   4.238 +        elseif info.delegation_loop == "first" then
   4.239 +          if info.first_trustee_ellipsis then
   4.240 +            if not trailing_ellipsis then
   4.241 +
   4.242 +              local text = _"delegates to"
   4.243 +              ui.image{
   4.244 +                attr = { class = "delegation_arrow", alt = text, title = text },
   4.245 +                static = "delegation_arrow_24_horizontal.png"
   4.246 +              }
   4.247 +
   4.248 +              slot.put("...")
   4.249 +            end
   4.250 +              
   4.251 +          else
   4.252 +              
   4.253 +            local text = _"delegates to"
   4.254 +            ui.image{
   4.255 +              attr = { class = "delegation_arrow", alt = text, title = text },
   4.256 +              static = "delegation_arrow_24_horizontal.png"
   4.257 +            }
   4.258 +
   4.259 +            execute.view{ module = "member_image", view = "_show", params = {
   4.260 +              member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
   4.261 +              image_type = "avatar", show_dummy = true,
   4.262 +            } }
   4.263 +          end
   4.264 +        
   4.265 +            
   4.266 +        elseif info.delegation_loop and not trailing_ellipsis then
   4.267 +          local text = _"delegates to"
   4.268 +          ui.image{
   4.269 +            attr = { class = "delegation_arrow", alt = text, title = text },
   4.270 +            static = "delegation_arrow_24_horizontal.png"
   4.271 +          }
   4.272 +
   4.273 +          slot.put("...")
   4.274          end
   4.275 -      
   4.276 -          
   4.277 -      elseif info.delegation_loop and not trailing_ellipsis then
   4.278 -        local text = _"delegates to"
   4.279 -        ui.image{
   4.280 -          attr = { class = "delegation_arrow", alt = text, title = text },
   4.281 -          static = "delegation_arrow_24_horizontal.png"
   4.282 -        }
   4.283  
   4.284 -        slot.put("...")
   4.285        end
   4.286  
   4.287      end
   4.288 +        
   4.289 +  }
   4.290  
   4.291 -  end
   4.292 -      
   4.293 -}
   4.294 -
   4.295 +end
   4.296 \ No newline at end of file
     5.1 --- a/app/main/delegation/show.lua	Fri May 18 21:03:10 2012 +0200
     5.2 +++ b/app/main/delegation/show.lua	Sun May 20 19:43:01 2012 +0200
     5.3 @@ -1,14 +1,22 @@
     5.4  local voting_right_unit_id
     5.5 +local current_trustee_id
     5.6 +local current_trustee_name
     5.7  
     5.8  local unit = Unit:by_id(param.get("unit_id", atom.integer))
     5.9  if unit then
    5.10 +  unit:load_delegation_info_once_for_member_id(app.session.member_id)
    5.11    voting_right_unit_id = unit.id
    5.12 +  if unit.delegation_info.own_delegation_scope == 'unit' then
    5.13 +    current_trustee_id = unit.delegation_info.first_trustee_id
    5.14 +    current_trustee_name = unit.delegation_info.first_trustee_name
    5.15 +  end
    5.16    slot.put_into("title", encode.html(config.single_unit_id and _"Set global delegation" or _"Set unit delegation"))
    5.17    util.help("delegation.new.unit")
    5.18  end
    5.19  
    5.20  local area = Area:by_id(param.get("area_id", atom.integer))
    5.21  if area then
    5.22 +  area:load_delegation_info_once_for_member_id(app.session.member_id)
    5.23    voting_right_unit_id = area.unit_id
    5.24    slot.put_into("title", encode.html(_"Set delegation for Area '#{name}'":gsub("#{name}", area.name)))
    5.25    util.help("delegation.new.area")
    5.26 @@ -16,6 +24,7 @@
    5.27  
    5.28  local issue = Issue:by_id(param.get("issue_id", atom.integer))
    5.29  if issue then
    5.30 +  issue:load_delegation_info_once_for_member_id(app.session.member_id)
    5.31    voting_right_unit_id = issue.area.unit_id
    5.32    slot.put_into("title", encode.html(_"Set delegation for Issue ##{number} in Area '#{area_name}'":gsub("#{number}", issue.id):gsub("#{area_name}", issue.area.name)))
    5.33    util.help("delegation.new.issue")
    5.34 @@ -23,6 +32,17 @@
    5.35  
    5.36  local initiative = Initiative:by_id(param.get("initiative_id", atom.integer))
    5.37  
    5.38 +local contact_members = Member:build_selector{
    5.39 +  is_contact_of_member_id = app.session.member_id,
    5.40 +  voting_right_for_unit_id = voting_right_unit_id,
    5.41 +  active = true,
    5.42 +  order = "name"
    5.43 +}:exec()
    5.44 +
    5.45 +local preview_trustee_id = param.get("preview_trustee_id", atom.integer)
    5.46 +
    5.47 +ui.script{ static = "js/update_delegation_info.js" }
    5.48 +
    5.49  slot.select("actions", function()
    5.50    if issue then
    5.51      ui.link{
    5.52 @@ -57,14 +77,8 @@
    5.53  end)
    5.54  
    5.55  
    5.56 -local contact_members = Member:build_selector{
    5.57 -  is_contact_of_member_id = app.session.member_id,
    5.58 -  voting_right_for_unit_id = voting_right_unit_id,
    5.59 -  order = "name"
    5.60 -}:exec()
    5.61 -
    5.62  ui.form{
    5.63 -  attr = { class = "vertical" },
    5.64 +  attr = { class = "vertical", id = "delegationForm" },
    5.65    module = "delegation",
    5.66    action = "update",
    5.67    params = {
    5.68 @@ -148,6 +162,11 @@
    5.69  
    5.70      end
    5.71      -- add saved members
    5.72 +    if current_trustee_id then
    5.73 +      records[#records+1] = {id="_", name= "--- " .. _"Current trustee" .. " ---"}
    5.74 +      records[#records+1] = { id = current_trustee_id, name = current_trustee_name }
    5.75 +    end
    5.76 +    -- add saved members
    5.77      records[#records+1] = {id="_", name= "--- " .. _"Saved contacts" .. " ---"}
    5.78      for i, record in ipairs(contact_members) do
    5.79        records[#records+1] = record
    5.80 @@ -165,15 +184,20 @@
    5.81      disabled_records[app.session.member_id] = true
    5.82  
    5.83      ui.field.select{
    5.84 +      attr = { onchange = "updateDelegationInfo();" },
    5.85        label = _"Trustee",
    5.86        name = "trustee_id",
    5.87        foreign_records = records,
    5.88        foreign_id = "id",
    5.89        foreign_name = "name",
    5.90 -      disabled_records = disabled_records
    5.91 +      disabled_records = disabled_records,
    5.92 +      value = preview_trustee_id or current_trustee_id
    5.93      }
    5.94  
    5.95 +    ui.field.hidden{ name = "preview" }
    5.96 +    
    5.97      ui.submit{ text = _"Save" }
    5.98 +    
    5.99    end
   5.100  }
   5.101  
   5.102 @@ -244,9 +268,7 @@
   5.103    slot_name = "default"
   5.104  end
   5.105  
   5.106 -if delegation then
   5.107 -
   5.108 -  if not delegation.trustee_id then
   5.109 +  if delegation and not delegation.trustee_id then
   5.110      ui.image{
   5.111        static = "icons/16/table_go_crossed.png"
   5.112      }
   5.113 @@ -259,7 +281,7 @@
   5.114  
   5.115    local delegation_chain = Member:new_selector()
   5.116      :add_field("delegation_chain.*")
   5.117 -    :join("delegation_chain(" .. tostring(app.session.member.id) .. ", " .. tostring(unit_id or "NULL") .. ", " .. tostring(area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id")
   5.118 +    :join({ "delegation_chain(?,?,?,?,?)", app.session.member.id, unit_id, area_id, issue_id, preview_trustee_id }, "delegation_chain", "member.id = delegation_chain.member_id")
   5.119      :add_order_by("index")
   5.120      :exec()
   5.121  
   5.122 @@ -311,4 +333,3 @@
   5.123      end
   5.124      slot.put("<br style='clear: left'/>")
   5.125    end
   5.126 -end
   5.127 \ No newline at end of file
     6.1 --- a/app/main/interest/_show_box.lua	Fri May 18 21:03:10 2012 +0200
     6.2 +++ b/app/main/interest/_show_box.lua	Sun May 20 19:43:01 2012 +0200
     6.3 @@ -7,7 +7,11 @@
     6.4  
     6.5  if interest then
     6.6  
     6.7 -  ui.tag{ content = _"Your are interested" }
     6.8 +  if issue.closed then
     6.9 +    ui.tag{ content = _"You were interested" }
    6.10 +  else
    6.11 +    ui.tag{ content = _"You are interested" }
    6.12 +  end
    6.13    slot.put(" ")
    6.14  
    6.15    if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then
     7.1 --- a/app/main/issue/_show.lua	Fri May 18 21:03:10 2012 +0200
     7.2 +++ b/app/main/issue/_show.lua	Sun May 20 19:43:01 2012 +0200
     7.3 @@ -12,6 +12,8 @@
     7.4  
     7.5  local vote_link_text = direct_voter and _"Change vote" or "Vote now"
     7.6  
     7.7 +issue:load_delegation_info_once_for_member_id(app.session.member_id)
     7.8 +
     7.9  
    7.10  local class = "issue"
    7.11  if issue.is_interested then
    7.12 @@ -94,6 +96,15 @@
    7.13        slot.put(" &middot; ")
    7.14      end
    7.15  
    7.16 +    if not issue.closed then
    7.17 +      if issue.delegation_info.own_delegation_scope ~= "issue" then
    7.18 +        ui.link{ text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id } }
    7.19 +      else
    7.20 +        ui.link{ text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id } }
    7.21 +      end
    7.22 +      slot.put(" &middot; ")
    7.23 +    end
    7.24 +
    7.25      if config.issue_discussion_url_func then
    7.26        local url = config.issue_discussion_url_func(issue)
    7.27        ui.link{
     8.1 --- a/app/main/member/_show_thumb.lua	Fri May 18 21:03:10 2012 +0200
     8.2 +++ b/app/main/member/_show_thumb.lua	Sun May 20 19:43:01 2012 +0200
     8.3 @@ -41,8 +41,9 @@
     8.4        attr = { class = "flags" },
     8.5        content = function()
     8.6  
     8.7 -        if not member.activated then
     8.8 -          local text = _"Member is deactivated"
     8.9 +        if not member.active then
    8.10 +          local text = _"inactive"
    8.11 +          ui.tag{ content = text }
    8.12            ui.image{
    8.13              attr = { alt = text, title = text },
    8.14              static = "icons/16/cross.png"
    8.15 @@ -180,9 +181,7 @@
    8.16          }
    8.17          ui.container{
    8.18            attr = { class = "member_name" },
    8.19 -          content = function()
    8.20 -            slot.put(name)
    8.21 -          end
    8.22 +          content = name
    8.23          }
    8.24        end
    8.25      }
     9.1 --- a/app/main/member/show.lua	Fri May 18 21:03:10 2012 +0200
     9.2 +++ b/app/main/member/show.lua	Sun May 20 19:43:01 2012 +0200
     9.3 @@ -29,7 +29,7 @@
     9.4      view    = "history",
     9.5      id      = member.id
     9.6    }
     9.7 -  if not member.activated then
     9.8 +  if not member.active then
     9.9      ui.tag{
    9.10        tag = "div",
    9.11        attr = { class = "interest deactivated_member_info" },
    10.1 --- a/app/main/supporter/_show_box.lua	Fri May 18 21:03:10 2012 +0200
    10.2 +++ b/app/main/supporter/_show_box.lua	Sun May 20 19:43:01 2012 +0200
    10.3 @@ -34,14 +34,22 @@
    10.4          ui.image{
    10.5            static = "icons/16/thumb_up_green.png"
    10.6          }
    10.7 -        slot.put(_"Your are supporter")
    10.8 +        if initiative.issue.closed then
    10.9 +          slot.put(_"You were supporter")
   10.10 +        else
   10.11 +          slot.put(_"You are supporter")
   10.12 +        end
   10.13        end }
   10.14      else
   10.15        ui.tag{ attr = { class = "potential_supporter" }, content = function()
   10.16          ui.image{
   10.17            static = "icons/16/thumb_up.png"
   10.18          }
   10.19 -        slot.put(_"Your are potential supporter")
   10.20 +        if initiative.issue.closed then
   10.21 +          slot.put(_"You were potential supporter")
   10.22 +        else
   10.23 +          slot.put(_"You are potential supporter")
   10.24 +        end
   10.25        end }
   10.26      end
   10.27      slot.put(" (")
    11.1 --- a/app/main/unit/_head.lua	Fri May 18 21:03:10 2012 +0200
    11.2 +++ b/app/main/unit/_head.lua	Sun May 20 19:43:01 2012 +0200
    11.3 @@ -1,5 +1,9 @@
    11.4  local unit = param.get("unit", "table")
    11.5  
    11.6 +local show_content = param.get("show_content", atom.boolean)
    11.7 +
    11.8 +unit:load_delegation_info_once_for_member_id(app.session.member_id)
    11.9 +
   11.10  ui.container{ attr = { class = "unit_head" }, content = function()
   11.11  
   11.12    execute.view{ module = "delegation", view = "_info", params = { unit = unit } }
   11.13 @@ -18,11 +22,21 @@
   11.14      end
   11.15    end }
   11.16  
   11.17 -  ui.container{ attr = { class = "content" }, content = function()
   11.18 +  if show_content then
   11.19 +    ui.container{ attr = { class = "content" }, content = function()
   11.20  
   11.21 -    if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then
   11.22 -      ui.tag{ content = _"You have voting privileges for this unit" }
   11.23 -    end
   11.24 -  end }
   11.25 -  
   11.26 +      if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then
   11.27 +        ui.tag{ content = _"You have voting privileges for this unit" }
   11.28 +        slot.put(" &middot; ")
   11.29 +        if unit.delegation_info.first_trustee_id == nil then
   11.30 +          ui.link{ text = _"Delegate unit", module = "delegation", view = "show", params = { unit_id = unit.id } }
   11.31 +        else
   11.32 +          ui.link{ text = _"Change unit delegation", module = "delegation", view = "show", params = { unit_id = unit.id } }
   11.33 +        end
   11.34 +      end
   11.35 +    end }
   11.36 +  else
   11.37 +    slot.put("<br />")
   11.38 +  end
   11.39 +    
   11.40  end }
    12.1 --- a/app/main/unit/show.lua	Fri May 18 21:03:10 2012 +0200
    12.2 +++ b/app/main/unit/show.lua	Sun May 20 19:43:01 2012 +0200
    12.3 @@ -3,7 +3,7 @@
    12.4  local unit = Unit:by_id(unit_id)
    12.5  
    12.6  slot.select("head", function()
    12.7 -  execute.view{ module = "unit", view = "_head", params = { unit = unit } }
    12.8 +  execute.view{ module = "unit", view = "_head", params = { unit = unit, show_content = true } }
    12.9  end)
   12.10  
   12.11  if config.single_unit_id and not app.session.member_id and config.motd_public then
    13.1 --- a/config/default.lua	Fri May 18 21:03:10 2012 +0200
    13.2 +++ b/config/default.lua	Sun May 20 19:43:01 2012 +0200
    13.3 @@ -121,5 +121,3 @@
    13.4    selector:optional_object_mode()
    13.5    return selector:exec()
    13.6  end
    13.7 -
    13.8 -
    14.1 --- a/model/area.lua	Fri May 18 21:03:10 2012 +0200
    14.2 +++ b/model/area.lua	Sun May 20 19:43:01 2012 +0200
    14.3 @@ -80,7 +80,7 @@
    14.4      end
    14.5      sub_selector:from("area")
    14.6      sub_selector:add_field("area.id", "area_id")
    14.7 -    sub_selector:add_field{ '(delegation_info(?, null, area.id, null)).*', options.member_id }
    14.8 +    sub_selector:add_field{ '(delegation_info(?, null, area.id, null, ?)).*', options.member_id, options.trustee_id }
    14.9      sub_selector:add_where{ 'area.id IN ($)', ids }
   14.10  
   14.11      local selector = Area:get_db_conn():new_selector()
   14.12 @@ -94,9 +94,9 @@
   14.13    end
   14.14  }
   14.15  
   14.16 -function Area.list:load_delegation_info_once_for_member_id(member_id)
   14.17 +function Area.list:load_delegation_info_once_for_member_id(member_id, trustee_id)
   14.18    if self._delegation_info_loaded_for_member_id ~= member_id then
   14.19 -    self:load("delegation_info", { member_id = member_id })
   14.20 +    self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id })
   14.21      for i, area in ipairs(self) do
   14.22        area._delegation_info_loaded_for_member_id = member_id
   14.23      end
   14.24 @@ -104,9 +104,9 @@
   14.25    end
   14.26  end
   14.27  
   14.28 -function Area.object:load_delegation_info_once_for_member_id(member_id)
   14.29 +function Area.object:load_delegation_info_once_for_member_id(member_id, trustee_id)
   14.30    if self._delegation_info_loaded_for_member_id ~= member_id then
   14.31 -    self:load("delegation_info", { member_id = member_id })
   14.32 +    self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id })
   14.33      self._delegation_info_loaded_for_member_id = member_id
   14.34    end
   14.35  end
    15.1 --- a/model/issue.lua	Fri May 18 21:03:10 2012 +0200
    15.2 +++ b/model/issue.lua	Sun May 20 19:43:01 2012 +0200
    15.3 @@ -130,7 +130,7 @@
    15.4      end
    15.5      sub_selector:from("issue")
    15.6      sub_selector:add_field("issue.id", "issue_id")
    15.7 -    sub_selector:add_field{ '(delegation_info(?, null, null, issue.id)).*', options.member_id }
    15.8 +    sub_selector:add_field{ '(delegation_info(?, null, null, issue.id, ?)).*', options.member_id, options.trustee_id }
    15.9      sub_selector:add_where{ 'issue.id IN ($)', ids }
   15.10  
   15.11      local selector = Issue:get_db_conn():new_selector()
   15.12 @@ -144,9 +144,9 @@
   15.13    end
   15.14  }
   15.15  
   15.16 -function Issue.list:load_delegation_info_once_for_member_id(member_id)
   15.17 +function Issue.list:load_delegation_info_once_for_member_id(member_id, trustee_id)
   15.18    if self._delegation_info_loaded_for_member_id ~= member_id then
   15.19 -    self:load("delegation_info", { member_id = member_id })
   15.20 +    self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id })
   15.21      for i, issue in ipairs(self) do
   15.22        issue._delegation_info_loaded_for_member_id = member_id
   15.23      end
   15.24 @@ -154,9 +154,9 @@
   15.25    end
   15.26  end
   15.27  
   15.28 -function Issue.object:load_delegation_info_once_for_member_id(member_id)
   15.29 +function Issue.object:load_delegation_info_once_for_member_id(member_id, trustee_id)
   15.30    if self._delegation_info_loaded_for_member_id ~= member_id then
   15.31 -    self:load("delegation_info", { member_id = member_id })
   15.32 +    self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id })
   15.33      self._delegation_info_loaded_for_member_id = member_id
   15.34    end
   15.35  end
    16.1 --- a/model/member.lua	Fri May 18 21:03:10 2012 +0200
    16.2 +++ b/model/member.lua	Sun May 20 19:43:01 2012 +0200
    16.3 @@ -236,10 +236,6 @@
    16.4  
    16.5  model.has_rendered_content(Member, RenderedMemberStatement, "statement")
    16.6  
    16.7 -Member:new_selector()
    16.8 -  :add_order_by("member.name")
    16.9 -  :exec()
   16.10 -
   16.11  function Member:build_selector(args)
   16.12    local selector = self:new_selector()
   16.13    if args.active ~= nil then
    17.1 --- a/model/unit.lua	Fri May 18 21:03:10 2012 +0200
    17.2 +++ b/model/unit.lua	Sun May 20 19:43:01 2012 +0200
    17.3 @@ -43,7 +43,7 @@
    17.4      end
    17.5      sub_selector:from("unit")
    17.6      sub_selector:add_field("unit.id", "unit_id")
    17.7 -    sub_selector:add_field{ '(delegation_info(?, unit.id, null, null)).*', options.member_id }
    17.8 +    sub_selector:add_field{ '(delegation_info(?, unit.id, null, null, ?)).*', options.member_id, options.trustee_id }
    17.9      sub_selector:add_where{ 'unit.id IN ($)', ids }
   17.10  
   17.11      local selector = Unit:get_db_conn():new_selector()
   17.12 @@ -57,9 +57,9 @@
   17.13    end
   17.14  }
   17.15  
   17.16 -function Unit.list:load_delegation_info_once_for_member_id(member_id)
   17.17 +function Unit.list:load_delegation_info_once_for_member_id(member_id, trustee_id)
   17.18    if self._delegation_info_loaded_for_member_id ~= member_id then
   17.19 -    self:load("delegation_info", { member_id = member_id })
   17.20 +    self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id })
   17.21      for i, unit in ipairs(self) do
   17.22        unit._delegation_info_loaded_for_member_id = member_id
   17.23      end
   17.24 @@ -67,7 +67,7 @@
   17.25    end
   17.26  end
   17.27  
   17.28 -function Unit.object:load_delegation_info_once_for_member_id(member_id)
   17.29 +function Unit.object:load_delegation_info_once_for_member_id(member_id, trustee_id)
   17.30    if self._delegation_info_loaded_for_member_id ~= member_id then
   17.31      self:load("delegation_info", { member_id = member_id })
   17.32      self._delegation_info_loaded_for_member_id = member_id
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/static/js/update_delegation_info.js	Sun May 20 19:43:01 2012 +0200
    18.3 @@ -0,0 +1,5 @@
    18.4 +function updateDelegationInfo() {
    18.5 +  var form = document.getElementById("delegationForm");
    18.6 +  form.preview.value = "1";
    18.7 +  form.submit();
    18.8 +}
    18.9 \ No newline at end of file
    19.1 --- a/static/style.css	Fri May 18 21:03:10 2012 +0200
    19.2 +++ b/static/style.css	Sun May 20 19:43:01 2012 +0200
    19.3 @@ -285,7 +285,6 @@
    19.4    margin: 0px 10px 2ex 10px;
    19.5    border: 1px solid #aaa;
    19.6    border-radius: 0 0 8px 8px;
    19.7 -  box-shadow: #777 0px 5px 5px -5px;
    19.8  }
    19.9  
   19.10  
   19.11 @@ -425,78 +424,35 @@
   19.12   * ui.tab
   19.13   */
   19.14  
   19.15 -.ui_tabs_links {
   19.16 -  margin-top: 2ex;
   19.17 -  margin-bottom: 1ex;
   19.18 -}
   19.19 -
   19.20  .ui_tabs_links a {
   19.21 -  padding: 1ex;
   19.22 -  line-height: 300%;
   19.23 -  background-color: #f2f2f2;
   19.24 +  padding: 0.75ex 0.6em;
   19.25 +  line-height: 225%;
   19.26 +  background-color: #f7f7f7;
   19.27    white-space: nowrap;
   19.28    border-radius: 5px;
   19.29    margin-right: 5px;
   19.30    font-weight: bold;
   19.31  }
   19.32  
   19.33 -.ui_tabs_links a:hover {
   19.34 -  background-color: #d7d7d7;
   19.35 -}
   19.36 -
   19.37 +.ui_tabs_links a:hover,
   19.38  .ui_tabs_links a.selected {
   19.39    background-color: #444;
   19.40    color: #fff;
   19.41    text-decoration: none;
   19.42  }
   19.43  
   19.44 -.ui_tabs_links a.yellow {
   19.45 -  background-color: #fcc;
   19.46 -  color: #000;
   19.47 -}
   19.48 -
   19.49 -.ui_tabs_links a.yellow:hover {
   19.50 -  background-color: #faa;
   19.51 -}
   19.52 -
   19.53 -.ui_tabs_links a.yellow.selected {
   19.54 -  background-color: #a44;
   19.55 -  color: #fff;
   19.56 -  text-decoration: none;
   19.57 -  padding: 1ex;
   19.58 -}
   19.59 -
   19.60 -.ui_tabs_links a.red {
   19.61 -  background-color: #c33;
   19.62 -  color: #000;
   19.63 -}
   19.64 -
   19.65 -.ui_tabs_links a.red:hover {
   19.66 -  background-color: #ebb;
   19.67 -}
   19.68 -
   19.69 -.ui_tabs_links a.red.selected {
   19.70 -  background-color: #644;
   19.71 -  color: #fff;
   19.72 -  text-decoration: none;
   19.73 -  padding: 1ex;
   19.74 -}
   19.75 -
   19.76  
   19.77  /*************************************************************************
   19.78   * ui.filters
   19.79   */
   19.80  
   19.81  .ui_filter {
   19.82 -  overflow: hidden;
   19.83 -  margin-bottom: 1ex;
   19.84 -  margin-right: 1em;
   19.85 +  overflow: auto;
   19.86  }
   19.87  
   19.88  .ui_filter_head {
   19.89    color: #777;
   19.90 -  margin-top: 0.5ex;
   19.91 -  margin-bottom: 0.5ex;
   19.92 +  margin-top: 1ex;
   19.93    font-size: 90%;
   19.94    font-weight: bold;
   19.95    float: left;
   19.96 @@ -509,6 +465,7 @@
   19.97    padding: 0.5ex;
   19.98  }
   19.99  
  19.100 +.ui_filter_head a:hover,
  19.101  .ui_filter_head a.active {
  19.102    color: #fff;
  19.103    background-color: #777;
  19.104 @@ -855,13 +812,14 @@
  19.105  
  19.106  .issues {
  19.107    clear: left;
  19.108 +  margin-top: 2ex;
  19.109  }
  19.110  
  19.111  .issues .issue {
  19.112 -  margin-top: 10px;
  19.113    overflow: hidden;
  19.114 -  border: 1px solid #aaa;
  19.115 +  border: 1px solid #ddd;
  19.116    border-radius: 8px;
  19.117 +  margin-bottom: 2ex;
  19.118  }
  19.119  
  19.120  .issue.interested,
  19.121 @@ -1042,7 +1000,7 @@
  19.122  }
  19.123  
  19.124  .member_thumb .flags {
  19.125 -  text-align: right;
  19.126 +  float: right;
  19.127    font-size: 75%;
  19.128  }
  19.129  
  19.130 @@ -1405,6 +1363,7 @@
  19.131    padding: 0;
  19.132  }
  19.133  
  19.134 +.page_head,
  19.135  .initiative_head,
  19.136  .issues .issue,
  19.137  .ui_tabs_links a,
  19.138 @@ -1418,7 +1377,7 @@
  19.139  .box {
  19.140    box-shadow: #777 0px 5px 5px -5px;
  19.141    -mox-box-shadow: #777 0px 5px 5px -5px;
  19.142 -  -webkit-box-shadow: #777 0px 5px 5px -5px;
  19.143 +  -webkit-box-shadow: #ddd 3px 3px 3px -1px;
  19.144    clear: both;
  19.145  }
  19.146  

Impressum / About Us