| | |
| | | this.modals[name].subscribe((event, data) => { |
| | | switch (event) { |
| | | case 'modal-close': |
| | | this.activeItem = null; |
| | | const formId = this.ui.modals[name].form.dataset.formId; |
| | | if (formId) { |
| | | this.formController.cleanupForm(formId); |
| | |
| | | let query = e.target.value.trim(); |
| | | let key = `${this.content}-search`; |
| | | |
| | | console.log('Maybe search', query); |
| | | if (query.length === 0) { |
| | | this.deleteFilter('search', ''); |
| | | return; |
| | |
| | | window.debouncer.schedule( |
| | | key, |
| | | () => { |
| | | console.log('Searching for', query); |
| | | this.a11y.announce(`Searching for "${query}"...`); |
| | | this.store.setFilters({ search: query, page: 1 }); |
| | | }, |
| | |
| | | openEditModal(itemID) { |
| | | let item = this.store.get(parseInt(itemID)); |
| | | if (!item) return; |
| | | this.activeItem = itemID; |
| | | this.activeItem = item.id; |
| | | this.ui.modals.edit.modal.dataset.itemId = itemID; |
| | | this.ui.modals.edit.modal.dataset.content = this.content; |
| | | this.ui.modals.edit.h2.textContent = `Editing ${item.fields.post_title === '' ? this.singular : item.fields.post_title}`; |
| | |
| | | let el = this.ui.filters[name]; |
| | | if (typeof el === 'object') { |
| | | if (!Object.hasOwn(this.ui.filters[name], value)) { |
| | | console.log('Sub filter el not found: ', value); |
| | | console.log(name); |
| | | return false; |
| | | } |
| | | el = this.ui.filters[name][value]; |