liquid_feedback_frontend
changeset 1503:64229f002a47
Added support for voting weight
author | bsw |
---|---|
date | Thu Jul 30 23:15:49 2020 +0200 (2020-07-30) |
parents | 71f54c43d7cb |
children | 2a0d86117d54 |
files | app/main/_layout/default.html app/main/issue/_list.lua app/main/issue/_sidebar_members.lua app/main/member/_show_thumb.lua |
line diff
1.1 --- a/app/main/_layout/default.html Tue Mar 24 16:59:32 2020 +0100 1.2 +++ b/app/main/_layout/default.html Thu Jul 30 23:15:49 2020 +0200 1.3 @@ -364,7 +364,18 @@ 1.4 .draft .portrait img { 1.5 width: 33.333%; 1.6 } 1.7 - 1.8 + .member_weight { 1.9 + background: #070; 1.10 + color: #fff; 1.11 + border-radius: 8px; 1.12 + padding: 0 3px; 1.13 + } 1.14 + .card-issue { 1.15 + background: rgb(76,175,80); 1.16 + } 1.17 + .card-issue a { 1.18 + color: #fff; 1.19 + } 1.20 @media (max-width: 960px) { 1.21 .draft img { 1.22 float: none; 1.23 @@ -606,8 +617,9 @@ 1.24 } 1.25 1.26 .contextlinks { 1.27 - font-size: 14px; 1.28 - margin-bottom: 5px; 1.29 + color: #fff; 1.30 + xfont-size: 14px; 1.31 + xmargin-bottom: 5px; 1.32 } 1.33 1.34 /*************************************************************************
2.1 --- a/app/main/issue/_list.lua Tue Mar 24 16:59:32 2020 +0100 2.2 +++ b/app/main/issue/_list.lua Thu Jul 30 23:15:49 2020 +0200 2.3 @@ -195,7 +195,7 @@ 2.4 end 2.5 2.6 if not for_issue and not for_initiative then 2.7 - ui.container{ attr = { class = "mdl-card__title mdl-card--has-fab mdl-card--border" }, content = function() 2.8 + ui.container{ attr = { class = "mdl-card__title mdl-card--has-fab mdl-card--border card-issue" }, content = function() 2.9 ui.container{ attr = { class = "contextlinks" }, content = function() 2.10 if not (config.single_unit_id and config.single_area_id) then 2.11 if not config.single_unit_id then 2.12 @@ -220,9 +220,9 @@ 2.13 module = "issue", view = "show", id = issue.id, 2.14 attr = { class = "issue" }, content = issue.name 2.15 } 2.16 - end } 2.17 - ui.container{ attr = { class = "mdl-card__subtitle-text .mdl-cell--hide-phone" }, content = function() 2.18 - ui.container{ attr = { class = class }, content = function () 2.19 +-- end } 2.20 +-- ui.container{ attr = { class = "mdl-card__subtitle-text .mdl-cell--hide-phone" }, content = function() 2.21 + ui.container{ attr = { class = class, style = "float: right; color: #fff;" }, content = function () 2.22 if event_icon then 2.23 ui.tag{ tag = "i", attr = { class = "material-icons", ["aria-hidden"] = "true" }, content = event_icon } 2.24 end
3.1 --- a/app/main/issue/_sidebar_members.lua Tue Mar 24 16:59:32 2020 +0100 3.2 +++ b/app/main/issue/_sidebar_members.lua Thu Jul 30 23:15:49 2020 +0200 3.3 @@ -28,6 +28,7 @@ 3.4 :join("issue", nil, { "issue.id = ?", issue.id }) 3.5 :join("direct_voter", nil, { "direct_voter.issue_id = ? AND direct_voter.member_id = member.id", issue.id }) 3.6 :join("vote", nil, { "vote.member_id = member.id AND vote.initiative_id = ?", initiative.id }) 3.7 + :add_field("direct_voter.ownweight", "ownweight") 3.8 :add_field("direct_voter.weight", "voter_weight") 3.9 :add_field("vote.grade") 3.10 :add_field("direct_voter.comment", "voter_comment") 3.11 @@ -35,12 +36,14 @@ 3.12 interested_members_selector = Member:new_selector() 3.13 :join("issue", nil, { "issue.id = ?", issue.id }) 3.14 :join("direct_voter", nil, { "direct_voter.issue_id = ? AND direct_voter.member_id = member.id", issue.id }) 3.15 + :add_field("direct_voter.ownweight", "ownweight") 3.16 :add_field("direct_voter.weight", "voter_weight") 3.17 :add_field("direct_voter.comment", "voter_comment") 3.18 end 3.19 else 3.20 interested_members_selector = issue:get_reference_selector("interested_members_snapshot") 3.21 :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id") 3.22 + :add_field("direct_interest_snapshot.ownweight") 3.23 :add_field("direct_interest_snapshot.weight") 3.24 :add_where("direct_interest_snapshot.snapshot_id = issue.latest_snapshot_id") 3.25
4.1 --- a/app/main/member/_show_thumb.lua Tue Mar 24 16:59:32 2020 +0100 4.2 +++ b/app/main/member/_show_thumb.lua Thu Jul 30 23:15:49 2020 +0200 4.3 @@ -42,15 +42,31 @@ 4.4 4.5 local el_id = multirand.string(32, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") 4.6 local weight = 0 4.7 +local ownweight = member.ownweight 4.8 if member.weight then 4.9 weight = member.weight 4.10 end 4.11 if member.voter_weight then 4.12 weight = member.voter_weight 4.13 end 4.14 +local delegated_weight = weight - (ownweight or 0) 4.15 + 4.16 +local weight_text = "" 4.17 + 4.18 +if ownweight and ownweight > 1 then 4.19 + weight_text = weight_text .. ownweight 4.20 +end 4.21 + 4.22 +if delegated_weight > 0 then 4.23 + weight_text = weight_text .. "+" .. delegated_weight 4.24 +end 4.25 + 4.26 +if weight_text == "" then 4.27 + weight_text = nil 4.28 +end 4.29 4.30 ui.container{ 4.31 - attr = { id = el_id, class = container_class, ["data-badge"] = weight > 1 and "+" .. weight - 1 or nil }, 4.32 + attr = { id = el_id, class = container_class }, 4.33 content = function() 4.34 4.35 execute.view{ 4.36 @@ -64,7 +80,13 @@ 4.37 } 4.38 ui.tag{ 4.39 attr = { class = "mdl-chip__text" }, 4.40 - content = function() slot.put(name_html) end 4.41 + content = function() 4.42 + slot.put(name_html) 4.43 + if weight_text then 4.44 + slot.put(" ") 4.45 + ui.tag{ attr = { class = "member_weight" }, content = weight_text } 4.46 + end 4.47 + end 4.48 } 4.49 4.50 if member.grade then