# HG changeset patch # User bsw # Date 1596143749 -7200 # Node ID 64229f002a4771954282584656816104a08b4bbe # Parent 71f54c43d7cb958fb5927cfd74ecb454d4e46dd0 Added support for voting weight diff -r 71f54c43d7cb -r 64229f002a47 app/main/_layout/default.html --- a/app/main/_layout/default.html Tue Mar 24 16:59:32 2020 +0100 +++ b/app/main/_layout/default.html Thu Jul 30 23:15:49 2020 +0200 @@ -364,7 +364,18 @@ .draft .portrait img { width: 33.333%; } - + .member_weight { + background: #070; + color: #fff; + border-radius: 8px; + padding: 0 3px; + } + .card-issue { + background: rgb(76,175,80); + } + .card-issue a { + color: #fff; + } @media (max-width: 960px) { .draft img { float: none; @@ -606,8 +617,9 @@ } .contextlinks { - font-size: 14px; - margin-bottom: 5px; + color: #fff; + xfont-size: 14px; + xmargin-bottom: 5px; } /************************************************************************* diff -r 71f54c43d7cb -r 64229f002a47 app/main/issue/_list.lua --- a/app/main/issue/_list.lua Tue Mar 24 16:59:32 2020 +0100 +++ b/app/main/issue/_list.lua Thu Jul 30 23:15:49 2020 +0200 @@ -195,7 +195,7 @@ end if not for_issue and not for_initiative then - ui.container{ attr = { class = "mdl-card__title mdl-card--has-fab mdl-card--border" }, content = function() + ui.container{ attr = { class = "mdl-card__title mdl-card--has-fab mdl-card--border card-issue" }, content = function() ui.container{ attr = { class = "contextlinks" }, content = function() if not (config.single_unit_id and config.single_area_id) then if not config.single_unit_id then @@ -220,9 +220,9 @@ module = "issue", view = "show", id = issue.id, attr = { class = "issue" }, content = issue.name } - end } - ui.container{ attr = { class = "mdl-card__subtitle-text .mdl-cell--hide-phone" }, content = function() - ui.container{ attr = { class = class }, content = function () +-- end } +-- ui.container{ attr = { class = "mdl-card__subtitle-text .mdl-cell--hide-phone" }, content = function() + ui.container{ attr = { class = class, style = "float: right; color: #fff;" }, content = function () if event_icon then ui.tag{ tag = "i", attr = { class = "material-icons", ["aria-hidden"] = "true" }, content = event_icon } end diff -r 71f54c43d7cb -r 64229f002a47 app/main/issue/_sidebar_members.lua --- a/app/main/issue/_sidebar_members.lua Tue Mar 24 16:59:32 2020 +0100 +++ b/app/main/issue/_sidebar_members.lua Thu Jul 30 23:15:49 2020 +0200 @@ -28,6 +28,7 @@ :join("issue", nil, { "issue.id = ?", issue.id }) :join("direct_voter", nil, { "direct_voter.issue_id = ? AND direct_voter.member_id = member.id", issue.id }) :join("vote", nil, { "vote.member_id = member.id AND vote.initiative_id = ?", initiative.id }) + :add_field("direct_voter.ownweight", "ownweight") :add_field("direct_voter.weight", "voter_weight") :add_field("vote.grade") :add_field("direct_voter.comment", "voter_comment") @@ -35,12 +36,14 @@ interested_members_selector = Member:new_selector() :join("issue", nil, { "issue.id = ?", issue.id }) :join("direct_voter", nil, { "direct_voter.issue_id = ? AND direct_voter.member_id = member.id", issue.id }) + :add_field("direct_voter.ownweight", "ownweight") :add_field("direct_voter.weight", "voter_weight") :add_field("direct_voter.comment", "voter_comment") end else interested_members_selector = issue:get_reference_selector("interested_members_snapshot") :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id") + :add_field("direct_interest_snapshot.ownweight") :add_field("direct_interest_snapshot.weight") :add_where("direct_interest_snapshot.snapshot_id = issue.latest_snapshot_id") diff -r 71f54c43d7cb -r 64229f002a47 app/main/member/_show_thumb.lua --- a/app/main/member/_show_thumb.lua Tue Mar 24 16:59:32 2020 +0100 +++ b/app/main/member/_show_thumb.lua Thu Jul 30 23:15:49 2020 +0200 @@ -42,15 +42,31 @@ local el_id = multirand.string(32, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") local weight = 0 +local ownweight = member.ownweight if member.weight then weight = member.weight end if member.voter_weight then weight = member.voter_weight end +local delegated_weight = weight - (ownweight or 0) + +local weight_text = "" + +if ownweight and ownweight > 1 then + weight_text = weight_text .. ownweight +end + +if delegated_weight > 0 then + weight_text = weight_text .. "+" .. delegated_weight +end + +if weight_text == "" then + weight_text = nil +end ui.container{ - attr = { id = el_id, class = container_class, ["data-badge"] = weight > 1 and "+" .. weight - 1 or nil }, + attr = { id = el_id, class = container_class }, content = function() execute.view{ @@ -64,7 +80,13 @@ } ui.tag{ attr = { class = "mdl-chip__text" }, - content = function() slot.put(name_html) end + content = function() + slot.put(name_html) + if weight_text then + slot.put(" ") + ui.tag{ attr = { class = "member_weight" }, content = weight_text } + end + end } if member.grade then