Sha256: b339286bc92e8a05ec11399eb28a0d3026710bd0079cc61baf59a73308b7701a

Contents?: true

Size: 518 Bytes

Versions: 4

Compression:

Stored size: 518 Bytes

Contents

import ApplicationController from './application_controller'

export default class extends ApplicationController {
  static targets = ["item"]

  static values = {
    class: String
  }

  toggle () {
    this.itemTargets.forEach((item) => {
      item.classList.toggle(this.classValue)
    })
  }

  add () {
    this.itemTargets.forEach((item) => {
      item.classList.add(this.classValue)
    })
  }

  remove () {
    this.itemTargets.forEach((item) => {
      item.classList.remove(this.classValue)
    })
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trestle-0.10.1 frontend/js/controllers/toggle_class_controller.js
trestle-0.10.0 frontend/js/controllers/toggle_class_controller.js
trestle-0.10.0.pre2 frontend/js/controllers/toggle_class_controller.js
trestle-0.10.0.pre frontend/js/controllers/toggle_class_controller.js