liquid_feedback_frontend

annotate app/main/admin/policy_show.lua @ 1795:2526423907d9

Added missing translations
author bsw
date Thu Oct 21 14:46:56 2021 +0200 (2021-10-21)
parents c5d3f93df7ed
children 16206342faca
rev   line source
bsw@1795 1 flocal function field(name, label, value, tooltip)
bsw@1484 2 ui.field.text{
bsw@1484 3 container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
bsw@1484 4 attr = { id = "field_" .. name, class = "mdl-textfield__input" },
bsw@1484 5 label_attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
bsw@1484 6 label = label,
bsw@1484 7 name = name,
bsw@1484 8 value = value or nil
bsw@1484 9 }
bsw@1484 10 if tooltip then
bsw@1484 11 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name }, content = tooltip }
bsw@1484 12 end
bsw@1484 13 end
bsw@1484 14
bsw@1484 15 local function rational_field(name, label, value_num, value_den, tooltip)
bsw@1484 16
bsw@1484 17 ui.container{
bsw@1484 18 attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
bsw@1484 19 content = function()
bsw@1484 20 ui.tag{
bsw@1484 21 attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
bsw@1484 22 content = label
bsw@1484 23 }
bsw@1484 24 ui.field.text{
bsw@1484 25 container_attr = { style = "display: inline-block;" },
bsw@1484 26 attr = { style = "width: 3em;", id = "field_" .. name .. "_num", class = "mdl-textfield__input" },
bsw@1484 27 name = name .. "_num",
bsw@1484 28 value = value_num or nil
bsw@1484 29 }
bsw@1484 30 slot.put(" / ")
bsw@1484 31 ui.field.text{
bsw@1484 32 container_attr = { style = "display: inline-block;" },
bsw@1484 33 attr = { style = "width: 3em;", id = "field_" .. name .. "_den", class = "mdl-textfield__input" },
bsw@1484 34 name = name .. "_den",
bsw@1484 35 value = value_den or nil
bsw@1484 36 }
bsw@1484 37 end
bsw@1484 38 }
bsw@1484 39 if tooltip then
bsw@1484 40 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_num" }, content = tooltip }
bsw@1484 41 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_den" }, content = tooltip }
bsw@1484 42 end
bsw@1484 43 end
bsw@1484 44
bsw@1484 45 local function majority_field(name, label, value_num, value_den, strict, tooltip)
bsw@1484 46
bsw@1484 47 ui.container{
bsw@1484 48 attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
bsw@1484 49 content = function()
bsw@1484 50 ui.tag{
bsw@1484 51 attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
bsw@1484 52 content = label
bsw@1484 53 }
bsw@1484 54 ui.tag{ tag = "select", attr = { name = name .. "_strict" }, content = function()
bsw@1484 55 ui.tag{ tag = "option", attr = { value = "0", selected = not strict and "selected" or nil }, content = "≥" }
bsw@1484 56 ui.tag{ tag = "option", attr = { value = "1", selected = strict and "selected" or nil }, content = ">" }
bsw@1484 57 end }
bsw@1484 58 slot.put(" ")
bsw@1484 59 ui.field.text{
bsw@1484 60 container_attr = { style = "display: inline-block;" },
bsw@1484 61 attr = { style = "width: 3em;", id = "field_" .. name .. "_num", class = "mdl-textfield__input" },
bsw@1484 62 name = name .. "_num",
bsw@1484 63 value = value_num or nil
bsw@1484 64 }
bsw@1484 65 slot.put(" / ")
bsw@1484 66 ui.field.text{
bsw@1484 67 container_attr = { style = "display: inline-block;" },
bsw@1484 68 attr = { style = "width: 3em;", id = "field_" .. name .. "_den", class = "mdl-textfield__input" },
bsw@1484 69 name = name .. "_den",
bsw@1484 70 value = value_den or nil
bsw@1484 71 }
bsw@1484 72 end
bsw@1484 73 }
bsw@1484 74 if tooltip then
bsw@1484 75 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_num" }, content = tooltip }
bsw@1484 76 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_den" }, content = tooltip }
bsw@1484 77 end
bsw@1484 78 end
bsw@1484 79
bsw@1484 80
bsw@194 81 local policy = Policy:by_id(param.get_id()) or Policy:new()
bsw@194 82
bsw@1045 83 local hint = not policy.id
bsw@1045 84
bsw@1184 85 ui.titleAdmin(_"Policy")
bsw@1045 86
bsw@1463 87 ui.grid{ content = function()
bsw@194 88
bsw@1463 89 ui.cell_main{ content = function()
bsw@1463 90 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1463 91 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1463 92 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = policy and policy.name or _"New policy" }
bsw@1463 93 end }
bsw@1463 94 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1463 95 ui.form{
bsw@1463 96 attr = { class = "vertical" },
bsw@1463 97 record = policy,
bsw@1045 98 module = "admin",
bsw@1463 99 action = "policy_update",
bsw@1463 100 routing = {
bsw@1463 101 default = {
bsw@1463 102 mode = "redirect",
bsw@1463 103 module = "admin",
bsw@1463 104 view = "index"
bsw@1463 105 }
bsw@1463 106 },
bsw@1463 107 id = policy.id,
bsw@1463 108 content = function()
bsw@194 109
bsw@1795 110 field("index", _"Index (for sorting)", hint and "1" or nil)
bsw@1484 111 ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil }
bsw@194 112
bsw@1795 113 field("name", _"Name")
bsw@1484 114
bsw@1463 115 ui.field.text{ label = _"Description", name = "description", multiline = true }
bsw@1463 116 ui.field.text{ label = _"Hint", readonly = true,
bsw@1463 117 value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" }
bsw@194 118
bsw@1484 119
bsw@1484 120 ui.heading{ level = 5, content = _"Admission phase" }
bsw@1484 121 field("min_admission_time", _"Minimum admission time", hint and "0" or nil, _"Minimum time an issue has to stay in admission phase before it can be accepted for discussion (if it reaches the 1st quorum).")
bsw@1484 122 field("max_admission_time", _"Maximum admission time", hint and "30 days" or nil, _"Maximum time within which an issue has to reach the 1st quorum, otherwise it will be canceled.")
bsw@1484 123 ui.field.boolean{ attr = { id = "field_polling" }, label = _"Polling mode", name = "polling", value = hint and false or nil }
bsw@1484 124 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_polling" }, content = _"Skip admission phase and start issue in discussion phase (can only be started by members with polling privilege). If enabled, minimum and maximum admission time as well as 1st quorum needs to be cleared." }
bsw@1484 125
bsw@1484 126 ui.heading{ level = 5, content = _"First quorum" }
bsw@1484 127 ui.container{ content = _"Minimum supporter count (including support via delegation) one initiative of an issue has to reach to let the issue pass the 1st quorum and to proceed to discussion phase. Further requirements can occur due to per subject area issue limiter settings. See subject area settings." }
bsw@1484 128 field("issue_quorum", _"Absolute issue quorum", hint and "1" or nil, _"Minimum absolute number of supporters.")
bsw@1484 129 rational_field("issue_quorum", "Relative issue quorum", hint and "1" or nil, hint and "100" or nil, _"Minimum number of supporters relative to the number of active participants in the organizational unit.")
bsw@1045 130
bsw@1484 131 ui.heading{ level = 5, content = _"Discussion phase" }
bsw@1484 132 field("discussion_time", _"Discussion time", hint and "30 days" or nil, _"Duration of discussion phase of an issue.")
bsw@1484 133
bsw@1484 134 ui.heading{ level = 5, content = _"Verification phase" }
bsw@1484 135 field("verification_time", _"Verfication time", hint and "7 days" or nil, _"Duration of verification phase of an issue.")
bsw@1484 136
bsw@1484 137 ui.heading{ level = 5, content = _"Second quorum" }
bsw@1484 138 ui.container{ content = _"Minimum supporter count (including support via delegation) an initiative has to reach to be an eligible candidate for the voting phase." }
bsw@1484 139 field("initiative_quorum", _"Absolute initiative quorum", hint and "1" or nil, _"Minimum absolute number of supporters.")
bsw@1484 140 rational_field("initiative_quorum", "Relative initiative quorum", hint and "1" or nil, hint and "100" or nil, _"Minimum number of supporters relative to the number of active participants in the organizational unit.")
bsw@194 141
bsw@1484 142 ui.heading{ level = 5, content = _"Voting phase" }
bsw@1484 143 field("voting_time", _"Voting time", hint and "15 days" or nil, _"Duration of voting phase of an issue.")
bsw@194 144
bsw@1484 145 ui.heading{ level = 5, content = _"Required majorities" }
bsw@1484 146 majority_field("direct_majority", _"Majority", hint and "50" or nil, hint and "100" or nil, policy.direct_majority_strict, "The required majority of approval votes relative to the sum of approval and disapproval votes for the same initiative.")
bsw@1484 147 field("direct_majority_positive", _"Absolute number of approval votes", hint and "0" or nil, _"The minimum absolute number of approval votes.")
bsw@1484 148 field("direct_majority_non_negative", _"Absolute number of approval and abstention votes", hint and "0" or nil, _"The minimum absolute number of approval votes.")
bsw@1484 149
bsw@1484 150 ui.heading{ level = 5, content = _"Experimental features" }
bsw@1484 151 ui.container{ content = _"The following settings for experimental features should only be changed with sufficient knowledge about the Schulze method and its implementation in LiquidFeedback." }
bsw@1463 152 ui.field.text{ label = _"Indirect majority numerator", name = "indirect_majority_num", value = hint and "50" or nil }
bsw@1463 153 ui.field.text{ label = _"Indirect majority denominator", name = "indirect_majority_den", value = hint and "100" or nil }
bsw@1463 154 ui.field.boolean{ label = _"Strict indirect majority", name = "indirect_majority_strict", value = hint and true or nil }
bsw@1463 155 ui.field.text{ label = _"Indirect majority positive", name = "indirect_majority_positive", value = hint and "0" or nil }
bsw@1463 156 ui.field.text{ label = _"Indirect majority non negative", name = "indirect_majority_non_negative", value = hint and "0" or nil }
bsw@282 157
bsw@1463 158 ui.field.boolean{ label = _"No reverse beat path", name = "no_reverse_beat_path", value = hint and false or nil }
bsw@1463 159 ui.field.boolean{ label = _"No multistage majority", name = "no_multistage_majority", value = hint and false or nil }
bsw@282 160
bsw@1484 161 slot.put("<br />")
bsw@194 162
bsw@1464 163 ui.submit{
bsw@1464 164 attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },
bsw@1464 165 text = _"update policy"
bsw@1464 166 }
bsw@1463 167 slot.put(" ")
bsw@1464 168 ui.link {
bsw@1464 169 attr = { class = "mdl-button mdl-js-button" },
bsw@1464 170 module = "admin", view = "index", content = _"cancel"
bsw@1464 171 }
bsw@1463 172 end
bsw@1463 173 }
bsw@1463 174 end }
bsw@1463 175 end }
bsw@1463 176 end }
bsw@1463 177 end }

Impressum / About Us