bsw@211: local initiative = param.get("initiative", "table") bsw@211: bsw@211: ui.container{ attr = { class = "bar" }, content = function() bsw@211: if initiative.issue.fully_frozen and initiative.issue.closed then bsw@211: if initiative.issue.ranks_available then bsw@211: if initiative.negative_votes and initiative.positive_votes then bsw@211: local max_value = initiative.issue.voter_count bsw@211: ui.bargraph{ bsw@211: max_value = max_value, bsw@211: width = 100, bsw@211: bars = { bsw@211: { color = "#0a0", value = initiative.positive_votes }, bsw@211: { color = "#aaa", value = max_value - initiative.negative_votes - initiative.positive_votes }, bsw@211: { color = "#a00", value = initiative.negative_votes }, bsw@211: } bsw@211: } bsw@211: else bsw@211: slot.put(" ") bsw@211: end bsw@211: else bsw@211: slot.put(_"Counting of votes") bsw@211: end bsw@211: elseif initiative.issue.population then bsw@211: local max_value = initiative.issue.population bsw@211: ui.bargraph{ bsw@211: max_value = max_value, bsw@211: width = 100, bsw@211: quorum = max_value * (initiative.issue.policy.initiative_quorum_num / initiative.issue.policy.initiative_quorum_den), bsw@211: quorum_color = "#00F", bsw@211: bars = { bsw@211: { color = "#0a0", value = (initiative.satisfied_supporter_count or 0) }, bsw@211: { color = "#bbb", value = (initiative.supporter_count or 0) - (initiative.satisfied_supporter_count or 0) }, bsw@211: { color = "#eee", value = max_value - (initiative.supporter_count or 0) }, bsw@211: } bsw@211: } bsw@211: else bsw@211: slot.put(" ") bsw@211: end bsw@211: end } bsw@211: bsw@211: if initiative.issue.fully_frozen and not initiative.issue.closed then bsw@211: if not initiative.admitted then bsw@211: ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" } bsw@211: slot.put(" ") bsw@211: end bsw@211: end bsw@211: bsw@211: ui.link{ bsw@211: module = "lf2", view = "initiative", id = initiative.id, bsw@215: attr = { class = "name" }, bsw@211: text = initiative.name bsw@211: } bsw@211: bsw@211: ui.container{ attr = { class = "authors" }, content = function() bsw@211: local members = initiative.initiating_members bsw@211: slot.put(_"by", " ") bsw@211: for i, member in ipairs(members) do bsw@211: if i > 1 and i < #members then bsw@211: slot.put(", ") bsw@211: elseif i > 1 then bsw@211: slot.put(" ", _"and", " ") bsw@211: end bsw@211: ui.link{ bsw@216: module = "lf2", view = "interest", params = { bsw@216: issue_id = initiative.issue_id, bsw@216: member_id = member.id bsw@216: }, content = function() bsw@211: ui.tag{ content = member.name } bsw@211: end bsw@211: } bsw@211: end bsw@211: end } bsw@211: bsw@211: