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