Sha256: fc16ef8d96b6ec52b190e78f9aba74e8708194c47fbb75e998577d3e18c3f5c0
Contents?: true
Size: 807 Bytes
Versions: 20
Compression:
Stored size: 807 Bytes
Contents
import { Controller } from '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
20 entries across 20 versions & 1 rubygems