Skip to content
Permalink
Browse files

Collapse button triggers shown and hidden events. Closes #42

  • Loading branch information
wch committed Jun 3, 2015
1 parent 5dd8b4c commit 73f602736efe496dc0e2b54882c1036eacaef79f
Showing with 12 additions and 2 deletions.
  1. +1 −0 inst/AdminLTE/README-shiny-mods.md
  2. +9 −0 inst/AdminLTE/app.js
  3. +1 −1 inst/AdminLTE/app.min.js
  4. +1 −1 inst/AdminLTE/app.min.js.map
@@ -1,4 +1,5 @@
This branch of AdminLTE contains the following changes from the stock version, to make it work better with Shiny.

* Attached collapse click event handler to document, instead of to each collapse button. This is the same fix as https://github.com/almasaeed2010/AdminLTE/pull/304; if that is merged, then it should be possible to go to the stock version. Also see https://github.com/rstudio/shinydashboard/issues/17 for a test app.
* The box collapse function triggers 'shown' and 'hidden' events, so that Shiny knows when outputs are visible or not. See https://github.com/rstudio/shinydashboard/issues/42 for a test app.
* In AdminLTE.css, the fonts are fetched from the local host, instead of from Google fonts.
@@ -564,12 +564,21 @@ function _init() {
//Hide the content
box_content.slideUp(_this.animationSpeed, function () {
box.addClass("collapsed-box");
box.trigger("hidden.bs.collapse");
});
} else {
//Convert plus into minus
element.children(":first")
.removeClass(_this.icons.open)
.addClass(_this.icons.collapse);

// Techinically, it should be 'show' which is triggered here, and
// 'shown' which is triggered later. However, this works better because
// of the slow expansion transition -- the box would fully expand, and
// only then trigger 'shown', which then results in an update of the
// content. This would allow users to see the old content during the
// expansion.
box.trigger("shown.bs.collapse");
//Show the content
box_content.slideDown(_this.animationSpeed, function () {
box.removeClass("collapsed-box");

Some generated files are not rendered by default. Learn more.

4 comments on commit 73f6027

@chrisirhc

This comment has been minimized.

Copy link

@chrisirhc chrisirhc replied Dec 3, 2015

@wch, I see that there's an AdminLTE fork with shiny-mods branch. However that shiny-mods doesn't contain the changes that you made here.
It would be really helpful for me to track these changes if you pushed them to that branch on your AdminLTE fork. Thanks!

@wch

This comment has been minimized.

Copy link
Contributor Author

@wch wch replied Dec 7, 2015

@chrisirhc

This comment has been minimized.

Copy link

@chrisirhc chrisirhc replied Dec 7, 2015

@wch, I did, I'm referring to it exactly, and it does not have this change.

@wch

This comment has been minimized.

Copy link
Contributor Author

@wch wch replied Dec 7, 2015

Shoot, you're right. That branch hasn't been kept up-to-date. I think the relevant changes are only in the shinydashboard repository, so unfortunately there isn't a really easy way to keep track of them right now.

Please sign in to comment.
You can’t perform that action at this time.