Skip to content

Commit

Permalink
Merge pull request #46 from GSK-Biostatistics/dev-v0.0.3
Browse files Browse the repository at this point in the history
Dev v0.0.3
  • Loading branch information
bzkrouse authored Jul 18, 2023
2 parents 1702811 + d1ca430 commit 9e0189c
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 12 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tfrmtbuilder
Title: Shiny app companion to the tfrmt package
Version: 0.0.2
Version: 0.0.3
Authors@R:
c(person(given = "Becca",
family = "Krouse",
Expand Down Expand Up @@ -52,4 +52,3 @@ Imports:
pkgload,
shinyFeedback,
fontawesome

6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# tfrmtbuilder 0.0.3

* Bug fixes:
- Allow param-level formatting in `body_plan()`
- Fix issue where user is unable to select `frmt` buttons in `body_plan()` via installed package
- fix navbar warnings about extra content

# tfrmtbuilder 0.0.2

Expand Down
15 changes: 11 additions & 4 deletions R/mod_body_plan_edit.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ body_plan_edit_server <- function(id, data, tfrmt_app, selected){

# TODO - no allow_create for the uploaded data
collected_filters <- filters_server("filters", data, tfrmt_app, selected,
include = c("group", "label"),
include = c("group", "label", "param"),
allow_create = reactive(TRUE),
null_to_default = TRUE)

Expand All @@ -46,9 +46,16 @@ body_plan_edit_server <- function(id, data, tfrmt_app, selected){
req(length(collected_filters())>0)
req(!is.null(frmt_out()))

frmt_structure(group_val = collected_filters()$group_val,
label_val = collected_filters()$label_val,
frmt_out())
frmt_out_ready <- list(frmt_out())

if (!all(collected_filters()$param_val==".default") &&
length(collected_filters()$param_val)==1){
frmt_out_ready <- setNames(frmt_out_ready, collected_filters()$param_val)
}

do.call("frmt_structure", args = c(list(group_val = collected_filters()$group_val,
label_val = collected_filters()$label_val),
frmt_out_ready))

})

Expand Down
2 changes: 1 addition & 1 deletion R/mod_body_plan_edit_frmts.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ body_plan_edit_frmts_server <- function(id, selected){

observeEvent(input[[paste0("pst_", x)]],{

dummy_fun <- match.fun(paste0("dummy_", x))
dummy_fun <- get(paste0("dummy_", x), envir = asNamespace("tfrmtbuilder"))
updateAceEditor(session,
editorId = "frmt",
value = paste0(input$frmt, dummy_fun()))
Expand Down
2 changes: 1 addition & 1 deletion R/mod_table_view.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ table_view_server <- function(id, tab_selected, data, tfrmt_app_out, settings){
tab_options(
table.align = "left"
)
))
, inline_css = FALSE))

})

Expand Down
3 changes: 2 additions & 1 deletion R/tfrmtbuilder.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ tfrmtbuilder <- function(run = TRUE){

if (run){
runApp(app, launch.browser = TRUE)
} else {
app
}

app
}
2 changes: 1 addition & 1 deletion R/tfrmtbuilder_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ tfrmtbuilder_ui <- function(id){
)
) ,
tabPanel("Export", export_ui(ns("export"))),
tags$script(HTML(paste0("var header = $('.navbar> .container-fluid');",
header = tags$script(HTML(paste0("var header = $('.navbar> .container-fluid');",
"header.append('<div style=\"float:right; margin-bottom:0; color:#fff;\">",
"<div class=\"form-group shiny-input-container\" style = \"margin-bottom:0; color:#fff;\">",
"<div class=\"pretty p-default p-switch p-fill\">",
Expand Down
4 changes: 2 additions & 2 deletions R/utils_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ create_filter_select <- function(ns, type, data, existing_filters, var_vec,

if (is.list(x)){
x
} else if (is.null(x) || x==".default"){
} else if (is.null(x) || all(x==".default")){
x
} else {
as.list(x) %>% setNames(var_vec)
list(x) %>% setNames(var_vec)
}
}) %>%
list_flatten(name_spec = "{inner}") %>%
Expand Down
1 change: 1 addition & 0 deletions R/utils_tfrmt.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ cols_to_dat <- function(data, tfrmt, mock){
columns <- tfrmt$column %>% map_chr(as_label)
columns_lowest <- columns %>% last() %>% sym()

tfrmt$big_n <- NULL
col_plan_vars <- attr(tfrmt:::apply_tfrmt(data, tfrmt, mock), ".col_plan_vars")

allcols <- col_plan_vars %>% map_chr(as_label)
Expand Down

0 comments on commit 9e0189c

Please sign in to comment.