liquid_feedback_frontend

diff app/main/member/_show_thumb.lua @ 1045:701a5cf6b067

Imported LiquidFeedback Frontend 3.0 branch
author bsw
date Thu Jul 10 01:19:48 2014 +0200 (2014-07-10)
parents ea3d3757ddc3
children 32cc544d5a5b
line diff
     1.1 --- a/app/main/member/_show_thumb.lua	Thu Jul 10 01:02:43 2014 +0200
     1.2 +++ b/app/main/member/_show_thumb.lua	Thu Jul 10 01:19:48 2014 +0200
     1.3 @@ -5,6 +5,8 @@
     1.4  local initiative = param.get("initiative", "table")
     1.5  local trustee = param.get("trustee", "table")
     1.6  
     1.7 +local class = param.get("class")
     1.8 +
     1.9  local name_html
    1.10  if member.name_highlighted then
    1.11    name_html = encode.highlight(member.name_highlighted)
    1.12 @@ -21,15 +23,19 @@
    1.13    container_class = container_class .. " not_informed"
    1.14  end
    1.15  
    1.16 -local in_delegation_chain = false 
    1.17 -if member.delegate_member_ids then
    1.18 +if class then
    1.19 +  container_class = container_class .. " " .. class
    1.20 +end
    1.21 +
    1.22 +local in_delegation_chain = member.in_delegation_chain
    1.23 +--[[if member.delegate_member_ids then
    1.24    for member_id in member.delegate_member_ids:gmatch("(%w+)") do
    1.25      if tonumber(member_id) == member.id then
    1.26        in_delegation_chain = true
    1.27      end
    1.28    end
    1.29  end
    1.30 -
    1.31 +--]]
    1.32  if in_delegation_chain or ((issue or initiative) and member.id == app.session.member_id) then
    1.33    container_class = container_class .. " in_delegation_chain"
    1.34  end
    1.35 @@ -37,140 +43,165 @@
    1.36  ui.container{
    1.37    attr = { class = container_class },
    1.38    content = function()
    1.39 -    ui.container{
    1.40 -      attr = { class = "flags" },
    1.41 -      content = function()
    1.42 +
    1.43 +    local function doit()
    1.44 +      execute.view{
    1.45 +        module = "member_image",
    1.46 +        view = "_show",
    1.47 +        params = {
    1.48 +          member = member,
    1.49 +          image_type = "avatar",
    1.50 +          show_dummy = true
    1.51 +        }
    1.52 +      }
    1.53 +      ui.tag{
    1.54 +        attr = { class = "member_name" },
    1.55 +        content = function() slot.put(name_html) end
    1.56 +      }
    1.57 +    end
    1.58 +    
    1.59 +    if app.session:has_access("everything") then
    1.60 +      ui.link{
    1.61 +        attr = { title = _"Show member" },
    1.62 +        module = "member",
    1.63 +        view = "show",
    1.64 +        id = member.id,
    1.65 +        content = doit
    1.66 +      }
    1.67 +    else
    1.68 +      ui.tag{ content = doit }
    1.69 +    end
    1.70  
    1.71 -        if not member.active then
    1.72 -          local text = _"inactive"
    1.73 -          ui.tag{ content = text }
    1.74 +    if member.grade then
    1.75 +      slot.put ( " " )
    1.76 +      ui.link{
    1.77 +        module = "vote",
    1.78 +        view = "list",
    1.79 +        params = {
    1.80 +          issue_id = initiative.issue.id,
    1.81 +          member_id = member.id,
    1.82 +        },
    1.83 +        content = function()
    1.84 +          if member.grade > 0 then
    1.85 +            ui.image{
    1.86 +              attr = { 
    1.87 +                alt   = _"Voted yes",
    1.88 +                title = _"Voted yes",
    1.89 +                class = "icon24 right"
    1.90 +              },
    1.91 +              static = "icons/32/support_satisfied.png"
    1.92 +            }
    1.93 +          elseif member.grade < 0 then
    1.94 +            ui.image{
    1.95 +              attr = { 
    1.96 +                alt   = _"Voted no",
    1.97 +                title = _"Voted no",
    1.98 +                class = "icon24 right"
    1.99 +              },
   1.100 +              static = "icons/32/voted_no.png"
   1.101 +            }
   1.102 +          else
   1.103 +            ui.image{
   1.104 +              attr = { 
   1.105 +                alt   = _"Abstention",
   1.106 +                title = _"Abstention",
   1.107 +                class = "icon24 right"
   1.108 +              },
   1.109 +              static = "icons/16/bullet_yellow.png"
   1.110 +            }
   1.111 +          end
   1.112 +        end
   1.113 +      }
   1.114 +    end
   1.115 +
   1.116 +    if (member.voter_comment) then
   1.117 +      ui.link{
   1.118 +        module = "vote",
   1.119 +        view = "list",
   1.120 +        params = {
   1.121 +          issue_id = issue.id,
   1.122 +          member_id = member.id,
   1.123 +        },
   1.124 +        content = function()
   1.125            ui.image{
   1.126 -            attr = { alt = text, title = text },
   1.127 -            static = "icons/16/cross.png"
   1.128 -          }
   1.129 -        end
   1.130 -
   1.131 -        if member.grade then
   1.132 -          ui.link{
   1.133 -            module = "vote",
   1.134 -            view = "list",
   1.135 -            params = {
   1.136 -              issue_id = initiative.issue.id,
   1.137 -              member_id = member.id,
   1.138 +            attr = { 
   1.139 +              alt   = _"Voting comment available",
   1.140 +              title = _"Voting comment available",
   1.141 +              class = "icon24 right"
   1.142              },
   1.143 -            content = function()
   1.144 -              if (member.voter_comment) then
   1.145 -                ui.image{
   1.146 -                  attr = { 
   1.147 -                    alt   = _"Voting comment available",
   1.148 -                    title = _"Voting comment available"
   1.149 -                  },
   1.150 -                  static = "icons/16/comment.png"
   1.151 -                }
   1.152 -              end
   1.153 -
   1.154 -              if member.grade > 0 then
   1.155 -                ui.image{
   1.156 -                  attr = { 
   1.157 -                    alt   = _"Voted yes",
   1.158 -                    title = _"Voted yes"
   1.159 -                  },
   1.160 -                  static = "icons/16/thumb_up_green.png"
   1.161 -                }
   1.162 -              elseif member.grade < 0 then
   1.163 -                ui.image{
   1.164 -                  attr = { 
   1.165 -                    alt   = _"Voted no",
   1.166 -                    title = _"Voted no"
   1.167 -                  },
   1.168 -                  static = "icons/16/thumb_down_red.png"
   1.169 -                }
   1.170 -              else
   1.171 -                ui.image{
   1.172 -                  attr = { 
   1.173 -                    alt   = _"Abstention",
   1.174 -                    title = _"Abstention"
   1.175 -                  },
   1.176 -                  static = "icons/16/bullet_yellow.png"
   1.177 -                }
   1.178 -              end
   1.179 -            end
   1.180 +            static = "icons/16/comment.png"
   1.181            }
   1.182          end
   1.183 +      }
   1.184 +    end
   1.185  
   1.186 -        local weight = 0
   1.187 -        if member.weight then
   1.188 -          weight = member.weight
   1.189 -        end
   1.190 -        if member.voter_weight then
   1.191 -          weight = member.voter_weight
   1.192 -        end
   1.193 -        if (issue or initiative) and weight > 1 then
   1.194 -          local module
   1.195 -          if issue then
   1.196 -            module = "interest"
   1.197 -          elseif initiative then
   1.198 -            if member.voter_weight then
   1.199 -               module = "vote"
   1.200 -            else
   1.201 -              module = "supporter"
   1.202 -            end
   1.203 -          end
   1.204 -          ui.link{
   1.205 -            attr = { 
   1.206 -              class = in_delegation_chain and "in_delegation_chain" or nil,
   1.207 -              title = _"Number of incoming delegations, follow link to see more details"
   1.208 -            },
   1.209 -            content = _("+ #{weight}", { weight = weight - 1 }),
   1.210 -            module = module,
   1.211 -            view = "show_incoming",
   1.212 -            params = { 
   1.213 -              member_id = member.id, 
   1.214 -              initiative_id = initiative and initiative.id or nil,
   1.215 -              issue_id = issue and issue.id or nil
   1.216 -            }
   1.217 -          }
   1.218 -        end
   1.219 +    local weight = 0
   1.220 +    if member.weight then
   1.221 +      weight = member.weight
   1.222 +    end
   1.223 +    if member.voter_weight then
   1.224 +      weight = member.voter_weight
   1.225 +    end
   1.226 +
   1.227 +    if (issue or initiative) and weight > 1 then
   1.228 +      local module = "interest"
   1.229 +      if member.voter_weight then
   1.230 +        module = "vote"
   1.231 +      end
   1.232          
   1.233 -        if initiator and initiator.accepted then
   1.234 -          if member.accepted == nil then
   1.235 -            slot.put(_"Invited")
   1.236 -          elseif member.accepted == false then
   1.237 -            slot.put(_"Rejected")
   1.238 -          end
   1.239 -        end
   1.240 -
   1.241 -        if member.is_informed == false then
   1.242 -          local text = _"Member has not approved latest draft"
   1.243 -          ui.image{
   1.244 -            attr = { alt = text, title = text },
   1.245 -            static = "icons/16/help_yellow.png"
   1.246 -          }
   1.247 -        end
   1.248 -
   1.249 +      slot.put ( " " )
   1.250 +      ui.link{
   1.251 +        attr = { 
   1.252 +          class = in_delegation_chain and "in_delegation_chain" or nil,
   1.253 +          title = _"Number of incoming delegations, follow link to see more details"
   1.254 +        },
   1.255 +        content = _("+ #{weight}", { weight = weight - 1 }),
   1.256 +        module = module,
   1.257 +        view = "show_incoming",
   1.258 +        params = { 
   1.259 +          member_id = member.id, 
   1.260 +          initiative_id = initiative and initiative.id or nil,
   1.261 +          issue_id = issue and issue.id or nil
   1.262 +        }
   1.263 +      }
   1.264 +    end
   1.265 +    
   1.266 +    if member.supporter then
   1.267 +      slot.put ( " " )
   1.268 +      if member.supporter_satisfied then
   1.269 +        local text = _"supporter"
   1.270 +        ui.image{ attr = { class = "icon24 right", alt = text, title = text }, static = "icons/32/support_satisfied.png" }
   1.271 +      else
   1.272 +        local text = _"supporter with restricting suggestions"
   1.273 +        ui.image{ attr = { class = "icon24 right", alt = text, title = text }, static = "icons/32/support_unsatisfied.png" }
   1.274        end
   1.275 -    }
   1.276 +    end
   1.277  
   1.278 -    ui.link{
   1.279 -      attr = { title = _"Show member" },
   1.280 -      module = "member",
   1.281 -      view = "show",
   1.282 -      id = member.id,
   1.283 -      content = function()
   1.284 -        execute.view{
   1.285 -          module = "member_image",
   1.286 -          view = "_show",
   1.287 -          params = {
   1.288 -            member = member,
   1.289 -            image_type = "avatar",
   1.290 -            show_dummy = true
   1.291 -          }
   1.292 -        }
   1.293 -        ui.container{
   1.294 -          attr = { class = "member_name" },
   1.295 -          content = function() slot.put(name_html) end
   1.296 -        }
   1.297 +    if not member.active then
   1.298 +      slot.put ( " " )
   1.299 +      local text = _"member inactive"
   1.300 +      ui.image{
   1.301 +        attr = { alt = text, title = text },
   1.302 +        static = "icons/16/cross.png"
   1.303 +      }
   1.304 +      ui.tag{ content = _"inactive" }
   1.305 +    end
   1.306 +
   1.307 +    if initiator and initiator.accepted then
   1.308 +      if member.accepted == nil then
   1.309 +        slot.put(_"Invited")
   1.310 +      elseif member.accepted == false then
   1.311 +        slot.put(_"Rejected")
   1.312        end
   1.313 -    }
   1.314 +    end
   1.315 +
   1.316 +    if member.is_informed == false then
   1.317 +      local text = _"Member has not approved latest draft"
   1.318 +      ui.image{
   1.319 +        attr = { alt = text, title = text },
   1.320 +        static = "icons/16/help_yellow.png"
   1.321 +      }
   1.322 +    end
   1.323 +
   1.324    end
   1.325  }

Impressum / About Us