-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from EVS-GIS/documentation
add documentation panel and link website
- Loading branch information
Showing
6 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' documentation UI Function | ||
#' | ||
#' @description A shiny Module. | ||
#' | ||
#' @param id,input,output,session Internal parameters for {shiny}. | ||
#' | ||
#' @noRd | ||
#' | ||
#' @import shiny | ||
mod_documentation_ui <- function(id){ | ||
ns <- NS(id) | ||
tagList( | ||
golem_add_external_resources(), | ||
fluidPage( | ||
tags$a( | ||
href = "https://evs-gis.github.io/mapdowebsite/", | ||
icon("book"), | ||
"Documentation", | ||
target = "_blank" | ||
) | ||
) | ||
) | ||
} | ||
|
||
#' documentation Server Functions | ||
#' | ||
#' @noRd | ||
mod_documentation_server <- function(id){ | ||
moduleServer( id, function(input, output, session){ | ||
ns <- session$ns | ||
|
||
}) | ||
} | ||
|
||
## To be copied in the UI | ||
# mod_documentation_ui("documentation_1") | ||
|
||
## To be copied in the server | ||
# mod_documentation_server("documentation_1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
testServer( | ||
mod_documentation_server, | ||
# Add here your module params | ||
args = list() | ||
, { | ||
ns <- session$ns | ||
expect_true( | ||
inherits(ns, "function") | ||
) | ||
expect_true( | ||
grepl(id, ns("")) | ||
) | ||
expect_true( | ||
grepl("test", ns("test")) | ||
) | ||
# Here are some examples of tests you can | ||
# run on your module | ||
# - Testing the setting of inputs | ||
# session$setInputs(x = 1) | ||
# expect_true(input$x == 1) | ||
# - If ever your input updates a reactiveValues | ||
# - Note that this reactiveValues must be passed | ||
# - to the testServer function via args = list() | ||
# expect_true(r$x == 1) | ||
# - Testing output | ||
# expect_true(inherits(output$tbl$html, "html")) | ||
}) | ||
|
||
test_that("module ui works", { | ||
ui <- mod_documentation_ui(id = "test") | ||
golem::expect_shinytaglist(ui) | ||
# Check that formals have not been removed | ||
fmls <- formals(mod_documentation_ui) | ||
for (i in c("id")){ | ||
expect_true(i %in% names(fmls)) | ||
} | ||
}) | ||
|