Skip to contents

Shiny modules for making a user information widget in registry shiny apps at Rapporteket. One benefit using these modules will be reduced complexity and number of code lines for each registry.

Usage

navbarWidgetInput(id, addUserInfo = TRUE)

navbarWidgetServer(id, orgName, caller = environmentName(rlang::caller_env()))

navbarWidgetApp(orgName = "Org Name")

Arguments

id

Character string providing module namespace

addUserInfo

Logical defining if an "about" hyperlink is to be added

orgName

Character string naming the organization

caller

Character string naming the environment this function was called from. Default value is environmentName(rlang::caller_env()). The value is used to display the current version of the R package representing the registry at Rapporteket. If this module is called from exported functions in the registry R package use the default value. If the module is called from outside the registry environment caller must be set to the actual name of the R package.

Value

Shiny objects, mostly. Helper functions may return other stuff too.

Details

These modules take use of the shiny session object to obtain data for the widget. Hence, a Rapporteket like context will be needed for these modules to function properly.

Examples

## client user interface function
ui <- shiny::tagList(
  shiny::navbarPage(
    "Testpage",
    shiny::tabPanel(
      "Testpanel",
      shiny::mainPanel(
        navbarWidgetInput("testWidget")
      )
    )
  )
)

## server function
server <- function(input, output, session) {
  navbarWidgetServer("testWidget", orgName = "Test org", caller = "Rpkg")
}

## run the app in an interactive session and a Rapporteket like environment
if (interactive() && isRapContext()) {
  shiny::shinyApp(ui, server)
}