liquid_feedback_frontend

diff app/main/delegation/_info.lua @ 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 18cd8595459b
children 57a261a81c5a
line diff
     1.1 --- a/app/main/delegation/_info.lua	Fri May 18 21:03:10 2012 +0200
     1.2 +++ b/app/main/delegation/_info.lua	Sun May 20 19:43:01 2012 +0200
     1.3 @@ -14,7 +14,6 @@
     1.4  local delegation_text
     1.5  
     1.6  if unit then
     1.7 -  unit:load_delegation_info_once_for_member_id(app.session.member_id)
     1.8    info = unit.delegation_info
     1.9    delegation_text = _"Delegate unit"
    1.10  end
    1.11 @@ -31,136 +30,107 @@
    1.12    delegation_text = _"Delegate issue"
    1.13  end
    1.14  
    1.15 -ui.link{
    1.16 -  module = "delegation", view = "show", params = {
    1.17 -    unit_id = unit_id,
    1.18 -    area_id = area_id,
    1.19 -    issue_id = issue_id
    1.20 -  },
    1.21 -  attr = { class = "delegation_info" }, content = function()
    1.22 -    
    1.23 +if info.own_participation or info.first_trustee_id then
    1.24  
    1.25 -    local participant_occured = false
    1.26 -    
    1.27 -    if info.own_participation or info.first_trustee_id then
    1.28 -      
    1.29 -      local class = "micro_avatar"
    1.30 -      if info.own_participation then
    1.31 -        participant_occured = true
    1.32 -        class = class .. " highlighted"
    1.33 -      end
    1.34 +  ui.link{
    1.35 +    module = "delegation", view = "show", params = {
    1.36 +      unit_id = unit_id,
    1.37 +      area_id = area_id,
    1.38 +      issue_id = issue_id
    1.39 +    },
    1.40 +    attr = { class = "delegation_info" }, content = function()
    1.41        
    1.42 -      execute.view{ module = "member_image", view = "_show", params = {
    1.43 -        member = app.session.member, class = class, popup_text = app.session.member.name,
    1.44 -        image_type = "avatar", show_dummy = true,
    1.45 -      } }
    1.46  
    1.47 -    end
    1.48 -
    1.49 -    if not info.first_trustee_id and (not issue or not issue.closed) then
    1.50 -      slot.put(" ")
    1.51 -      ui.tag{ attr = { class = "link" }, content = delegation_text }
    1.52 -    end
    1.53 -
    1.54 -    if not (issue and issue.state == "voting" and info.own_participation) then
    1.55 +      local participant_occured = false
    1.56        
    1.57 -      if info.first_trustee_id then
    1.58 -      
    1.59 -        local text = _"delegates to"
    1.60 -        ui.image{
    1.61 -          attr = { class = "delegation_arrow", alt = text, title = text },
    1.62 -          static = "delegation_arrow_24_horizontal.png"
    1.63 -        }
    1.64 -
    1.65 +      if info.own_participation or info.first_trustee_id then
    1.66 +        
    1.67          local class = "micro_avatar"
    1.68 -        if not participant_occured and info.first_trustee_participation then
    1.69 +        if info.own_participation then
    1.70            participant_occured = true
    1.71            class = class .. " highlighted"
    1.72          end
    1.73          
    1.74          execute.view{ module = "member_image", view = "_show", params = {
    1.75 -          member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
    1.76 -          image_type = "avatar", show_dummy = true,
    1.77 -        } }
    1.78 -
    1.79 -      end
    1.80 -            
    1.81 -      if info.first_trustee_ellipsis then
    1.82 -
    1.83 -        local text = _"delegates to"
    1.84 -        ui.image{
    1.85 -          attr = { class = "delegation_arrow", alt = text, title = text },
    1.86 -          static = "delegation_arrow_24_horizontal.png"
    1.87 -        }
    1.88 -
    1.89 -        slot.put("...")
    1.90 -        
    1.91 -      end
    1.92 -      
    1.93 -      if info.other_trustee_id then
    1.94 -      
    1.95 -        local text = _"delegates to"
    1.96 -        ui.image{
    1.97 -          attr = { class = "delegation_arrow", alt = text, title = text },
    1.98 -          static = "delegation_arrow_24_horizontal.png"
    1.99 -        }
   1.100 -
   1.101 -        local class = "micro_avatar"
   1.102 -        if not participant_occured and info.other_trustee_participation then
   1.103 -          participant_occured = true
   1.104 -          class = class .. " highlighted"
   1.105 -        end
   1.106 -        
   1.107 -        execute.view{ module = "member_image", view = "_show", params = {
   1.108 -          member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
   1.109 +          member = app.session.member, class = class, popup_text = app.session.member.name,
   1.110            image_type = "avatar", show_dummy = true,
   1.111          } }
   1.112  
   1.113        end
   1.114 -            
   1.115 -      if info.other_trustee_ellipsis then
   1.116  
   1.117 -        local text = _"delegates to"
   1.118 -        ui.image{
   1.119 -          attr = { class = "delegation_arrow", alt = text, title = text },
   1.120 -          static = "delegation_arrow_24_horizontal.png"
   1.121 -        }
   1.122 +      if not (issue and issue.state == "voting" and info.own_participation) then
   1.123 +        
   1.124 +        if info.first_trustee_id then
   1.125 +        
   1.126 +          local text = _"delegates to"
   1.127 +          ui.image{
   1.128 +            attr = { class = "delegation_arrow", alt = text, title = text },
   1.129 +            static = "delegation_arrow_24_horizontal.png"
   1.130 +          }
   1.131  
   1.132 -        slot.put("...")
   1.133 -        
   1.134 -      end
   1.135 -      
   1.136 -      local trailing_ellipsis = info.other_trustee_ellipsis or
   1.137 -        (info.first_trustee_ellipsis and not info.other_trustee_id)
   1.138 -      
   1.139 -      if info.delegation_loop == "own" then
   1.140 +          local class = "micro_avatar"
   1.141 +          if not participant_occured and info.first_trustee_participation then
   1.142 +            participant_occured = true
   1.143 +            class = class .. " highlighted"
   1.144 +          end
   1.145 +          
   1.146 +          execute.view{ module = "member_image", view = "_show", params = {
   1.147 +            member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
   1.148 +            image_type = "avatar", show_dummy = true,
   1.149 +          } }
   1.150 +
   1.151 +        end
   1.152 +              
   1.153 +        if info.first_trustee_ellipsis then
   1.154 +
   1.155 +          local text = _"delegates to"
   1.156 +          ui.image{
   1.157 +            attr = { class = "delegation_arrow", alt = text, title = text },
   1.158 +            static = "delegation_arrow_24_horizontal.png"
   1.159 +          }
   1.160 +
   1.161 +          slot.put("...")
   1.162 +          
   1.163 +        end
   1.164          
   1.165 -        local text = _"delegates to"
   1.166 -        ui.image{
   1.167 -          attr = { class = "delegation_arrow", alt = text, title = text },
   1.168 -          static = "delegation_arrow_24_horizontal.png"
   1.169 -        }
   1.170 +        if info.other_trustee_id then
   1.171 +        
   1.172 +          local text = _"delegates to"
   1.173 +          ui.image{
   1.174 +            attr = { class = "delegation_arrow", alt = text, title = text },
   1.175 +            static = "delegation_arrow_24_horizontal.png"
   1.176 +          }
   1.177  
   1.178 -        execute.view{ module = "member_image", view = "_show", params = {
   1.179 -          member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name,
   1.180 -          image_type = "avatar", show_dummy = true,
   1.181 -        } }
   1.182 +          local class = "micro_avatar"
   1.183 +          if not participant_occured and info.other_trustee_participation then
   1.184 +            participant_occured = true
   1.185 +            class = class .. " highlighted"
   1.186 +          end
   1.187 +          
   1.188 +          execute.view{ module = "member_image", view = "_show", params = {
   1.189 +            member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
   1.190 +            image_type = "avatar", show_dummy = true,
   1.191 +          } }
   1.192  
   1.193 -      elseif info.delegation_loop == "first" then
   1.194 -        if info.first_trustee_ellipsis then
   1.195 -          if not trailing_ellipsis then
   1.196 +        end
   1.197 +              
   1.198 +        if info.other_trustee_ellipsis then
   1.199 +
   1.200 +          local text = _"delegates to"
   1.201 +          ui.image{
   1.202 +            attr = { class = "delegation_arrow", alt = text, title = text },
   1.203 +            static = "delegation_arrow_24_horizontal.png"
   1.204 +          }
   1.205  
   1.206 -            local text = _"delegates to"
   1.207 -            ui.image{
   1.208 -              attr = { class = "delegation_arrow", alt = text, title = text },
   1.209 -              static = "delegation_arrow_24_horizontal.png"
   1.210 -            }
   1.211 -
   1.212 -            slot.put("...")
   1.213 -          end
   1.214 -            
   1.215 -        else
   1.216 -            
   1.217 +          slot.put("...")
   1.218 +          
   1.219 +        end
   1.220 +        
   1.221 +        local trailing_ellipsis = info.other_trustee_ellipsis or
   1.222 +          (info.first_trustee_ellipsis and not info.other_trustee_id)
   1.223 +        
   1.224 +        if info.delegation_loop == "own" then
   1.225 +          
   1.226            local text = _"delegates to"
   1.227            ui.image{
   1.228              attr = { class = "delegation_arrow", alt = text, title = text },
   1.229 @@ -168,25 +138,52 @@
   1.230            }
   1.231  
   1.232            execute.view{ module = "member_image", view = "_show", params = {
   1.233 -            member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
   1.234 +            member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name,
   1.235              image_type = "avatar", show_dummy = true,
   1.236            } }
   1.237 +
   1.238 +        elseif info.delegation_loop == "first" then
   1.239 +          if info.first_trustee_ellipsis then
   1.240 +            if not trailing_ellipsis then
   1.241 +
   1.242 +              local text = _"delegates to"
   1.243 +              ui.image{
   1.244 +                attr = { class = "delegation_arrow", alt = text, title = text },
   1.245 +                static = "delegation_arrow_24_horizontal.png"
   1.246 +              }
   1.247 +
   1.248 +              slot.put("...")
   1.249 +            end
   1.250 +              
   1.251 +          else
   1.252 +              
   1.253 +            local text = _"delegates to"
   1.254 +            ui.image{
   1.255 +              attr = { class = "delegation_arrow", alt = text, title = text },
   1.256 +              static = "delegation_arrow_24_horizontal.png"
   1.257 +            }
   1.258 +
   1.259 +            execute.view{ module = "member_image", view = "_show", params = {
   1.260 +              member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
   1.261 +              image_type = "avatar", show_dummy = true,
   1.262 +            } }
   1.263 +          end
   1.264 +        
   1.265 +            
   1.266 +        elseif info.delegation_loop and not trailing_ellipsis then
   1.267 +          local text = _"delegates to"
   1.268 +          ui.image{
   1.269 +            attr = { class = "delegation_arrow", alt = text, title = text },
   1.270 +            static = "delegation_arrow_24_horizontal.png"
   1.271 +          }
   1.272 +
   1.273 +          slot.put("...")
   1.274          end
   1.275 -      
   1.276 -          
   1.277 -      elseif info.delegation_loop and not trailing_ellipsis then
   1.278 -        local text = _"delegates to"
   1.279 -        ui.image{
   1.280 -          attr = { class = "delegation_arrow", alt = text, title = text },
   1.281 -          static = "delegation_arrow_24_horizontal.png"
   1.282 -        }
   1.283  
   1.284 -        slot.put("...")
   1.285        end
   1.286  
   1.287      end
   1.288 +        
   1.289 +  }
   1.290  
   1.291 -  end
   1.292 -      
   1.293 -}
   1.294 -
   1.295 +end
   1.296 \ No newline at end of file

Impressum / About Us