-import {Component} from "./component";
+import {Component} from './component';
+
+function toggleElem(elem, show) {
+ elem.style.display = show ? null : 'none';
+}
export class PagePicker extends Component {
this.selectButton.addEventListener('click', this.showPopup.bind(this));
this.display.parentElement.addEventListener('click', this.showPopup.bind(this));
- this.resetButton.addEventListener('click', event => {
+ this.resetButton.addEventListener('click', () => {
this.setValue('', '');
});
}
showPopup() {
- /** @type {EntitySelectorPopup} **/
+ /** @type {EntitySelectorPopup} * */
const selectorPopup = window.$components.first('entity-selector-popup');
selectorPopup.show(entity => {
this.setValue(entity.id, entity.name);
toggleElem(this.defaultDisplay, !hasValue);
toggleElem(this.display, hasValue);
if (hasValue) {
- let id = this.getAssetIdFromVal();
+ const id = this.getAssetIdFromVal();
this.display.textContent = `#${id}, ${name}`;
this.display.href = window.baseUrl(`/link/${id}`);
}
}
}
-
-function toggleElem(elem, show) {
- elem.style.display = show ? null : 'none';
-}
\ No newline at end of file