liquid_feedback_frontend
view app/main/admin/policy_show.lua @ 1482:7cdc537f991f
Show correct quorum in initiative not admitted info
| author | bsw | 
|---|---|
| date | Wed Oct 24 14:49:56 2018 +0200 (2018-10-24) | 
| parents | f3082de14228 | 
| children | c5d3f93df7ed | 
 line source
     1 local policy = Policy:by_id(param.get_id()) or Policy:new()
     3 local hint = not policy.id
     5 ui.titleAdmin(_"Policy")
     7 ui.grid{ content = function()
     9   ui.cell_main{ content = function()
    10     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
    11       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    12         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = policy and policy.name or _"New policy" }
    13       end }
    14       ui.container{ attr = { class = "mdl-card__content" }, content = function()
    15         ui.form{
    16           attr = { class = "vertical" },
    17           record = policy,
    18           module = "admin",
    19           action = "policy_update",
    20           routing = {
    21             default = {
    22               mode = "redirect",
    23               module = "admin",
    24               view = "index"
    25             }
    26           },
    27           id = policy.id,
    28           content = function()
    30             ui.field.text{ label = _"Index",        name = "index", value = hint and "1" or nil }
    32             ui.field.text{ label = _"Name",        name = "name" }
    33             ui.field.text{ label = _"Description", name = "description", multiline = true }
    34             ui.field.text{ label = _"Hint",        readonly = true, 
    35                             value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" }
    37             ui.field.text{ label = _"Minimum admission time",     name = "min_admission_time", value = hint and "0" or nil }
    38             ui.field.text{ label = _"Maximum admission time",     name = "max_admission_time", value = hint and "30 days" or nil }
    39             ui.field.text{ label = _"Discussion time",    name = "discussion_time", value = hint and "30 days" or nil }
    40             ui.field.text{ label = _"Verification time",  name = "verification_time", value = hint and "15 days" or nil }
    41             ui.field.text{ label = _"Voting time",        name = "voting_time", value = hint and "15 days" or nil }
    43             ui.field.text{ label = _"Issue quorum",   name = "issue_quorum", value = hint and "1" or nil }
    44             ui.field.text{ label = _"Issue quorum numerator",   name = "issue_quorum_num", value = hint and "1" or nil }
    45             ui.field.text{ label = _"Issue quorum denominator",   name = "issue_quorum_den", value = hint and "10" or nil }
    47             ui.field.text{ label = _"Initiative quorum absolute",   name = "initiative_quorum", value = hint and "1" or nil }
    48             ui.field.text{ label = _"Initiative quorum numerator",   name = "initiative_quorum_num", value = hint and "10" or nil }
    49             ui.field.text{ label = _"Initiative quorum denominator", name = "initiative_quorum_den", value = hint and "100" or nil }
    51             ui.field.text{ label = _"Direct majority numerator",   name = "direct_majority_num", value = hint and "50" or nil }
    52             ui.field.text{ label = _"Direct majority denominator", name = "direct_majority_den", value = hint and "100" or nil }
    53             ui.field.boolean{ label = _"Strict direct majority", name = "direct_majority_strict", value = hint and true or nil }
    54             ui.field.text{ label = _"Direct majority positive",   name = "direct_majority_positive", value = hint and "0" or nil }
    55             ui.field.text{ label = _"Direct majority non negative", name = "direct_majority_non_negative", value = hint and "0" or nil }
    57             ui.field.text{ label = _"Indirect majority numerator",   name = "indirect_majority_num", value = hint and "50" or nil }
    58             ui.field.text{ label = _"Indirect majority denominator", name = "indirect_majority_den", value = hint and "100" or nil }
    59             ui.field.boolean{ label = _"Strict indirect majority", name = "indirect_majority_strict", value = hint and true or nil }
    60             ui.field.text{ label = _"Indirect majority positive",   name = "indirect_majority_positive", value = hint and "0" or nil }
    61             ui.field.text{ label = _"Indirect majority non negative", name = "indirect_majority_non_negative", value = hint and "0" or nil }
    63             ui.field.boolean{ label = _"No reverse beat path", name = "no_reverse_beat_path", value = hint and false or nil }
    64             ui.field.boolean{ label = _"No multistage majority", name = "no_multistage_majority", value = hint and false or nil }
    65             ui.field.boolean{ label = _"Polling mode", name = "polling", value = hint and false or nil }
    68             ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil }
    70             ui.submit{ 
    71               attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },
    72               text = _"update policy" 
    73             }
    74             slot.put(" ")
    75             ui.link { 
    76               attr = { class = "mdl-button mdl-js-button" },
    77               module = "admin", view = "index", content = _"cancel" 
    78             }
    79           end
    80         }
    81       end }
    82     end }
    83   end }
    84 end }
