Sha256: 78536c95015ed04f2f77a0b718a38bfb472cff28a00deff34e32b868158b92f8
Contents?: true
Size: 653 Bytes
Versions: 357
Compression:
Stored size: 653 Bytes
Contents
import { Controller } from '@hotwired/stimulus' import URI from 'urijs' export default class extends Controller { static targets = ['select'] get parentTurboFrame() { return this.context.scope.element.closest('turbo-frame') } onChange(e) { if (!this.parentTurboFrame.src) return // Get the frame URL const url = new URI(this.parentTurboFrame.src) // update the url with the new range param url.search({ ...url.query(true), range: e.currentTarget.value }) // change the src of the frame this.parentTurboFrame.src = url.toString() // reload the frame with new range this.parentTurboFrame.reload() } }
Version data entries
357 entries across 357 versions & 1 rubygems