| | |
| | | console.log(this.queue); |
| | | this.config = config; |
| | | this.content = config.content || false; |
| | | this.settings = window.jvbUserSettings; |
| | | |
| | | if (!this.content) { |
| | | return; |
| | |
| | | this.filterTimeout = null; |
| | | |
| | | this.viewController = new window.jvbViews(this.ui.container, this.store); |
| | | this.formController = new window.jvbForm(this.store); |
| | | this.formController = new window.jvbForm(); |
| | | |
| | | this.formController.subscribe((event, data) => { |
| | | switch(event) { |
| | |
| | | create: 'dialog.create form', |
| | | edit: 'dialog.edit form', |
| | | bulkEdit: 'dialog.bulkEdit form' |
| | | } |
| | | }, |
| | | uploader: 'details.uploader' |
| | | }; |
| | | this.ui = window.uiFromSelectors(this.elements); |
| | | } |
| | | init() { |
| | | this.settings.addSetting(this.ui.uploader, 'open'); |
| | | this.ui.uploader.addEventListener('toggle', (e) =>{ |
| | | console.log(e); |
| | | console.log('Is Open: ', this.ui.uploader.open); |
| | | console.log(this.ui.uploader.open ? 'on' : 'off'); |
| | | this.settings.saveSetting('open', this.ui.uploader.open ? 'on' : 'off'); |
| | | }); |
| | | |
| | | |
| | | // Set up filter controls |
| | | this.filterHandler = this.handleFilterChange.bind(this); |
| | | this.changeHandler = this.handleChange.bind(this); |
| | | |
| | | |
| | | |
| | | this.modals = {}; |
| | | for (let [name, modal] of Object.entries(this.ui.modals)) { |
| | | this.modals[name] = new window.jvbModal(modal); |
| | |
| | | |
| | | this.setupFilters(); |
| | | |
| | | // Load initial data |
| | | this.store.fetch(); |
| | | |
| | | this.queue.subscribe((event, data) => { |
| | | switch (event) { |
| | |
| | | } |
| | | |
| | | populateEditForm(itemID) { |
| | | let item = this.store.get(itemID); |
| | | console.log(itemID); |
| | | |
| | | let item = this.store.get(parseInt(itemID)); |
| | | console.log(item); |
| | | if (item) { |
| | | this.ui.modals.edit.dataset.itemID = itemID; |
| | |
| | | |
| | | setupFilters() { |
| | | document.querySelectorAll('[data-filter]').forEach(filter => { |
| | | this.settings.addSetting(filter) |
| | | filter.addEventListener('change', (e) => { |
| | | if (this.filterTimeout) { |
| | | clearTimeout(this.filterTimeout); |