liquid_feedback_frontend
diff app/main/member/_show_thumb.lua @ 1503:64229f002a47
Added support for voting weight
author | bsw |
---|---|
date | Thu Jul 30 23:15:49 2020 +0200 (2020-07-30) |
parents | 32cc544d5a5b |
children | dcbe505ddf24 |
line diff
1.1 --- a/app/main/member/_show_thumb.lua Tue Mar 24 16:59:32 2020 +0100 1.2 +++ b/app/main/member/_show_thumb.lua Thu Jul 30 23:15:49 2020 +0200 1.3 @@ -42,15 +42,31 @@ 1.4 1.5 local el_id = multirand.string(32, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") 1.6 local weight = 0 1.7 +local ownweight = member.ownweight 1.8 if member.weight then 1.9 weight = member.weight 1.10 end 1.11 if member.voter_weight then 1.12 weight = member.voter_weight 1.13 end 1.14 +local delegated_weight = weight - (ownweight or 0) 1.15 + 1.16 +local weight_text = "" 1.17 + 1.18 +if ownweight and ownweight > 1 then 1.19 + weight_text = weight_text .. ownweight 1.20 +end 1.21 + 1.22 +if delegated_weight > 0 then 1.23 + weight_text = weight_text .. "+" .. delegated_weight 1.24 +end 1.25 + 1.26 +if weight_text == "" then 1.27 + weight_text = nil 1.28 +end 1.29 1.30 ui.container{ 1.31 - attr = { id = el_id, class = container_class, ["data-badge"] = weight > 1 and "+" .. weight - 1 or nil }, 1.32 + attr = { id = el_id, class = container_class }, 1.33 content = function() 1.34 1.35 execute.view{ 1.36 @@ -64,7 +80,13 @@ 1.37 } 1.38 ui.tag{ 1.39 attr = { class = "mdl-chip__text" }, 1.40 - content = function() slot.put(name_html) end 1.41 + content = function() 1.42 + slot.put(name_html) 1.43 + if weight_text then 1.44 + slot.put(" ") 1.45 + ui.tag{ attr = { class = "member_weight" }, content = weight_text } 1.46 + end 1.47 + end 1.48 } 1.49 1.50 if member.grade then