RinteRface / shinydashboardPlus

extensions for shinydashboard
https://shinydashboardplus.rinterface.com
Other
454 stars 77 forks source link

new flipBox function #77

Closed jimbrig closed 3 years ago

jimbrig commented 4 years ago

Addresses issue #70

I also created a demo app here.

jimbrig commented 4 years ago

@DivadNojnarg apologies, forgot all about this!

I updated the code to include the buttons inside the body of the cards. Note the merge conflict in the DESCRIPTION due to your usage of roxygen's dev version RoxygenNote: 7.1.1.9000.

Feel free to change/comment on whatever as it is still quite limited as far as the interface goes.

I also attempted to bind the card as a shiny input and migrate the annoying JS from the function to an external JS file but had trouble getting the binding correct. I was able to simply assign a new id by calling:

function flipBox_js(id) {
  $("#" + id).on("click", ".btn-flip-front-id", function() {
    Shiny.setInputValue("fb_" + id, 0, { priority: "event"});
    $(this).tooltip("hide");
  });
  $("#" + id).on("click", ".btn-flip-back-id", function() {
    Shiny.setInputValue("fb_" + id, 1, { priority: "event"});
    $(this).tooltip("hide");
  });
}

and sourcing/calling the function from inside flip_box (as opposed to adding to deps.R). This was not the best solution however, because observing the input did not work as expected without having to wrap the newly created input in a reactive/eventReactive, so I decided against it.

Since I did not think this hackish method was worthy of pushing, I just stashed it. I would like to attempt to fully create the binding as you did with bs4dash when I have some more time to spend on it cause my JS could use some work for sure (I've always avoided it when possible).

If you have any pointers let me know!

Thanks

jimbrig commented 3 years ago

@DivadNojnarg let me know if you need any assistance with the updated package/R CMD Checks.