Skip to content

Commit

Permalink
Merge pull request #21 from mauromiguelm/dev-locked-button-ux
Browse files Browse the repository at this point in the history
Develop shiny ux interaction with locked next/previous buttons
  • Loading branch information
mauromiguelm authored Mar 29, 2024
2 parents 075ee5b + c3aea11 commit 0c870be
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ jobs:
git commit ${FILES_TO_COMMIT[*]} -m "Style code (GHA)"
git pull --ff-only
git push origin
exit 0
else
echo "No changes to commit."
exit 0
fi
11 changes: 5 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ wizard_show <- function(
#' @export
reset <- function(
id,
session = shiny::getDefaultReactiveDomain()
){
if (missing(id)) stop("Missing `id`")

session$sendInputMessage(id, "reset")
}
session = shiny::getDefaultReactiveDomain()) {
if (missing(id)) stop("Missing `id`")

session$sendInputMessage(id, "reset")
}
4 changes: 4 additions & 0 deletions inst/app/app-dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ server <- function(input, output, session) {
wizardR::reset("my_modal")
})

observeEvent(input$my_modal_locked,{
print("locked button clicked")
})

observeEvent(input$show_shinyalert, {
shinyalert::shinyalert(
title = "Hello",
Expand Down
10 changes: 10 additions & 0 deletions inst/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ $.extend(wizard, {

callback(false);
});


// set wz.lock event listener
el.addEventListener("wz.lock", function(e) {
let counter = $(el).data("lockCounter") || 0;
counter++;
$(el).data("lockCounter", counter);
Shiny.setInputValue(el.id + "_locked", counter);
callback(false);
});
},

unsubscribe: function(el) {
Expand Down

0 comments on commit 0c870be

Please sign in to comment.