Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cran #5

Merged
merged 13 commits into from
Mar 31, 2021
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: periscope
Type: Package
Title: Enterprise Streamlined 'Shiny' Application Framework
Version: 0.6.2.9001
Version: 0.6.3.9002
Authors@R: c(
person("Constance", "Brett", email="[email protected]", role = c("aut", "cre")),
person("Isaac", "Neuhaus", role = "aut", comment = "canvasXpress JavaScript Library Maintainer"),
Expand All @@ -17,7 +17,6 @@ BugReports: https://github.com/cb4ds/periscope/issues
License: GPL-3
Encoding: UTF-8
Language: en-US
LazyData: true
Depends:
R (>= 3.5)
Imports:
Expand All @@ -34,8 +33,8 @@ RoxygenNote: 7.1.1
Suggests:
knitr,
rmarkdown,
testthat,
shinydashboardPlus,
testthat (>= 3.0),
canvasXpress,
openxlsx (>= 3.0)
VignetteBuilder: knitr
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#Revisions and Change Log

### v0.6.2
* Bugfix for the right sidebar when using shinydashboardPlus 2.0 - first tab was disappearing

### v0.6.1
* Updated to provide handling for shinydashboardPlus old (<= 0.7.5) and new versions (2.X)
* Removed import less-than requirement designation for shinydashboardPlus
Expand Down
12 changes: 10 additions & 2 deletions R/fw_helpers_external.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ fw_create_header <- function() {

# Framework UI Header Creation that includes a right sidebar
fw_create_header_plus <- function(sidebar_right_icon = shiny::isolate(.g_opts$sidebar_right_icon)) {
if (utils::packageVersion('shinydashboardPlus') < 2) {
if (!(.g_sdp_installed)) {
stop('shinydashboardPlus is not installed')
}

if (.g_sdp_oldver) {
plus_fxn <- getExportedValue("shinydashboardPlus", "dashboardHeaderPlus")
arg_list <- list(enable_rightsidebar = TRUE,
rightSidebarIcon = sidebar_right_icon)
Expand Down Expand Up @@ -119,14 +123,18 @@ fw_create_sidebar <- function(showsidebar = shiny::isolate(.g_opts$show_left_sid

# Framework UI Right Sidebar Creation
fw_create_right_sidebar <- function() {
if (!(.g_sdp_installed)) {
stop('shinydashboardPlus is not installed')
}

side_right <- shiny::isolate(.g_opts$side_right)

params <- list(shinyBS::bsAlert("sidebarRightAlert"))
if (!is.null(side_right) && length(side_right) > 0) {
params <- c(params, side_right)
}

if (utils::packageVersion('shinydashboardPlus') < 2) {
if (.g_sdp_oldver) {
plus_fxn <- getExportedValue("shinydashboardPlus", "rightSidebar")
} else {
plus_fxn <- getExportedValue("shinydashboardPlus", "dashboardControlbar")
Expand Down
2 changes: 1 addition & 1 deletion R/fw_helpers_internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

.right_sidebar_injection <- function() {
value <- NULL
if (utils::packageVersion('shinydashboardPlus') < 2) {
if (.g_sdp_oldver) {
shiny::tags$script(shiny::HTML("setTimeout(function() {
$('[class~=\"control-sidebar-tabs\"]').find('li:first').remove();
}, 5000);"))
Expand Down
6 changes: 5 additions & 1 deletion R/generate_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' framework. The application can be created either empty (default) or with a
#' sample/documented example application.\cr \cr A running instance of the exact
#' sample application that will be created is
#' \href{http://periscopeapps.org:3838/framework_template}{hosted here} if you
#' \href{http://periscopeapps.org:3838/periscope_template}{hosted here} if you
#' would like to see the sample application before creating your own copy.
#'
#' @param name name for the new application and directory
Expand Down Expand Up @@ -148,6 +148,10 @@ create_new_application <- function(name, location, sampleapp = FALSE, resetbutto
}
}

if (!(.g_sdp_installed)) {
stop('shinyDashboardPlus is not currently installed -- it is required to generate an application with a right sidebar.')
}

.create_dirs(newloc, usersep)
.copy_fw_files(newloc, usersep, resetbutton, dashboard_plus, leftsidebar, right_sidebar_icon, style)
.copy_program_files(newloc, usersep, sampleapp, resetbutton, leftsidebar, dashboard_plus)
Expand Down
9 changes: 8 additions & 1 deletion R/periscope.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,16 @@
#' @name periscope
NULL

.g_sdp_installed <- FALSE
.g_sdp_oldver <- FALSE

.onLoad <- function(libname, pkgname) {
#TBD
if (length(find.package('shinydashboardPlus', quiet = T)) > 0) {
if (utils::packageVersion('shinydashboardPlus') < 2) {
.g_sdp_oldver <<- TRUE
}
.g_sdp_installed <<- TRUE
}
}

.onAttach <- function(libname, pkgname) {
Expand Down
7 changes: 3 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
## Comments from Maintainer

* 0.6.1 - our host had issues and we needed a few redirect fixes. Solved! Apologies.
* Right Sidebar Bug fix for ShinyDashboardPlus 2.0 compatibility

* Updated the package to handle both the old and new releases of shinydashboardPlus
* Updated tests, fixed a few minor bugs
* There is a NOTE due to the short time between submissions, this is an important bugfix enabling right-sidebar applications to be generated for ShinyDashboardPlus 2.0 and I kindly ask for your exception to allow this release.

---

Expand All @@ -19,7 +18,7 @@ Travis-CI (Ubuntu 16.04.6)

* R 3.6.3
* R 4.0.2
* R devel (2021-03-11 r80086)
* R devel (2021-03-17 r80092)

WinBuilder

Expand Down
3 changes: 1 addition & 2 deletions inst/fw_templ/p_example/server_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There are three standardized locations for alerts in this app. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "sidebarBasicAlert", "sidebarAdvancedAlert", ',
Expand All @@ -111,7 +111,6 @@ output$alerts <- renderUI({
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
})

Expand Down
3 changes: 1 addition & 2 deletions inst/fw_templ/p_example/server_local_no_left.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There is one standardized location for alerts in this app. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "bodyAlert", See the ', em("alertBS"),
Expand All @@ -102,7 +102,6 @@ output$alerts <- renderUI({
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
})

Expand Down
17 changes: 8 additions & 9 deletions inst/fw_templ/p_example/server_local_plus.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There are four standardized locations for alerts in this app. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "sidebarBasicAlert", "sidebarAdvancedAlert", "sidebarRightAlert", ',
Expand All @@ -134,20 +134,19 @@ output$alerts <- renderUI({
bsButton( "exampleBasicAlert",
label = "Sidebar - Basic",
style = "success",
width = "25%"),
width = "20%"),
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
width = "20%"),
bsButton( "exampleAdvancedAlert",
label = "Sidebar - Advanced",
style = "warning",
width = "25%"),
width = "20%"),
bsButton( "exampleRightAlert",
label = "Sidebar - Right",
style = "danger",
width = "25%"),
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
width = "20%") ) )
})

output$loginfo <- renderUI({
Expand Down
9 changes: 6 additions & 3 deletions inst/fw_templ/p_example/server_local_plus_no_left.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,19 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There are two standardized locations for alerts in this app. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "bodyAlert", See the ', em("alertBS"),
'LOCATION can be: "bodyAlert" and "sidebarRightAlert", See the ', em("alertBS"),
"documentation for more information on styles and other options"),
div(align = "center",
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%"),
bsButton( "exampleRightAlert",
label = "Sidebar - Right",
style = "danger",
width = "25%")) )
})

Expand Down
2 changes: 1 addition & 1 deletion man/create_new_application.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions tests/testthat/sample_app/program/server_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There are three standardized locations for alerts in this app. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "sidebarBasicAlert", "sidebarAdvancedAlert", ',
Expand All @@ -111,7 +111,6 @@ output$alerts <- renderUI({
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
})

Expand Down
17 changes: 8 additions & 9 deletions tests/testthat/sample_app_both_sidebar/program/server_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There are four standardized locations for alerts in this app. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "sidebarBasicAlert", "sidebarAdvancedAlert", "sidebarRightAlert", ',
Expand All @@ -134,20 +134,19 @@ output$alerts <- renderUI({
bsButton( "exampleBasicAlert",
label = "Sidebar - Basic",
style = "success",
width = "25%"),
width = "20%"),
bsButton( "exampleAdvancedAlert",
label = "Sidebar - Advanced",
style = "warning",
width = "25%"),
bsButton( "exampleRightAlert",
label = "Sidebar - Right",
style = "danger",
width = "25%"),
width = "20%"),
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
width = "20%"),
bsButton( "exampleRightAlert",
label = "Sidebar - Right",
style = "danger",
width = "20%")) )
})

output$loginfo <- renderUI({
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/sample_app_no_sidebar/program/server_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There is one standardized location for alerts. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "bodyAlert", See the ', em("alertBS"),
Expand All @@ -102,7 +102,6 @@ output$alerts <- renderUI({
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There is one standardized location for alerts. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "bodyAlert", See the ', em("alertBS"),
Expand All @@ -102,7 +102,6 @@ output$alerts <- renderUI({
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
})

Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/sample_app_r_sidebar/program/server_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ output$download <- renderUI({

output$alerts <- renderUI({
list(hr(),
p("There are three standardized locations for alerts. To create ",
p("There is one standardized location for alerts. To create ",
"an alert call the following on the server: ",
pre('S: createAlert(session, location, content = "Alert Text", ...)'),
'LOCATION can be: "bodyAlert", See the ', em("alertBS"),
Expand All @@ -133,7 +133,6 @@ output$alerts <- renderUI({
bsButton( "exampleBodyAlert",
label = "Body",
style = "info",
append = FALSE,
width = "25%")) )
})

Expand Down