# HG changeset patch # User bsw # Date 1634647536 -7200 # Node ID c28ff4a85dedc951b22702296e4f7315dc35182f # Parent 7dcbcbf492e3eb86aa43baa13f46c3b10fdddc7f Removed unused views diff -r 7dcbcbf492e3 -r c28ff4a85ded app/main/_filter/21_auth.lua --- a/app/main/_filter/21_auth.lua Tue Oct 19 14:42:20 2021 +0200 +++ b/app/main/_filter/21_auth.lua Tue Oct 19 14:45:36 2021 +0200 @@ -61,8 +61,6 @@ module == "index" and view == "index" or module == "area" and view == "show" or module == "unit" and view == "show" - or module == "policy" and view == "show" - or module == "policy" and view == "list" or module == "issue" and view == "show" or module == "issue" and view == "history" or module == "initiative" and view == "show" diff -r 7dcbcbf492e3 -r c28ff4a85ded app/main/initiative/_sidebar_policies.lua --- a/app/main/initiative/_sidebar_policies.lua Tue Oct 19 14:42:20 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -local area = param.get("area", "table") - -ui.sidebar ( "tab-whatcanido", function () - ui.sidebarHead( function() - ui.heading { level = 2, content = _"Available policies" } - end ) - execute.view { module = "policy", view = "_list", params = { - for_area = area - } } -end ) \ No newline at end of file diff -r 7dcbcbf492e3 -r c28ff4a85ded app/main/policy/_list.lua --- a/app/main/policy/_list.lua Tue Oct 19 14:42:20 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -local for_area = param.get("for_area", "table") - -local selector = Policy:new_selector() - :add_where("policy.active") - :add_order_by("policy.index") - -if for_area then - selector:join("allowed_policy", nil, - { "allowed_policy.policy_id = policy.id AND allowed_policy.area_id = ?", for_area.id } - ) -end - -local policies = selector:exec() - - -for i, policy in ipairs(policies) do - ui.container { - attr = { class = "sidebarRow", id = "policy" .. policy.id }, - content = function () - - ui.heading { level = 3, content = policy.name } - - if policy.description and #(policy.description) > 0 then - ui.tag{ - content = policy.description - } - slot.put ( "
" ) - end - - ui.link { - attr = { - class = "policy-show-details", - onclick = "$('#policy" .. policy.id .. " .policy-details').show(); $('#policy" .. policy.id .. " .policy-show-details').hide(); $('#policy" .. policy.id .. " .policy-hide-details').show(); return false;" - }, - content = _"show details" - } - - ui.link { - attr = { - class = "policy-hide-details", - onclick = "$('#policy" .. policy.id .. " .policy-details').hide(); $('#policy" .. policy.id .. " .policy-show-details').show(); $('#policy" .. policy.id .. " .policy-hide-details').hide(); return false;", - style = "display: none;" - }, - content = _"hide details" - } - - ui.container { - attr = { - class = "policy-details", - style = "display: none;" - }, - content = function () - - ui.heading { level = 4, content = _"Phase durations" } - - if policy.polling then - ui.field.text{ label = _"New" .. ":", value = _"without" } - else - ui.field.text{ label = _"New" .. ":", value = "≥ " .. format.interval_text(policy.min_admission_time) } - ui.field.text{ label = _"New" .. ":", value = "≤ " .. format.interval_text(policy.max_admission_time) } - end - ui.field.text{ label = _"Discussion" .. ":", value = format.interval_text(policy.discussion_time) or _"variable" } - ui.field.text{ label = _"Frozen" .. ":", value = format.interval_text(policy.verification_time) or _"variable" } - ui.field.text{ label = _"Voting" .. ":", value = format.interval_text(policy.voting_time) or _"variable" } - - ui.heading { level = 4, content = _"Quorums" } - - if policy.polling then - ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" } - else - ui.field.text{ - label = _"Issue quorum" .. ":", - value = "≥ " .. tostring(policy.issue_quorum) - } - end - ui.field.text{ - label = _"Initiative quorum" .. ":", - value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den) - } - ui.field.text{ - label = _"Direct majority" .. ":", - value = (policy.direct_majority_strict and ">" or "≥" ) .. " " .. tostring(policy.direct_majority_num) .. "/" .. tostring(policy.direct_majority_den) - } - ui.field.text{ - label = _"Indirect majority" .. ":", - value = (policy.indirect_majority_strict and ">" or "≥" ) .. " " .. tostring(policy.indirect_majority_num) .. "/" .. tostring(policy.indirect_majority_den) - } - end - } - end - } -end diff -r 7dcbcbf492e3 -r c28ff4a85ded app/main/policy/list.lua --- a/app/main/policy/list.lua Tue Oct 19 14:42:20 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -ui.title(_"Policies") - -execute.view { module = "policy", view = "_list" } \ No newline at end of file diff -r 7dcbcbf492e3 -r c28ff4a85ded app/main/policy/show.lua --- a/app/main/policy/show.lua Tue Oct 19 14:42:20 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -local policy = Policy:by_id(param.get_id()) - -slot.put_into("title", encode.html(_("Policy '#{name}'", { name = policy.name }))) - -ui.form{ - attr = { class = "vertical" }, - record = policy, - content = function() - if policy.polling then - ui.field.text{ label = _"New" .. ":", value = _"without" } - else - ui.field.text{ label = _"New" .. ":", value = "≤ min " .. policy.min_admission_time } - ui.field.text{ label = _"New" .. ":", value = "≤ max " .. policy.max_admission_time } - end - ui.field.text{ label = _"Discussion" .. ":", value = policy.discussion_time or _"variable" } - ui.field.text{ label = _"Frozen" .. ":", value = policy.verification_time or _"variable" } - ui.field.text{ label = _"Voting" .. ":", value = policy.voting_time or _"variable" } - - if policy.polling then - ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" } - else - ui.field.text{ - label = _"Issue quorum", - value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den) - } - end - ui.field.text{ - label = _"Initiative quorum", - value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den) - } - ui.field.text{ - label = _"Direct majority", - value = - (policy.direct_majority_strict and ">" or "≥" ) .. " " - .. tostring(policy.direct_majority_num) .. "/" - .. tostring(policy.direct_majority_den) - .. (policy.direct_majority_positive > 1 and ", " .. _("at least #{count} approvals", { count = policy.direct_majority_positive }) or "") - .. (policy.direct_majority_non_negative > 1 and ", " .. _("at least #{count} approvals or abstentions", { count = policy.direct_majority_non_negative }) or "") - } - - ui.field.text{ - label = _"Indirect majority", - value = - (policy.indirect_majority_strict and ">" or "≥" ) .. " " - .. tostring(policy.indirect_majority_num) .. "/" - .. tostring(policy.indirect_majority_den) - .. (policy.indirect_majority_positive > 1 and ", " .. _("at least #{count} approvals", { count = policy.indirect_majority_positive }) or "") - .. (policy.indirect_majority_non_negative > 1 and ", " .. _("at least #{count} approvals or abstentions", { count = policy.indirect_majority_non_negative }) or "") - } - - local texts = {} - if policy.no_reverse_beat_path then - texts[#texts+1] = _"no reverse beat path to status quo (including ties)" - end - if policy.no_multistage_majority then - texts[#texts+1] = _"prohibit potentially instable results caused by multistage majorities" - end - ui.field.text{ - label = _"Options", - value = table.concat(texts, ", ") - } - if policy.description and #policy.description > 0 then - ui.container{ - attr = { class = "suggestion_content wiki" }, - content = function() - ui.tag{ - tag = "p", - content = policy.description - } - end - } - end - - end -}