Sha256: bf930fb981926c1f98b2bd5c69cd284f0aebaf208d4bb7d9840a9ac30a908c1d

Contents?: true

Size: 686 Bytes

Versions: 30

Compression:

Stored size: 686 Bytes

Contents

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static values = {
    criterionId: Number,
    input: Object,
  };

  connect() {
    this.state = this.getStateController()

    this.state.updateInput(
      this.criterionIdValue,
      this.inputValue,
    );
  }

  getStateController() {
    let currentElement = this.element

    while(currentElement !== document.body) {
      const controller = this.application.getControllerForElementAndIdentifier(currentElement, 'refine--state')
      if (controller) {
        return controller
      } else {
        currentElement = currentElement.parentNode
      }
    }

    return null
  }
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
refine-rails-2.9.9 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.8 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.7 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.6 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.5 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.4 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.3 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.2 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.1 app/javascript/controllers/refine/defaults-controller.js
refine-rails-2.9.0 app/javascript/controllers/refine/defaults-controller.js