# HG changeset patch # User bsw # Date 1534180667 -7200 # Node ID 68eb999c7bfbb5b937151aab31f89ecea6089cf8 # Parent 3bbf39ad3d3e22485a670ad65d59f9d4f48a5d27 Changed style of register image upload diff -r 3bbf39ad3d3e -r 68eb999c7bfb app/main/registration/_register_form.lua --- a/app/main/registration/_register_form.lua Fri Aug 10 14:10:43 2018 +0200 +++ b/app/main/registration/_register_form.lua Mon Aug 13 19:17:47 2018 +0200 @@ -106,11 +106,22 @@ elseif field.type == "image" then slot.put("
") - 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 .. ":" } - slot.put("   ") - ui.tag{ tag = "input", attr = { type = "file", name = "verification_data_" .. field.name } } + ui.tag{ tag = "label", attr = { style = "display: block; vertical-align: bottom; border-bottom: 1px solid rgba(0,0,0, 0.12); color: #777; font-size: 16px;" }, content = field.label .. ":" } + ui.script{ script = [[ + function getFile(){ + document.getElementById("upfile").click(); + } + function fileChoosen(obj){ + var file = obj.value; + var fileName = file.split("\\"); + document.getElementById("fileBtn").innerHTML = fileName[fileName.length-1]; + event.preventDefault(); + } + ]] } + ui.tag{ attr = { id = "fileBtn", onclick = "getFile();"}, content = field.upload_label } + ui.tag{ tag = "input", attr = { style = "display: none;", type = "file", name = "verification_data_" .. field.name, onchange = "fileChoosen(this);" } } if field.optional_checkbox then - slot.put("

") + slot.put("   ") ui.tag{ tag = "label", attr = { class = "mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect", ["for"] = "verification_data_" .. field.name .. "_optout"