From: Matthias Schmidt Date: Sun, 13 Jan 2019 09:07:23 +0000 (+0100) Subject: Explicitly support disabled date picker fields X-Git-Tag: 5.2.0_Alpha_1~365^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=66172d57717a91163474dd1092a11144b5f6b4e9;p=GitHub%2FWoltLab%2FWCF.git Explicitly support disabled date picker fields Such fields should use the same internal input elements and use the same format for the displayed date but have no UI elements to change or remove the set date. --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Picker.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Picker.js index 0ca892df87..39551f64f5 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Picker.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Picker.js @@ -156,34 +156,36 @@ define(['DateUtil', 'EventHandler', 'Language', 'ObjectMap', 'Dom/ChangeListener element.addEventListener(WCF_CLICK_EVENT, _callbackOpen); - // create input addon - var container = elCreate('div'); - container.className = 'inputAddon'; - - var button = elCreate('a'); - button.href = '#'; - button.className = 'inputSuffix button jsTooltip'; - button.addEventListener(WCF_CLICK_EVENT, _callbackOpen); - container.appendChild(button); - - var icon = elCreate('span'); - icon.className = 'icon icon16 fa-calendar'; - button.appendChild(icon); - - element.parentNode.insertBefore(container, element); - container.insertBefore(element, button); - - if (!disableClear) { - button = elCreate('a'); - button.className = 'inputSuffix button'; - button.addEventListener(WCF_CLICK_EVENT, this.clear.bind(this, element)); - if (isEmpty) button.style.setProperty('visibility', 'hidden', ''); + if (!element.disabled) { + // create input addon + var container = elCreate('div'); + container.className = 'inputAddon'; + var button = elCreate('a'); + button.href = '#'; + button.className = 'inputSuffix button jsTooltip'; + button.addEventListener(WCF_CLICK_EVENT, _callbackOpen); container.appendChild(button); - icon = elCreate('span'); - icon.className = 'icon icon16 fa-times'; + var icon = elCreate('span'); + icon.className = 'icon icon16 fa-calendar'; button.appendChild(icon); + + element.parentNode.insertBefore(container, element); + container.insertBefore(element, button); + + if (!disableClear) { + button = elCreate('a'); + button.className = 'inputSuffix button'; + button.addEventListener(WCF_CLICK_EVENT, this.clear.bind(this, element)); + if (isEmpty) button.style.setProperty('visibility', 'hidden', ''); + + container.appendChild(button); + + icon = elCreate('span'); + icon.className = 'icon icon16 fa-times'; + button.appendChild(icon); + } } // check if the date input has one of the following classes set otherwise default to 'short'