liquid_feedback_frontend
changeset 1719:9b8dc1828f1f
If only one policy is available, choose it automatically
author | bsw |
---|---|
date | Mon Sep 27 13:07:56 2021 +0200 (2021-09-27) |
parents | 26b0b4fb09fe |
children | a63c2dacf619 |
files | app/main/draft/new.lua |
line diff
1.1 --- a/app/main/draft/new.lua Mon Sep 27 13:03:36 2021 +0200 1.2 +++ b/app/main/draft/new.lua Mon Sep 27 13:07:56 2021 +0200 1.3 @@ -253,14 +253,21 @@ 1.4 tmp[#tmp+1] = allowed_policy 1.5 end 1.6 end 1.7 - ui.container{ content = _"Please choose a policy for the new issue:" } 1.8 - ui.field.select{ 1.9 - name = "policy_id", 1.10 - foreign_records = tmp, 1.11 - foreign_id = "id", 1.12 - foreign_name = "name", 1.13 - value = param.get("policy_id", atom.integer) or area.default_policy and area.default_policy.id 1.14 - } 1.15 + if #area.allowed_policies > 1 then 1.16 + ui.container{ content = _"Please choose a policy for the new issue:" } 1.17 + ui.field.select{ 1.18 + name = "policy_id", 1.19 + foreign_records = tmp, 1.20 + foreign_id = "id", 1.21 + foreign_name = "name", 1.22 + value = param.get("policy_id", atom.integer) or area.default_policy and area.default_policy.id 1.23 + } 1.24 + else 1.25 + ui.field.hidden{ 1.26 + name = "policy_id", 1.27 + value = area.allowed_policies[1].id 1.28 + } 1.29 + end 1.30 if policy and policy.free_timeable then 1.31 local available_timings 1.32 if config.free_timing and config.free_timing.available_func then