def boton_eliminar(accion): cad = "<a href='#' title='Eliminar'>" cad2 = "<i class='fas fa-trash-alt'" cad2 += " onClick=\"if(confirm('¿Desea eliminar este dato?')) " cad2 += "window.location='%s';\"></i>" % accion cad += htm.span(cad2, 'icon') + '</a>' return cad
def file_upload(destino, retorno): cad = "<form action='%s' method='post' enctype='multipart/form-data'>" % destino # cad += "<div id='fileupld' class='file has-name'>" # cad += "<label class='file-label'>" # cad += "<input class='file-input' type='file' name='file'>" # cad += "<span class='file-cta'>" # cad += htm.span("<i class='fas fa-upload'></i>", 'file-icon') # cad += '</span>' # cad += htm.span('Seleccione un archivo...', 'file-label') # cad += '</span>' # cad += htm.span('...', 'file-name') # cad += '</label>' # cad += botones(retorno) # cad += '</div></form>' # cad += script_file() cad += "<div id = 'file-js-example' class ='file has-name'>" cad += "<label class ='file-label'>" cad += "<input class ='file-input' type='file' name='archivo'>" cad += "<span class ='file-cta'>" cad += htm.span("<i class ='fas fa-upload'></i>", "file-icon") cad += htm.span("Elija un archivo...", "file-label") cad += "</span>" cad += htm.span("No se subió ningún archivo", "file-name") cad += "</label>" cad += "</div>" cad += botones(retorno) cad += "</form>" cad += "<script>" cad += "const fileInput = document.querySelector('#file-js-example input[type=file]');" cad += "fileInput.onchange = () => {" cad += "if (fileInput.files.length > 0)" cad += "{" cad += "const fileName = document.querySelector('#file-js-example .file-name');" cad += "fileName.textContent = fileInput.files[0].name;" cad += "}" cad += "}" cad += "</script>" return cad
def boton_cerrar(retorno): cad = "<a class='button is-light is-small' href='%s'>" % retorno cad2 = "<i class='fas fa-window-close'></i>" cad += htm.span(cad2, 'icon is-small') cad += htm.span('Cerrar') + '</a>' return htm.div(cad, 'buttons is-right')
def faicon(icono, color='grey'): return htm.span("<i class='%s'></i>" % icono, "icon has-text-%s" % color)
def nav_bar(enlace, icono, texto): cad = "<a class='navbar-item' href='%s'>" % enlace cad += faicon(icono) cad += htm.span(texto) cad += '</a>' return cad