Sha256: 1bb564f05f20d292c4ba4ef1891e9e213406cd5a64494e12df45fe19d903df28

Contents?: true

Size: 389 Bytes

Versions: 6

Compression:

Stored size: 389 Bytes

Contents

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = [ "children", "indicator" ]
  
  toggle(event) {
    this.childrenTarget.toggleAttribute("hidden")
    this.indicatorTarget.classList.toggle("rotate-90")
    
    if (this.collapsed) event.preventDefault()
  }
  
  get collapsed() {
    return this.childrenTarget.hidden
  }
  
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spina-2.18.0 app/assets/javascripts/spina/controllers/page_collapse_controller.js
spina-2.17.0 app/assets/javascripts/spina/controllers/page_collapse_controller.js
spina-2.16.0 app/assets/javascripts/spina/controllers/page_collapse_controller.js
spina-2.15.1 app/assets/javascripts/spina/controllers/page_collapse_controller.js
spina-2.15.0 app/assets/javascripts/spina/controllers/page_collapse_controller.js
spina-2.14.0 app/assets/javascripts/spina/controllers/page_collapse_controller.js