Sha256: f8ddcc0f45bcdbbcc49dd9c6984fba5aba2c7193a510d5cfef1772db7b0ccffc
Contents?: true
Size: 1.19 KB
Versions: 7
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', 'submit', '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.submitTarget.click() } 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
7 entries across 7 versions & 1 rubygems