Sha256: 3ad8d73806a4906dbf318df92a399c54cac856be7f7d5bd84c63c7a0b428f048
Contents?: true
Size: 817 Bytes
Versions: 79
Compression:
Stored size: 817 Bytes
Contents
import { Controller } from '@hotwired/stimulus' import { castBoolean } from '../helpers/cast_boolean' export default class extends Controller { static targets = ['controllerDiv', 'resourceIds', 'form'] connect() { this.resourceIdsTarget.value = this.resourceIds if (this.noConfirmation) { this.formTarget.submit() } else { this.controllerDivTarget.classList.remove('hidden') } } get noConfirmation() { return castBoolean(this.controllerDivTarget.dataset.noConfirmation) } get resourceName() { return this.controllerDivTarget.dataset.resourceName } get resourceIds() { try { return JSON.parse(document.querySelector(`[data-selected-resources-name="${this.resourceName}"]`).dataset.selectedResources) } catch (error) { return [] } } }
Version data entries
79 entries across 79 versions & 1 rubygems