Sha256: b4978b3ecb88fb7445879c36805ca75e61600a1446661f1f69e0e46e308d250a
Contents?: true
Size: 1.07 KB
Versions: 96
Compression:
Stored size: 1.07 KB
Contents
import { Controller } from '@hotwired/stimulus' export default class extends Controller { static targets = ['resourceIds', 'form', 'selectedAllQuery'] static values = { noConfirmation: Boolean, resourceName: String, } connect() { if (this.resourceIdsTarget.value === '') { 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.noConfirmationValue) { this.formTarget.requestSubmit() } else { this.element.classList.remove('hidden') } } get resourceIds() { try { return JSON.parse(this.selectionOptions.selectedResources) } catch (error) { return [] } } get selectionOptions() { try { return document.querySelector(`[data-selected-resources-name="${this.resourceNameValue}"]`).dataset } catch (error) { return [] } } }
Version data entries
96 entries across 96 versions & 1 rubygems