and allow overriding default help text when loading server side help sectiontags/v0.2.0
| @@ -11,7 +11,8 @@ generate_help_ui <- function(cheatsheet_only = TRUE) { | |||
| shiny::tags$ul( | |||
| id = "help-sidebar", | |||
| if (!cheatsheet_only) tags$li( | |||
| shiny::actionLink("help_try_this", "Try This") | |||
| shiny::actionLink("help_default", "Introduction"), | |||
| shiny::actionLink("help_try_this", "Try These Examples") | |||
| ), | |||
| shiny::tags$li("Character Classes", class = "header"), | |||
| shiny::tags$ul( | |||
| @@ -290,6 +290,11 @@ regex_gadget <- function(text = NULL, | |||
| }) | |||
| # ---- Server - Tab - Help ---- | |||
| HELP_DEFAULT_TEXT <- paste0( | |||
| "<h3>Welcome to RegExplain</h3>", | |||
| "<p>Choose a category from the menu on the left.</p>" | |||
| ) | |||
| source(system.file("shiny", "help_server.R", package = "regexplain"), local = TRUE) | |||
| load_buttons <- function(..., extra_btns = NULL) { | |||
| @@ -1,4 +1,4 @@ | |||
| HELP_DEFAULT_TEXT <- "<p>Select a category from the left sidebar.</p>" | |||
| if (!exists('HELP_DEFAULT_TEXT')) HELP_DEFAULT_TEXT <- "<p>Select a category from the left sidebar.</p>" | |||
| help_text <- reactiveVal(HELP_DEFAULT_TEXT) | |||
| @@ -26,6 +26,10 @@ output$help_text_selected <- renderUI({ | |||
| } else HTML(help_body) | |||
| }) | |||
| observeEvent(input$help_default, { | |||
| help_text(HELP_DEFAULT_TEXT) | |||
| }) | |||
| observeEvent(input$help_cat_character_classes_regular, { | |||
| make_help_tab_text("character classes", "regular") | |||
| }) | |||