liquid_feedback_frontend
diff app/main/member/_show_thumb.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
| author | bsw/jbe |
|---|---|
| date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
| parents | 701a5cf6b067 |
| children | 64229f002a47 |
line diff
1.1 --- a/app/main/member/_show_thumb.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/member/_show_thumb.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -14,7 +14,7 @@ 1.4 name_html = encode.html(member.name) 1.5 end 1.6 1.7 -local container_class = "member_thumb" 1.8 +local container_class = "mdl-chip mdl-chip--contact clickable mdl-badge mdl-badge--overlap" 1.9 if initiator and member.accepted ~= true then 1.10 container_class = container_class .. " not_accepted" 1.11 end 1.12 @@ -40,141 +40,69 @@ 1.13 container_class = container_class .. " in_delegation_chain" 1.14 end 1.15 1.16 +local el_id = multirand.string(32, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") 1.17 +local weight = 0 1.18 +if member.weight then 1.19 + weight = member.weight 1.20 +end 1.21 +if member.voter_weight then 1.22 + weight = member.voter_weight 1.23 +end 1.24 + 1.25 ui.container{ 1.26 - attr = { class = container_class }, 1.27 + attr = { id = el_id, class = container_class, ["data-badge"] = weight > 1 and "+" .. weight - 1 or nil }, 1.28 content = function() 1.29 1.30 - local function doit() 1.31 - execute.view{ 1.32 - module = "member_image", 1.33 - view = "_show", 1.34 - params = { 1.35 - member = member, 1.36 - image_type = "avatar", 1.37 - show_dummy = true 1.38 - } 1.39 - } 1.40 - ui.tag{ 1.41 - attr = { class = "member_name" }, 1.42 - content = function() slot.put(name_html) end 1.43 + execute.view{ 1.44 + module = "member_image", 1.45 + view = "_show", 1.46 + params = { 1.47 + member = member, 1.48 + image_type = "avatar", 1.49 + show_dummy = true 1.50 } 1.51 - end 1.52 + } 1.53 + ui.tag{ 1.54 + attr = { class = "mdl-chip__text" }, 1.55 + content = function() slot.put(name_html) end 1.56 + } 1.57 1.58 - if app.session:has_access("everything") then 1.59 - ui.link{ 1.60 - attr = { title = _"Show member" }, 1.61 - module = "member", 1.62 - view = "show", 1.63 - id = member.id, 1.64 - content = doit 1.65 - } 1.66 - else 1.67 - ui.tag{ content = doit } 1.68 - end 1.69 - 1.70 if member.grade then 1.71 slot.put ( " " ) 1.72 - ui.link{ 1.73 - module = "vote", 1.74 - view = "list", 1.75 - params = { 1.76 - issue_id = initiative.issue.id, 1.77 - member_id = member.id, 1.78 + if member.grade > 0 then 1.79 + ui.tag{ tag = "i", attr = { class = "material-icons icon-green" }, content = "thumb_up" } 1.80 + elseif member.grade < 0 then 1.81 + ui.tag{ tag = "i", attr = { class = "material-icons icon-red" }, content = "thumb_down" } 1.82 + else 1.83 + ui.tag{ tag = "i", attr = { class = "material-icons icon-yellow" }, content = "brightness_1" } 1.84 + end 1.85 + end 1.86 + 1.87 + if (member.voter_comment) then 1.88 + ui.image{ 1.89 + attr = { 1.90 + alt = _"Voting comment available", 1.91 + title = _"Voting comment available", 1.92 + class = "icon24 right" 1.93 }, 1.94 - content = function() 1.95 - if member.grade > 0 then 1.96 - ui.image{ 1.97 - attr = { 1.98 - alt = _"Voted yes", 1.99 - title = _"Voted yes", 1.100 - class = "icon24 right" 1.101 - }, 1.102 - static = "icons/32/support_satisfied.png" 1.103 - } 1.104 - elseif member.grade < 0 then 1.105 - ui.image{ 1.106 - attr = { 1.107 - alt = _"Voted no", 1.108 - title = _"Voted no", 1.109 - class = "icon24 right" 1.110 - }, 1.111 - static = "icons/32/voted_no.png" 1.112 - } 1.113 - else 1.114 - ui.image{ 1.115 - attr = { 1.116 - alt = _"Abstention", 1.117 - title = _"Abstention", 1.118 - class = "icon24 right" 1.119 - }, 1.120 - static = "icons/16/bullet_yellow.png" 1.121 - } 1.122 - end 1.123 - end 1.124 + static = "icons/16/comment.png" 1.125 } 1.126 end 1.127 1.128 - if (member.voter_comment) then 1.129 - ui.link{ 1.130 - module = "vote", 1.131 - view = "list", 1.132 - params = { 1.133 - issue_id = issue.id, 1.134 - member_id = member.id, 1.135 - }, 1.136 - content = function() 1.137 - ui.image{ 1.138 - attr = { 1.139 - alt = _"Voting comment available", 1.140 - title = _"Voting comment available", 1.141 - class = "icon24 right" 1.142 - }, 1.143 - static = "icons/16/comment.png" 1.144 - } 1.145 - end 1.146 - } 1.147 - end 1.148 1.149 - local weight = 0 1.150 - if member.weight then 1.151 - weight = member.weight 1.152 - end 1.153 - if member.voter_weight then 1.154 - weight = member.voter_weight 1.155 - end 1.156 - 1.157 - if (issue or initiative) and weight > 1 then 1.158 - local module = "interest" 1.159 - if member.voter_weight then 1.160 - module = "vote" 1.161 - end 1.162 - 1.163 - slot.put ( " " ) 1.164 - ui.link{ 1.165 - attr = { 1.166 - class = in_delegation_chain and "in_delegation_chain" or nil, 1.167 - title = _"Number of incoming delegations, follow link to see more details" 1.168 - }, 1.169 - content = _("+ #{weight}", { weight = weight - 1 }), 1.170 - module = module, 1.171 - view = "show_incoming", 1.172 - params = { 1.173 - member_id = member.id, 1.174 - initiative_id = initiative and initiative.id or nil, 1.175 - issue_id = issue and issue.id or nil 1.176 - } 1.177 - } 1.178 + if (issue or initiative) and weight > 0 then 1.179 end 1.180 1.181 if member.supporter then 1.182 - slot.put ( " " ) 1.183 - if member.supporter_satisfied then 1.184 - local text = _"supporter" 1.185 - ui.image{ attr = { class = "icon24 right", alt = text, title = text }, static = "icons/32/support_satisfied.png" } 1.186 - else 1.187 - local text = _"supporter with restricting suggestions" 1.188 - ui.image{ attr = { class = "icon24 right", alt = text, title = text }, static = "icons/32/support_unsatisfied.png" } 1.189 - end 1.190 + ui.tag { attr = { class = "mdl-chip__action" }, content = function() 1.191 + if member.supporter_satisfied then 1.192 + local text = _"supporter" 1.193 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" } 1.194 + else 1.195 + local text = _"supporter with restricting suggestions" 1.196 + ui.tag{ tag = "i", attr = { class = "material-icons mdl-color-text--orange-900" }, content = "thumb_up" } 1.197 + end 1.198 + end } 1.199 end 1.200 1.201 if not member.active then 1.202 @@ -205,3 +133,60 @@ 1.203 1.204 end 1.205 } 1.206 + 1.207 +if member.grade or (issue and weight > 1) or app.session.member_id or app.session:has_access("everything") then 1.208 + ui.tag { tag = "ul", attr = { class = "mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect", ["for"] = el_id }, content = function() 1.209 + if (member.grade) then 1.210 + ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function() 1.211 + ui.link{ 1.212 + attr = { class = "mdl-menu__link" }, 1.213 + module = "vote", 1.214 + view = "list", 1.215 + params = { 1.216 + issue_id = issue.id, 1.217 + member_id = member.id, 1.218 + }, 1.219 + content = _"show ballot" 1.220 + } 1.221 + end } 1.222 + end 1.223 + if issue and weight > 1 then 1.224 + ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function() 1.225 + local module = "interest" 1.226 + if member.voter_weight then 1.227 + module = "vote" 1.228 + end 1.229 + ui.link{ attr = { class = "mdl-menu__link" }, content = _"show incoming delegations", module = module, view = "show_incoming", params = { 1.230 + member_id = member.id, 1.231 + initiative_id = initiative and initiative.id or nil, 1.232 + issue_id = issue and issue.id or nil 1.233 + } } 1.234 + end } 1.235 + end 1.236 + if app.session:has_access("everything") then 1.237 + ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function() 1.238 + ui.link{ attr = { class = "mdl-menu__link" }, content = _"show profile", module = "member", view = "show", id = member.id } 1.239 + end } 1.240 + end 1.241 + if app.session.member_id then 1.242 + ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function() 1.243 + ui.link{ 1.244 + attr = { class = "mdl-menu__link" }, 1.245 + text = _"add to my list of private contacts", 1.246 + module = "contact", 1.247 + action = "add_member", 1.248 + id = member.id, 1.249 + routing = { 1.250 + default = { 1.251 + mode = "redirect", 1.252 + module = request.get_module(), 1.253 + view = request.get_view(), 1.254 + id = request.get_id_string(), 1.255 + params = request.get_param_strings() 1.256 + } 1.257 + } 1.258 + } 1.259 + end } 1.260 + end 1.261 + end } 1.262 +end