datosServer = function(id, rvs) {
moduleServer(id, function(input, output, session) {
observeEvent(input$fuente, {
if (input$fuente == "local") {
shinyjs::show("inputs_local")
updateActionButton(session, "btn_obtener_datos", "Subir datos")
} else {
shinyjs::hide("inputs_local")
updateActionButton(session, "btn_obtener_datos", "Descargar datos")
}
})
# Descarga de datos.
# Se almacenan localmente para ahorrar transferencia y tiempo.
observeEvent(input$btn_obtener_datos, {
if (input$fuente == "local") {
print("local")
} else {
# TODO: Bloquear boton hasta que los datos se terminen de cargar
rvs$datos = descargar_base(input$encuesta)
rvs$datos_replicas = descargar_replicas(input$encuesta)
}
})
# Descarga de manuales
output$descargar_manual = downloadHandler(
filename = function() {
obtener_nombre_manual(input$encuesta)
},
content = function(file) {
utils::download.file(obtener_url_manual(input$encuesta), file, mode = "wb")
}
)
# Descarga de notas tecnicas
output$descargar_nota = downloadHandler(
filename = function() {
obtener_nombre_nota(input$encuesta)
},
content = function(file) {
utils::download.file(obtener_url_nota(input$encuesta), file, mode = "wb")
}
)
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.