bsw@525: local issue = param.get("issue", "table") bsw@525: local initiative_limit = param.get("initiative_limit", atom.integer) bsw@525: local for_listing = param.get("for_listing", atom.boolean) bsw@525: bsw@525: local direct_voter bsw@525: if app.session.member_id then bsw@547: direct_voter = issue.member_info.direct_voted bsw@525: end bsw@525: bsw@525: local voteable = app.session.member_id and issue.state == 'voting' and bsw@525: app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) bsw@525: bsw@525: local vote_link_text = direct_voter and _"Change vote" or "Vote now" bsw@525: bsw@525: bsw@525: local class = "issue" bsw@525: if issue.is_interested then bsw@525: class = class .. " interested" bsw@525: elseif issue.is_interested_by_delegation_to_member_id then bsw@525: class = class .. " interested_by_delegation" bsw@525: end bsw@525: bsw@525: ui.container{ attr = { class = class }, content = function() bsw@525: bsw@525: execute.view{ module = "delegation", view = "_info", params = { issue = issue } } bsw@525: bsw@525: ui.container{ attr = { class = "title" }, content = function() bsw@525: bsw@525: ui.link{ bsw@525: attr = { class = "issue_id" }, bsw@525: text = _("#{policy_name} ##{issue_id}", { bsw@525: policy_name = issue.policy.name, bsw@525: issue_id = issue.id bsw@525: }), bsw@525: module = "issue", bsw@525: view = "show", bsw@525: id = issue.id bsw@525: } bsw@528: if for_listing then bsw@528: ui.tag{ attr = { class = "extra" }, content = function() bsw@528: ui.tag{ content = issue.area.unit.name } bsw@528: slot.put(" · ") bsw@528: ui.tag{ content = issue.area.name } bsw@528: end } bsw@528: end bsw@525: end } bsw@525: bsw@525: ui.tag{ bsw@525: attr = { class = "content issue_policy_info" }, bsw@525: tag = "div", bsw@525: content = function() bsw@525: bsw@525: ui.tag{ attr = { class = "event_name" }, content = issue.state_name } bsw@525: bsw@525: if issue.state_time_left then bsw@525: slot.put(" · ") bsw@525: if issue.state_time_left:sub(1,1) == "-" then bsw@525: if issue.state == "new" then bsw@525: ui.tag{ content = _("Discussion starts soon") } bsw@525: elseif issue.state == "discussion" then bsw@525: ui.tag{ content = _("Verification starts soon") } bsw@525: elseif issue.state == "frozen" then bsw@525: ui.tag{ content = _("Voting starts soon") } bsw@525: elseif issue.state == "voting" then bsw@525: ui.tag{ content = _("Counting starts soon") } bsw@525: end bsw@525: else bsw@525: ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day") }) } bsw@525: end bsw@525: end bsw@525: bsw@525: end bsw@525: } bsw@525: bsw@525: ui.container{ bsw@525: attr = { class = "content actions" }, content = function() bsw@525: bsw@525: if voteable then bsw@525: ui.link{ bsw@525: content = vote_link_text, bsw@525: module = "vote", bsw@525: view = "list", bsw@525: params = { issue_id = issue.id } bsw@525: } bsw@525: slot.put(" · ") bsw@525: end bsw@525: bsw@525: if app.session.member_id then bsw@525: execute.view{ bsw@525: module = "interest", bsw@525: view = "_show_box", bsw@525: params = { issue = issue, initiative = initiative } bsw@525: } bsw@525: slot.put(" · ") bsw@525: end bsw@525: bsw@529: if not issue.closed then bsw@547: if issue.member_info.own_delegation_scope ~= "issue" then bsw@529: ui.link{ text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id } } bsw@529: else bsw@529: ui.link{ text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id } } bsw@529: end bsw@529: slot.put(" · ") bsw@529: end bsw@529: bsw@525: if config.issue_discussion_url_func then bsw@525: local url = config.issue_discussion_url_func(issue) bsw@525: ui.link{ bsw@525: attr = { target = "_blank" }, bsw@525: external = url, bsw@525: content = _"Discussion on issue" bsw@525: } bsw@525: slot.put(" · ") bsw@525: end bsw@525: bsw@525: if config.etherpad and app.session.member then bsw@525: ui.link{ bsw@525: attr = { target = "_blank" }, bsw@525: external = issue.etherpad_url, bsw@525: content = _"Issue pad" bsw@525: } bsw@525: slot.put(" · ") bsw@525: end bsw@525: bsw@525: bsw@525: if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then bsw@525: if not issue.fully_frozen and not issue.closed then bsw@525: ui.link{ bsw@525: attr = { class = "action" }, bsw@525: text = _"Create alternative initiative", bsw@525: module = "initiative", bsw@525: view = "new", bsw@525: params = { issue_id = issue.id } bsw@525: } bsw@525: end bsw@525: end bsw@525: bsw@525: end } bsw@525: bsw@525: if not for_listing then bsw@525: bsw@525: if voteable then bsw@525: ui.container{ bsw@525: attr = { class = "voting_active_info" }, bsw@525: content = function() bsw@525: slot.put(_"Voting for this issue is currently running!") bsw@525: slot.put(" ") bsw@525: if app.session.member_id then bsw@525: ui.link{ bsw@525: content = vote_link_text, bsw@525: module = "vote", bsw@525: view = "list", bsw@525: params = { issue_id = issue.id } bsw@525: } bsw@525: end bsw@525: end bsw@525: } bsw@525: end bsw@525: bsw@527: if issue.state == "cancelled" then bsw@527: local policy = issue.policy bsw@527: ui.container{ bsw@527: attr = { class = "not_admitted_info" }, bsw@527: content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) }) bsw@527: } bsw@527: end bsw@527: bsw@525: end bsw@525: bsw@525: ui.container{ attr = { class = "initiative_list" }, content = function() bsw@525: bsw@525: local initiatives_selector = issue:get_reference_selector("initiatives") bsw@525: local highlight_string = param.get("highlight_string") bsw@525: if highlight_string then bsw@525: initiatives_selector:add_field( {'"highlight"("initiative"."name", ?)', highlight_string }, "name_highlighted") bsw@525: end bsw@525: execute.view{ bsw@525: module = "initiative", bsw@525: view = "_list", bsw@525: params = { bsw@525: issue = issue, bsw@525: initiatives_selector = initiatives_selector, bsw@525: highlight_string = highlight_string, bsw@525: per_page = initiative_limit, bsw@525: no_sort = true, bsw@525: limit = initiative_limit, bsw@525: for_member = for_member bsw@525: } bsw@525: } bsw@525: end } bsw@525: end } bsw@525: