and allow overriding default help text when loading server side help sectiontags/v0.2.0
| shiny::tags$ul( | shiny::tags$ul( | ||||
| id = "help-sidebar", | id = "help-sidebar", | ||||
| if (!cheatsheet_only) tags$li( | 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$li("Character Classes", class = "header"), | ||||
| shiny::tags$ul( | shiny::tags$ul( |
| }) | }) | ||||
| # ---- Server - Tab - Help ---- | # ---- 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) | source(system.file("shiny", "help_server.R", package = "regexplain"), local = TRUE) | ||||
| load_buttons <- function(..., extra_btns = NULL) { | load_buttons <- function(..., extra_btns = NULL) { |
| 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) | help_text <- reactiveVal(HELP_DEFAULT_TEXT) | ||||
| } else HTML(help_body) | } else HTML(help_body) | ||||
| }) | }) | ||||
| observeEvent(input$help_default, { | |||||
| help_text(HELP_DEFAULT_TEXT) | |||||
| }) | |||||
| observeEvent(input$help_cat_character_classes_regular, { | observeEvent(input$help_cat_character_classes_regular, { | ||||
| make_help_tab_text("character classes", "regular") | make_help_tab_text("character classes", "regular") | ||||
| }) | }) |