liquid_feedback_frontend

changeset 1484:c5d3f93df7ed

Added more inline help to policy editor
author bsw
date Mon Oct 29 14:35:37 2018 +0100 (2018-10-29)
parents 18831d75ea87
children 2626155efb83
files app/main/admin/_action/policy_update.lua app/main/admin/policy_show.lua
line diff
     1.1 --- a/app/main/admin/_action/policy_update.lua	Mon Oct 29 13:38:41 2018 +0100
     1.2 +++ b/app/main/admin/_action/policy_update.lua	Mon Oct 29 14:35:37 2018 +0100
     1.3 @@ -6,11 +6,17 @@
     1.4    "min_admission_time", "max_admission_time", "discussion_time", "verification_time", "voting_time", 
     1.5    "issue_quorum", "issue_quorum_num", "issue_quorum_den",
     1.6    "initiative_quorum", "initiative_quorum_num", "initiative_quorum_den", 
     1.7 -  "direct_majority_num", "direct_majority_den", "direct_majority_strict", "direct_majority_positive", "direct_majority_non_negative",
     1.8 +  "direct_majority_num", "direct_majority_den", "direct_majority_positive", "direct_majority_non_negative",
     1.9    "indirect_majority_num", "indirect_majority_den", "indirect_majority_strict", "indirect_majority_positive", "indirect_majority_non_negative",
    1.10    "no_reverse_beat_path", "no_multistage_majority", "polling"
    1.11  )
    1.12  
    1.13 +if param.get("direct_majority_strict") == "1" then 
    1.14 +  policy.direct_majority_strict = true 
    1.15 +else 
    1.16 +  policy.direct_majority_strict = false 
    1.17 +end
    1.18 +
    1.19  if policy.min_admission_time == "" then policy.min_admission_time = nil end
    1.20  if policy.max_admission_time == "" then policy.max_admission_time = nil end
    1.21  if policy.discussion_time == "" then policy.discussion_time = nil end
     2.1 --- a/app/main/admin/policy_show.lua	Mon Oct 29 13:38:41 2018 +0100
     2.2 +++ b/app/main/admin/policy_show.lua	Mon Oct 29 14:35:37 2018 +0100
     2.3 @@ -1,3 +1,83 @@
     2.4 +local function field(name, label, value, tooltip)
     2.5 +  ui.field.text{
     2.6 +    container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
     2.7 +    attr = { id = "field_" .. name, class = "mdl-textfield__input" },
     2.8 +    label_attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
     2.9 +    label = label,
    2.10 +    name = name,
    2.11 +    value = value or nil
    2.12 +  }
    2.13 +  if tooltip then
    2.14 +    ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name }, content = tooltip }
    2.15 +  end
    2.16 +end
    2.17 +
    2.18 +local function rational_field(name, label, value_num, value_den, tooltip)
    2.19 +
    2.20 +  ui.container{
    2.21 +    attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
    2.22 +    content = function()
    2.23 +      ui.tag{
    2.24 +        attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
    2.25 +        content = label
    2.26 +      }
    2.27 +      ui.field.text{
    2.28 +        container_attr = { style = "display: inline-block;" },
    2.29 +        attr = { style = "width: 3em;", id = "field_" .. name .. "_num", class = "mdl-textfield__input" },
    2.30 +        name = name .. "_num",
    2.31 +        value = value_num or nil
    2.32 +      }
    2.33 +      slot.put(" / ")
    2.34 +      ui.field.text{
    2.35 +        container_attr = { style = "display: inline-block;" },
    2.36 +        attr = { style = "width: 3em;", id = "field_" .. name .. "_den", class = "mdl-textfield__input" },
    2.37 +        name = name .. "_den",
    2.38 +        value = value_den or nil
    2.39 +      }
    2.40 +    end
    2.41 +  }
    2.42 +  if tooltip then
    2.43 +    ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_num" }, content = tooltip }
    2.44 +    ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_den" }, content = tooltip }
    2.45 +  end
    2.46 +end
    2.47 +
    2.48 +local function majority_field(name, label, value_num, value_den, strict, tooltip)
    2.49 +
    2.50 +  ui.container{
    2.51 +    attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
    2.52 +    content = function()
    2.53 +      ui.tag{
    2.54 +        attr = { class = "mdl-textfield__label", ["for"] = "field_" .. name },
    2.55 +        content = label
    2.56 +      }
    2.57 +      ui.tag{ tag = "select", attr = { name = name .. "_strict" }, content = function()
    2.58 +        ui.tag{ tag = "option", attr = { value = "0", selected = not strict and "selected" or nil }, content = "≥" }
    2.59 +        ui.tag{ tag = "option", attr = { value = "1", selected = strict and "selected" or nil }, content = ">" }
    2.60 +      end }
    2.61 +      slot.put(" ")
    2.62 +      ui.field.text{
    2.63 +        container_attr = { style = "display: inline-block;" },
    2.64 +        attr = { style = "width: 3em;", id = "field_" .. name .. "_num", class = "mdl-textfield__input" },
    2.65 +        name = name .. "_num",
    2.66 +        value = value_num or nil
    2.67 +      }
    2.68 +      slot.put(" / ")
    2.69 +      ui.field.text{
    2.70 +        container_attr = { style = "display: inline-block;" },
    2.71 +        attr = { style = "width: 3em;", id = "field_" .. name .. "_den", class = "mdl-textfield__input" },
    2.72 +        name = name .. "_den",
    2.73 +        value = value_den or nil
    2.74 +      }
    2.75 +    end
    2.76 +  }
    2.77 +  if tooltip then
    2.78 +    ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_num" }, content = tooltip }
    2.79 +    ui.container{ attr = { class = "mdl-tooltip", ["for"] = "field_" .. name .. "_den" }, content = tooltip }
    2.80 +  end
    2.81 +end
    2.82 +
    2.83 +
    2.84  local policy = Policy:by_id(param.get_id()) or Policy:new()
    2.85  
    2.86  local hint = not policy.id
    2.87 @@ -27,33 +107,48 @@
    2.88            id = policy.id,
    2.89            content = function()
    2.90  
    2.91 -            ui.field.text{ label = _"Index",        name = "index", value = hint and "1" or nil }
    2.92 +            field("index", "Index (for sorting)", hint and "1" or nil)
    2.93 +            ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil }
    2.94  
    2.95 -            ui.field.text{ label = _"Name",        name = "name" }
    2.96 +            field("name", "Name")
    2.97 +          
    2.98              ui.field.text{ label = _"Description", name = "description", multiline = true }
    2.99              ui.field.text{ label = _"Hint",        readonly = true, 
   2.100                              value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" }
   2.101  
   2.102 -            ui.field.text{ label = _"Minimum admission time",     name = "min_admission_time", value = hint and "0" or nil }
   2.103 -            ui.field.text{ label = _"Maximum admission time",     name = "max_admission_time", value = hint and "30 days" or nil }
   2.104 -            ui.field.text{ label = _"Discussion time",    name = "discussion_time", value = hint and "30 days" or nil }
   2.105 -            ui.field.text{ label = _"Verification time",  name = "verification_time", value = hint and "15 days" or nil }
   2.106 -            ui.field.text{ label = _"Voting time",        name = "voting_time", value = hint and "15 days" or nil }
   2.107 -
   2.108 -            ui.field.text{ label = _"Issue quorum",   name = "issue_quorum", value = hint and "1" or nil }
   2.109 -            ui.field.text{ label = _"Issue quorum numerator",   name = "issue_quorum_num", value = hint and "1" or nil }
   2.110 -            ui.field.text{ label = _"Issue quorum denominator",   name = "issue_quorum_den", value = hint and "10" or nil }
   2.111 +                            
   2.112 +            ui.heading{ level = 5, content = _"Admission phase" }
   2.113 +            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).")
   2.114 +            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.")
   2.115 +            ui.field.boolean{ attr = { id = "field_polling" }, label = _"Polling mode", name = "polling", value = hint and false or nil }
   2.116 +            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." }
   2.117 +                            
   2.118 +            ui.heading{ level = 5, content = _"First quorum" }
   2.119 +            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." }
   2.120 +            field("issue_quorum", _"Absolute issue quorum", hint and "1" or nil, _"Minimum absolute number of supporters.")
   2.121 +            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.")
   2.122  
   2.123 -            ui.field.text{ label = _"Initiative quorum absolute",   name = "initiative_quorum", value = hint and "1" or nil }
   2.124 -            ui.field.text{ label = _"Initiative quorum numerator",   name = "initiative_quorum_num", value = hint and "10" or nil }
   2.125 -            ui.field.text{ label = _"Initiative quorum denominator", name = "initiative_quorum_den", value = hint and "100" or nil }
   2.126 +            ui.heading{ level = 5, content = _"Discussion phase" }
   2.127 +            field("discussion_time", _"Discussion time", hint and "30 days" or nil, _"Duration of discussion phase of an issue.")
   2.128 +            
   2.129 +            ui.heading{ level = 5, content = _"Verification phase" }
   2.130 +            field("verification_time", _"Verfication time", hint and "7 days" or nil, _"Duration of verification phase of an issue.")
   2.131 +            
   2.132 +            ui.heading{ level = 5, content = _"Second quorum" }
   2.133 +            ui.container{ content = _"Minimum supporter count (including support via delegation) an initiative has to reach to be an eligible candidate for the voting phase." }
   2.134 +            field("initiative_quorum", _"Absolute initiative quorum", hint and "1" or nil, _"Minimum absolute number of supporters.")
   2.135 +            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.")
   2.136  
   2.137 -            ui.field.text{ label = _"Direct majority numerator",   name = "direct_majority_num", value = hint and "50" or nil }
   2.138 -            ui.field.text{ label = _"Direct majority denominator", name = "direct_majority_den", value = hint and "100" or nil }
   2.139 -            ui.field.boolean{ label = _"Strict direct majority", name = "direct_majority_strict", value = hint and true or nil }
   2.140 -            ui.field.text{ label = _"Direct majority positive",   name = "direct_majority_positive", value = hint and "0" or nil }
   2.141 -            ui.field.text{ label = _"Direct majority non negative", name = "direct_majority_non_negative", value = hint and "0" or nil }
   2.142 +            ui.heading{ level = 5, content = _"Voting phase" }
   2.143 +            field("voting_time", _"Voting time", hint and "15 days" or nil, _"Duration of voting phase of an issue.")
   2.144  
   2.145 +            ui.heading{ level = 5, content = _"Required majorities" }
   2.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.")
   2.147 +            field("direct_majority_positive", _"Absolute number of approval votes", hint and "0" or nil, _"The minimum absolute number of approval votes.")
   2.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.")
   2.149 +
   2.150 +            ui.heading{ level = 5, content = _"Experimental features" }
   2.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." }
   2.152              ui.field.text{ label = _"Indirect majority numerator",   name = "indirect_majority_num", value = hint and "50" or nil }
   2.153              ui.field.text{ label = _"Indirect majority denominator", name = "indirect_majority_den", value = hint and "100" or nil }
   2.154              ui.field.boolean{ label = _"Strict indirect majority", name = "indirect_majority_strict", value = hint and true or nil }
   2.155 @@ -62,10 +157,8 @@
   2.156  
   2.157              ui.field.boolean{ label = _"No reverse beat path", name = "no_reverse_beat_path", value = hint and false or nil }
   2.158              ui.field.boolean{ label = _"No multistage majority", name = "no_multistage_majority", value = hint and false or nil }
   2.159 -            ui.field.boolean{ label = _"Polling mode", name = "polling", value = hint and false or nil }
   2.160  
   2.161 -
   2.162 -            ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil }
   2.163 +            slot.put("<br />")
   2.164  
   2.165              ui.submit{ 
   2.166                attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },

Impressum / About Us