#' data_upload UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
#' @importFrom dplyr %>%
mod_data_upload_ui <- function(id){
ns <- NS(id)
tagList(
uiOutput(ns("dataInput"))
)
}
#' data_upload Server Function
#'
#' @noRd
mod_data_upload_server <- function(id, r){
moduleServer(id, function(input, output, session){
ns <- session$ns
output$dataInput <- renderUI({
choices <- c("sampleData", "pasted", "fileUpload", "googleSheets")
names(choices) <- shi18ny::i_(c("sample", "paste", "upload", "google"), r$lang(), i18n = r$i18n)
label <- shi18ny::i_("input_data", r$lang(), i18n = r$i18n)
dsmodules::tableInputUI(ns("initial_data"),
label = label,
choices = choices,
selected = "sampleData")
})
sample_data <- reactive({
sm_f <- list(File_1 = DSAppTemplate::titanic %>% as.data.frame(),
File_2 = DSAppTemplate::election %>% as.data.frame())
names(sm_f) <- shi18ny::i_(c("sample_titanic_name", "sample_elections_name"), lang = r$lang(), i18n = r$i18n)
sm_f
})
inputData <- dsmodules::tableInputServer("initial_data",
sampleLabel = shi18ny::i_("sample_lb", lang = r$lang(), i18n = r$i18n),
sampleFiles = sample_data(),
sampleSelected = names(reactive(sample_data()))[1],
pasteLabel = shi18ny::i_("paste", lang = r$lang(), i18n = r$i18n),
pasteValue = "",
pastePlaceholder = shi18ny::i_("paste_pl", lang = r$lang(), i18n = r$i18n),
pasteRows = 5,
uploadLabel = shi18ny::i_("upload_lb", lang = r$lang(), i18n = r$i18n),
uploadButtonLabel = shi18ny::i_("upload_bt_lb", lang = r$lang(), i18n = r$i18n),
uploadPlaceholder = shi18ny::i_("upload_pl", lang = r$lang(), i18n = r$i18n),
googleSheetLabel = shi18ny::i_("google_sh_lb", lang = r$lang(), i18n = r$i18n),
googleSheetValue = "",
googleSheetPlaceholder = shi18ny::i_("google_sh_pl", lang = r$lang(), i18n = r$i18n),
googleSheetPageLabel = shi18ny::i_("google_sh_pg_lb", lang = r$lang(), i18n = r$i18n))
observe({
r$inputData <- inputData()
})
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.