Tightened up how Accordian's work.

master
Pacman Ghost 3 years ago
parent f9808d2070
commit 4aeeb1b809
  1. 10
      asl_rulebook2/webapp/static/Accordian.js

@ -36,14 +36,16 @@ gMainApp.component( "accordian-pane", {
</div>`,
created() {
gEventBus.on( "expand-pane", (pane, entry, isExpanded) => {
// handle panes being expanded
gEventBus.on( "expand-pane", (entry) => {
// check if we are in the same accordian as the pane being toggled
if ( pane != this.$parent )
if ( entry.$parent != this.$parent )
return ;
// yup - check if we are the pane being toggled
if ( entry == this ) {
// yup - update our state
this.isExpanded = isExpanded ;
this.isExpanded = ! this.isExpanded ;
} else {
// nope - always close up (only one pane can be open at a time)
this.isExpanded = false ;
@ -62,7 +64,7 @@ gMainApp.component( "accordian-pane", {
this.$emit( "pane-expanded" ) ;
// NOTE: Every accordian pane will receive this event, but each one
// will figure out if it applies to them.
gEventBus.emit( "expand-pane", this.$parent, this, !this.isExpanded ) ;
gEventBus.emit( "expand-pane", this ) ;
},
},

Loading…
Cancel
Save