bsw@194: local policy = Policy:by_id(param.get_id()) or Policy:new() bsw@194: bsw@1045: local hint = not policy.id bsw@1045: bsw@1184: ui.titleAdmin(_"Policy") bsw@1045: bsw@1463: ui.grid{ content = function() bsw@194: bsw@1463: ui.cell_main{ content = function() bsw@1463: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1463: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1463: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = policy and policy.name or _"New policy" } bsw@1463: end } bsw@1463: ui.container{ attr = { class = "mdl-card__content" }, content = function() bsw@1463: ui.form{ bsw@1463: attr = { class = "vertical" }, bsw@1463: record = policy, bsw@1045: module = "admin", bsw@1463: action = "policy_update", bsw@1463: routing = { bsw@1463: default = { bsw@1463: mode = "redirect", bsw@1463: module = "admin", bsw@1463: view = "index" bsw@1463: } bsw@1463: }, bsw@1463: id = policy.id, bsw@1463: content = function() bsw@194: bsw@1463: ui.field.text{ label = _"Index", name = "index", value = hint and "1" or nil } bsw@194: bsw@1463: ui.field.text{ label = _"Name", name = "name" } bsw@1463: ui.field.text{ label = _"Description", name = "description", multiline = true } bsw@1463: ui.field.text{ label = _"Hint", readonly = true, bsw@1463: value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" } bsw@194: bsw@1463: ui.field.text{ label = _"Minimum admission time", name = "min_admission_time", value = hint and "0" or nil } bsw@1463: ui.field.text{ label = _"Maximum admission time", name = "max_admission_time", value = hint and "30 days" or nil } bsw@1463: ui.field.text{ label = _"Discussion time", name = "discussion_time", value = hint and "30 days" or nil } bsw@1463: ui.field.text{ label = _"Verification time", name = "verification_time", value = hint and "15 days" or nil } bsw@1463: ui.field.text{ label = _"Voting time", name = "voting_time", value = hint and "15 days" or nil } bsw@194: bsw@1463: ui.field.text{ label = _"Issue quorum", name = "issue_quorum", value = hint and "1" or nil } bsw@1463: ui.field.text{ label = _"Issue quorum numerator", name = "issue_quorum_num", value = hint and "1" or nil } bsw@1463: ui.field.text{ label = _"Issue quorum denominator", name = "issue_quorum_den", value = hint and "10" or nil } bsw@1045: bsw@1463: ui.field.text{ label = _"Initiative quorum absolute", name = "initiative_quorum", value = hint and "1" or nil } bsw@1463: ui.field.text{ label = _"Initiative quorum numerator", name = "initiative_quorum_num", value = hint and "10" or nil } bsw@1463: ui.field.text{ label = _"Initiative quorum denominator", name = "initiative_quorum_den", value = hint and "100" or nil } bsw@194: bsw@1463: ui.field.text{ label = _"Direct majority numerator", name = "direct_majority_num", value = hint and "50" or nil } bsw@1463: ui.field.text{ label = _"Direct majority denominator", name = "direct_majority_den", value = hint and "100" or nil } bsw@1463: ui.field.boolean{ label = _"Strict direct majority", name = "direct_majority_strict", value = hint and true or nil } bsw@1463: ui.field.text{ label = _"Direct majority positive", name = "direct_majority_positive", value = hint and "0" or nil } bsw@1463: ui.field.text{ label = _"Direct majority non negative", name = "direct_majority_non_negative", value = hint and "0" or nil } bsw@194: bsw@1463: ui.field.text{ label = _"Indirect majority numerator", name = "indirect_majority_num", value = hint and "50" or nil } bsw@1463: ui.field.text{ label = _"Indirect majority denominator", name = "indirect_majority_den", value = hint and "100" or nil } bsw@1463: ui.field.boolean{ label = _"Strict indirect majority", name = "indirect_majority_strict", value = hint and true or nil } bsw@1463: ui.field.text{ label = _"Indirect majority positive", name = "indirect_majority_positive", value = hint and "0" or nil } bsw@1463: ui.field.text{ label = _"Indirect majority non negative", name = "indirect_majority_non_negative", value = hint and "0" or nil } bsw@282: bsw@1463: ui.field.boolean{ label = _"No reverse beat path", name = "no_reverse_beat_path", value = hint and false or nil } bsw@1463: ui.field.boolean{ label = _"No multistage majority", name = "no_multistage_majority", value = hint and false or nil } bsw@1463: ui.field.boolean{ label = _"Polling mode", name = "polling", value = hint and false or nil } bsw@282: bsw@194: bsw@1463: ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil } bsw@194: bsw@1463: ui.submit{ text = _"update policy" } bsw@1463: slot.put(" ") bsw@1463: ui.link { module = "admin", view = "index", content = _"cancel" } bsw@1463: end bsw@1463: } bsw@1463: end } bsw@1463: end } bsw@1463: end } bsw@1463: end }