Sha256: 6b91075fd0e68251257d4ce90709e40e67767392f618ba114431f50f110289ed
Contents?: true
Size: 1.19 KB
Versions: 88
Compression:
Stored size: 1.19 KB
Contents
import { Controller } from '@hotwired/stimulus' import { castBoolean } from '../helpers/cast_boolean' export default class extends Controller { static targets = ['controllerDiv', 'resourceIds', 'form', 'selectedAllQuery'] connect() { this.resourceIdsTarget.value = this.resourceIds // This value is picked up from the DOM so we check true/false as strings if (this.selectionOptions.itemSelectAllSelectedAllValue === 'true') { this.selectedAllQueryTarget.value = this.selectionOptions.itemSelectAllSelectedAllQueryValue } 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(this.selectionOptions.selectedResources) } catch (error) { return [] } } get selectionOptions() { try { return document.querySelector(`[data-selected-resources-name="${this.resourceName}"]`).dataset } catch (error) { return [] } } }
Version data entries
88 entries across 88 versions & 1 rubygems