Skip to content

Commit 2d5d3a6

Browse files
committed
report card handled by teal
1 parent 36c2561 commit 2d5d3a6

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

R/module_nested_tabs.R

+26-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ ui_teal_module.teal_module <- function(id, modules, depth = 0L) {
207207
)
208208
} else {
209209
ui_teal
210-
}
210+
},
211+
div( # todo: fix the position to the top right of the tab content?
212+
uiOutput(ns("reporter_add_container"))
213+
# uiOutput(ns("show_rcode_container")) # todo: same mechanism as for the reporter
214+
)
211215
)
212216
)
213217
}
@@ -410,6 +414,27 @@ srv_teal_module.teal_module <- function(id,
410414
}
411415
})
412416

417+
reporter_card_out <- reactive({
418+
card <- if (is.list(module_out())) {
419+
unlist(
420+
Filter(
421+
function(x) is.reactive(x) && inherits(x(), "ReportCard"),
422+
module_out()
423+
),
424+
recursive = FALSE
425+
)
426+
} else if (is.reactive(module_out()) && inherits(module_out()(), "ReportCard")) {
427+
module_out()
428+
}
429+
})
430+
431+
output$reporter_add_container <- renderUI({
432+
req(reporter_card_out())
433+
teal.reporter::add_card_button_ui(session$ns("reporter_add"))
434+
})
435+
436+
teal.reporter::add_card_button_srv("reporter_add", reporter = reporter, card_fun = reporter_card_out)
437+
413438
module_out
414439
})
415440
}

0 commit comments

Comments
 (0)