| rev | 
   line source | 
| 
bsw/jbe@52
 | 
     1 local policy = Policy:by_id(param.get_id())
 | 
| 
bsw/jbe@52
 | 
     2 
 | 
| 
bsw/jbe@52
 | 
     3 slot.put_into("title", encode.html(_("Policy '#{name}'", { name = policy.name })))
 | 
| 
bsw/jbe@52
 | 
     4 
 | 
| 
bsw/jbe@52
 | 
     5 ui.form{
 | 
| 
bsw/jbe@52
 | 
     6   attr = { class = "vertical" },
 | 
| 
bsw/jbe@52
 | 
     7   record = policy,
 | 
| 
bsw/jbe@52
 | 
     8   content = function()
 | 
| 
bsw@900
 | 
     9     if policy.polling then
 | 
| 
bsw@900
 | 
    10       ui.field.text{ label = _"New" .. ":", value = _"without" }
 | 
| 
bsw@900
 | 
    11     else
 | 
| 
bsw@1234
 | 
    12       ui.field.text{ label = _"New" .. ":", value = "≤ min " .. policy.min_admission_time }
 | 
| 
bsw@1234
 | 
    13       ui.field.text{ label = _"New" .. ":", value = "≤ max " .. policy.max_admission_time }
 | 
| 
bsw@900
 | 
    14     end
 | 
| 
bsw@902
 | 
    15     ui.field.text{ label = _"Discussion" .. ":", value = policy.discussion_time or _"variable" }
 | 
| 
bsw@902
 | 
    16     ui.field.text{ label = _"Frozen" .. ":", value = policy.verification_time or _"variable" }
 | 
| 
bsw@902
 | 
    17     ui.field.text{ label = _"Voting" .. ":", value = policy.voting_time or _"variable" }
 | 
| 
bsw@902
 | 
    18     
 | 
| 
bsw@900
 | 
    19     if policy.polling then
 | 
| 
bsw@900
 | 
    20       ui.field.text{ label = _"Issue quorum" .. ":", value = _"without" }
 | 
| 
bsw@900
 | 
    21     else
 | 
| 
bsw@900
 | 
    22       ui.field.text{
 | 
| 
bsw@900
 | 
    23         label = _"Issue quorum",
 | 
| 
bsw@900
 | 
    24         value = "≥ " .. tostring(policy.issue_quorum_num) .. "/" .. tostring(policy.issue_quorum_den)
 | 
| 
bsw@900
 | 
    25       }
 | 
| 
bsw@900
 | 
    26     end
 | 
| 
bsw/jbe@52
 | 
    27     ui.field.text{
 | 
| 
bsw/jbe@52
 | 
    28       label = _"Initiative quorum",
 | 
| 
bsw/jbe@52
 | 
    29       value = "≥ " .. tostring(policy.initiative_quorum_num) .. "/" .. tostring(policy.initiative_quorum_den)
 | 
| 
bsw/jbe@52
 | 
    30     }
 | 
| 
bsw/jbe@52
 | 
    31     ui.field.text{
 | 
| 
bsw@286
 | 
    32       label = _"Direct majority",
 | 
| 
bsw@286
 | 
    33       value = 
 | 
| 
bsw@286
 | 
    34         (policy.direct_majority_strict and ">" or "≥" ) .. " "
 | 
| 
bsw@286
 | 
    35         .. tostring(policy.direct_majority_num) .. "/"
 | 
| 
bsw@286
 | 
    36         .. tostring(policy.direct_majority_den) 
 | 
| 
bsw@286
 | 
    37         .. (policy.direct_majority_positive > 1 and ", " .. _("at least #{count} approvals", { count = policy.direct_majority_positive }) or "")
 | 
| 
bsw@286
 | 
    38         .. (policy.direct_majority_non_negative > 1 and ", " .. _("at least #{count} approvals or abstentions", { count = policy.direct_majority_non_negative }) or "")
 | 
| 
bsw/jbe@52
 | 
    39     }
 | 
| 
bsw/jbe@52
 | 
    40 
 | 
| 
bsw@286
 | 
    41     ui.field.text{
 | 
| 
bsw@286
 | 
    42       label = _"Indirect majority",
 | 
| 
bsw@286
 | 
    43       value = 
 | 
| 
bsw@286
 | 
    44         (policy.indirect_majority_strict and ">" or "≥" ) .. " "
 | 
| 
bsw@286
 | 
    45         .. tostring(policy.indirect_majority_num) .. "/"
 | 
| 
bsw@286
 | 
    46         .. tostring(policy.indirect_majority_den) 
 | 
| 
bsw@286
 | 
    47         .. (policy.indirect_majority_positive > 1 and ", " .. _("at least #{count} approvals", { count = policy.indirect_majority_positive }) or "")
 | 
| 
bsw@286
 | 
    48         .. (policy.indirect_majority_non_negative > 1 and ", " .. _("at least #{count} approvals or abstentions", { count = policy.indirect_majority_non_negative }) or "")
 | 
| 
bsw@286
 | 
    49     }
 | 
| 
bsw@286
 | 
    50 
 | 
| 
bsw@286
 | 
    51     local texts = {}
 | 
| 
bsw@286
 | 
    52     if policy.no_reverse_beat_path then
 | 
| 
bsw@286
 | 
    53       texts[#texts+1] = _"no reverse beat path to status quo (including ties)"
 | 
| 
bsw@286
 | 
    54     end
 | 
| 
bsw@286
 | 
    55     if policy.no_multistage_majority then
 | 
| 
bsw@286
 | 
    56       texts[#texts+1] = _"prohibit potentially instable results caused by multistage majorities"
 | 
| 
bsw@286
 | 
    57     end
 | 
| 
bsw@286
 | 
    58     ui.field.text{
 | 
| 
bsw@286
 | 
    59       label = _"Options",
 | 
| 
bsw@286
 | 
    60       value = table.concat(texts, ", ")
 | 
| 
bsw@286
 | 
    61     }
 | 
| 
bsw@900
 | 
    62     if policy.description and #policy.description > 0 then
 | 
| 
bsw@900
 | 
    63       ui.container{
 | 
| 
bsw@900
 | 
    64         attr = { class = "suggestion_content wiki" },
 | 
| 
bsw@900
 | 
    65         content = function()
 | 
| 
bsw@900
 | 
    66           ui.tag{
 | 
| 
bsw@900
 | 
    67             tag = "p",
 | 
| 
bsw@900
 | 
    68             content = policy.description
 | 
| 
bsw@900
 | 
    69           }
 | 
| 
bsw@900
 | 
    70         end
 | 
| 
bsw@900
 | 
    71       }
 | 
| 
bsw@900
 | 
    72     end
 | 
| 
bsw/jbe@52
 | 
    73 
 | 
| 
bsw/jbe@52
 | 
    74   end
 | 
| 
bsw/jbe@52
 | 
    75 }
 |