liquid_feedback_frontend
changeset 1350:a1a2f59e083e
Changed order of unit dropdown
author | bsw |
---|---|
date | Mon Aug 06 13:20:49 2018 +0200 (2018-08-06) |
parents | 14a75a6c02c3 |
children | d4f69226dc01 |
files | app/main/registration/_register_form.lua app/main/registration_admin/verification.lua |
line diff
1.1 --- a/app/main/registration/_register_form.lua Mon Aug 06 13:15:16 2018 +0200 1.2 +++ b/app/main/registration/_register_form.lua Mon Aug 06 13:20:49 2018 +0200 1.3 @@ -96,13 +96,16 @@ 1.4 if field.where then 1.5 units_selector:add_where(field.where) 1.6 end 1.7 - local units = units_selector:exec() 1.8 + local units = {} 1.9 if field.optional then 1.10 table.insert(units, { 1.11 id = "", 1.12 name = _"None" 1.13 }) 1.14 end 1.15 + for i_unit, unit in ipairs(units_selector:exec()) do 1.16 + table.insert(units, unit) 1.17 + end 1.18 ui.field.select{ 1.19 label = field.label, 1.20 foreign_records = units,
2.1 --- a/app/main/registration_admin/verification.lua Mon Aug 06 13:15:16 2018 +0200 2.2 +++ b/app/main/registration_admin/verification.lua Mon Aug 06 13:20:49 2018 +0200 2.3 @@ -71,19 +71,23 @@ 2.4 if field.where then 2.5 units_selector:add_where(field.where) 2.6 end 2.7 - local units = units_selector:exec() 2.8 + local units = {} 2.9 if field.optional then 2.10 table.insert(units, { 2.11 id = "", 2.12 name = _"None" 2.13 }) 2.14 end 2.15 + for j, units in ipairs(units_selector:exec()) do 2.16 + table.insert(units, unit) 2.17 + end 2.18 ui.field.select{ 2.19 label = field.label, 2.20 foreign_records = units, 2.21 foreign_id = "id", 2.22 foreign_name = "name", 2.23 - name = field.name 2.24 + name = field.name, 2.25 + value = tonumber(data[field.name]) 2.26 } 2.27 else 2.28 ui.field.text{