liquid_feedback_frontend

view 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
line source
1 flocal function field(name, label, value, tooltip)
2 ui.field.text{
3 container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
4 attr = { id = "field_" .. name, class = "mdl-textfield__input" },
5 label_attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
6 label = label,
7 name = name,
8 value = value or nil
9 }
10 if tooltip then
11 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name }, content = tooltip }
12 end
13 end
15 local function rational_field(name, label, value_num, value_den, tooltip)
17 ui.container{
18 attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
19 content = function()
20 ui.tag{
21 attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
22 content = label
23 }
24 ui.field.text{
25 container_attr = { style = "display: inline-block;" },
26 attr = { style = "width: 3em;", id = "field_" .. name .. "_num", class = "mdl-textfield__input" },
27 name = name .. "_num",
28 value = value_num or nil
29 }
30 slot.put(" / ")
31 ui.field.text{
32 container_attr = { style = "display: inline-block;" },
33 attr = { style = "width: 3em;", id = "field_" .. name .. "_den", class = "mdl-textfield__input" },
34 name = name .. "_den",
35 value = value_den or nil
36 }
37 end
38 }
39 if tooltip then
40 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_num" }, content = tooltip }
41 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_den" }, content = tooltip }
42 end
43 end
45 local function majority_field(name, label, value_num, value_den, strict, tooltip)
47 ui.container{
48 attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
49 content = function()
50 ui.tag{
51 attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
52 content = label
53 }
54 ui.tag{ tag = "select", attr = { name = name .. "_strict" }, content = function()
55 ui.tag{ tag = "option", attr = { value = "0", selected = not strict and "selected" or nil }, content = "≥" }
56 ui.tag{ tag = "option", attr = { value = "1", selected = strict and "selected" or nil }, content = ">" }
57 end }
58 slot.put(" ")
59 ui.field.text{
60 container_attr = { style = "display: inline-block;" },
61 attr = { style = "width: 3em;", id = "field_" .. name .. "_num", class = "mdl-textfield__input" },
62 name = name .. "_num",
63 value = value_num or nil
64 }
65 slot.put(" / ")
66 ui.field.text{
67 container_attr = { style = "display: inline-block;" },
68 attr = { style = "width: 3em;", id = "field_" .. name .. "_den", class = "mdl-textfield__input" },
69 name = name .. "_den",
70 value = value_den or nil
71 }
72 end
73 }
74 if tooltip then
75 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_num" }, content = tooltip }
76 ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_den" }, content = tooltip }
77 end
78 end
81 local policy = Policy:by_id(param.get_id()) or Policy:new()
83 local hint = not policy.id
85 ui.titleAdmin(_"Policy")
87 ui.grid{ content = function()
89 ui.cell_main{ content = function()
90 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
91 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
92 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = policy and policy.name or _"New policy" }
93 end }
94 ui.container{ attr = { class = "mdl-card__content" }, content = function()
95 ui.form{
96 attr = { class = "vertical" },
97 record = policy,
98 module = "admin",
99 action = "policy_update",
100 routing = {
101 default = {
102 mode = "redirect",
103 module = "admin",
104 view = "index"
105 }
106 },
107 id = policy.id,
108 content = function()
110 field("index", _"Index (for sorting)", hint and "1" or nil)
111 ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil }
113 field("name", _"Name")
115 ui.field.text{ label = _"Description", name = "description", multiline = true }
116 ui.field.text{ label = _"Hint", readonly = true,
117 value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" }
120 ui.heading{ level = 5, content = _"Admission phase" }
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).")
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.")
123 ui.field.boolean{ attr = { id = "field_polling" }, label = _"Polling mode", name = "polling", value = hint and false or nil }
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." }
126 ui.heading{ level = 5, content = _"First quorum" }
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." }
128 field("issue_quorum", _"Absolute issue quorum", hint and "1" or nil, _"Minimum absolute number of supporters.")
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.")
131 ui.heading{ level = 5, content = _"Discussion phase" }
132 field("discussion_time", _"Discussion time", hint and "30 days" or nil, _"Duration of discussion phase of an issue.")
134 ui.heading{ level = 5, content = _"Verification phase" }
135 field("verification_time", _"Verfication time", hint and "7 days" or nil, _"Duration of verification phase of an issue.")
137 ui.heading{ level = 5, content = _"Second quorum" }
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." }
139 field("initiative_quorum", _"Absolute initiative quorum", hint and "1" or nil, _"Minimum absolute number of supporters.")
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.")
142 ui.heading{ level = 5, content = _"Voting phase" }
143 field("voting_time", _"Voting time", hint and "15 days" or nil, _"Duration of voting phase of an issue.")
145 ui.heading{ level = 5, content = _"Required majorities" }
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.")
147 field("direct_majority_positive", _"Absolute number of approval votes", hint and "0" or nil, _"The minimum absolute number of approval votes.")
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.")
150 ui.heading{ level = 5, content = _"Experimental features" }
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." }
152 ui.field.text{ label = _"Indirect majority numerator", name = "indirect_majority_num", value = hint and "50" or nil }
153 ui.field.text{ label = _"Indirect majority denominator", name = "indirect_majority_den", value = hint and "100" or nil }
154 ui.field.boolean{ label = _"Strict indirect majority", name = "indirect_majority_strict", value = hint and true or nil }
155 ui.field.text{ label = _"Indirect majority positive", name = "indirect_majority_positive", value = hint and "0" or nil }
156 ui.field.text{ label = _"Indirect majority non negative", name = "indirect_majority_non_negative", value = hint and "0" or nil }
158 ui.field.boolean{ label = _"No reverse beat path", name = "no_reverse_beat_path", value = hint and false or nil }
159 ui.field.boolean{ label = _"No multistage majority", name = "no_multistage_majority", value = hint and false or nil }
161 slot.put("<br />")
163 ui.submit{
164 attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },
165 text = _"update policy"
166 }
167 slot.put(" ")
168 ui.link {
169 attr = { class = "mdl-button mdl-js-button" },
170 module = "admin", view = "index", content = _"cancel"
171 }
172 end
173 }
174 end }
175 end }
176 end }
177 end }

Impressum / About Us