Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix weirdness with projects sort and filter #78

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions controllers/projects.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../nav-header/nav-header-element.js'
import ProjectDisplayElement from '../project-display/project-display-element.js'
import FadeOutAnchorElement from '../page-fade/page-fade.js'
import IncludeElement from '../include-element/include-element.js'

Check failure on line 4 in controllers/projects.js

View workflow job for this annotation

GitHub Actions / build

'IncludeElement' is defined but never used

Check failure on line 4 in controllers/projects.js

View workflow job for this annotation

GitHub Actions / build

'IncludeElement' is defined but never used

export default class ProjectsPageController {
/** @type {HTMLElement} */
Expand Down Expand Up @@ -33,8 +33,18 @@
?.get('filter')?.split(',').filter(i => /\S/.test(i)) ?? []

// Setup filter clear button
this.filterClearBtn = document.getElementById('filter-clear')
this.filterClearBtnA = document.getElementById('filter-clear-a')
const filterClearEl = document.getElementById('filter-clear')
if (filterClearEl instanceof HTMLButtonElement)
this.filterClearBtn = filterClearEl
else
throw new Error('Couldn\'t find filter clear button')

const filterClearAEl = document.getElementById('filter-clear-a')
if (filterClearAEl instanceof FadeOutAnchorElement)
this.filterClearBtnA = filterClearAEl
else
throw new Error('Couldn\'t find filter clear button')

if (this.pageFilters.length === 0) {
this.filterClearBtn.toggleAttribute('disabled', true)
document.getElementById('project-tags-label').toggleAttribute('hidden', true)
Expand Down Expand Up @@ -63,9 +73,7 @@
}

// Setup projects once loaded
/** @type {IncludeElement} */
const includeProjectsEl = document.querySelector('#all-projects include-element')
includeProjectsEl.onReady(() => this.#initSortAndFilter())
this.#initSortAndFilter()
}

/**
Expand Down
Loading