liquid_feedback_frontend
diff app/main/registration/_register_form.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
| author | bsw/jbe |
|---|---|
| date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
| parents | |
| children | 7cdc685bb7a6 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/registration/_register_form.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -0,0 +1,102 @@ 1.4 +for i, field in ipairs(config.self_registration.fields) do 1.5 + local class = "" 1.6 + local field_error = slot.get_content("self_registration__invalid_" .. field.name) 1.7 + if field_error == "" then 1.8 + field_error = nil 1.9 + end 1.10 + if field_error then 1.11 + class = " is-invalid" 1.12 + end 1.13 + if field.name == "date_of_birth" then 1.14 + slot.put("<br />") 1.15 + ui.tag{ tag = "label", attr = { style = "vertical-align: bottom; border-bottom: 1px solid rgba(0,0,0, 0.12); color: #777; font-size: 16px;" }, content = field.label .. ":" } 1.16 + slot.put(" ") 1.17 + local days = { { id = 0, name = _"day" } } 1.18 + for i = 1, 31 do 1.19 + table.insert(days, { id = i, name = i }) 1.20 + end 1.21 + local months = { 1.22 + { id = 0, name = _"month" }, 1.23 + { id = 1, name = "gennaio" }, 1.24 + { id = 2, name = "febbraio" }, 1.25 + { id = 3, name = "marzo" }, 1.26 + { id = 4, name = "aprile" }, 1.27 + { id = 5, name = "maggio" }, 1.28 + { id = 6, name = "giugno" }, 1.29 + { id = 7, name = "luglio" }, 1.30 + { id = 8, name = "agosto" }, 1.31 + { id = 9, name = "settembre" }, 1.32 + { id = 10, name = "ottobre" }, 1.33 + { id = 11, name = "novembre" }, 1.34 + { id = 12, name = "dicembre" }, 1.35 + } 1.36 + if config.self_registration.lang == "en" then 1.37 + months = { 1.38 + { id = 0, name = _"month" }, 1.39 + { id = 1, name = "January" }, 1.40 + { id = 2, name = "February" }, 1.41 + { id = 3, name = "March" }, 1.42 + { id = 4, name = "April" }, 1.43 + { id = 5, name = "May" }, 1.44 + { id = 6, name = "June" }, 1.45 + { id = 7, name = "July" }, 1.46 + { id = 8, name = "August" }, 1.47 + { id = 9, name = "September" }, 1.48 + { id = 10, name = "October" }, 1.49 + { id = 11, name = "November" }, 1.50 + { id = 12, name = "December" }, 1.51 + } 1.52 + end 1.53 + local years = { { id = 0, name = _"year" } } 1.54 + for i = 2002, 1900, -1 do 1.55 + table.insert(years, { id = i, name = i }) 1.56 + end 1.57 + ui.field.select{ 1.58 + container_attr = { style = "display: inline-block; " }, 1.59 + attr = { class = class }, 1.60 + foreign_records = days, 1.61 + foreign_id = "id", 1.62 + foreign_name = "name", 1.63 + name = "verification_data_" .. field.name .. "_day", 1.64 + value = tonumber(request.get_param{ name = "verification_data_" .. field.name .. "_day" }) 1.65 + } 1.66 + slot.put(" ") 1.67 + ui.field.select{ 1.68 + container_attr = { style = "display: inline-block; " }, 1.69 + attr = { class = class }, 1.70 + foreign_records = months, 1.71 + foreign_id = "id", 1.72 + foreign_name = "name", 1.73 + name = "verification_data_" .. field.name .. "_month", 1.74 + value = tonumber(request.get_param{ name = "verification_data_" .. field.name .. "_month" }) 1.75 + } 1.76 + slot.put(" ") 1.77 + ui.field.select{ 1.78 + container_attr = { style = "display: inline-block; " }, 1.79 + attr = { class = class }, 1.80 + foreign_records = years, 1.81 + foreign_id = "id", 1.82 + foreign_name = "name", 1.83 + name = "verification_data_" .. field.name .. "_year", 1.84 + value = tonumber(request.get_param{ name = "verification_data_" .. field.name .. "_year" }) 1.85 + } 1.86 + slot.put("<br />") 1.87 + 1.88 + else 1.89 + if field.name == "mobile_phone" then 1.90 + if config.self_registration.lang ~= "en" then 1.91 + ui.tag{ content = "+39" } 1.92 + slot.put(" ") 1.93 + end 1.94 + end 1.95 + ui.field.text{ 1.96 + container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" .. class }, 1.97 + attr = { id = "lf-register__data_" .. field.name, class = "mdl-textfield__input" }, 1.98 + label_attr = { class = "mdl-textfield__label", ["for"] = "lf-register__data" .. field.name }, 1.99 + label = field.label, 1.100 + name = "verification_data_" .. field.name, 1.101 + value = request.get_param{ name = "verification_data_" .. field.name } 1.102 + } 1.103 + end 1.104 + slot.put("<br />") 1.105 +end