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

Updates and Bug Fixes #78

Merged
merged 7 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions base/templates/blocks/extreme_block.html

This file was deleted.

15 changes: 0 additions & 15 deletions base/templates/blocks/extreme_block_item.html

This file was deleted.

2 changes: 2 additions & 0 deletions nmhs_cms/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"pages.home",
"pages.services",
"pages.products",
"pages.weather",
"pages.mediacenter",
"pages.news",
"pages.videos",
Expand Down Expand Up @@ -139,6 +140,7 @@
"wagtail_modeladmin",
"dbbackup",
"wagtailmodelchooser",
"django_extensions",
]

DBBACKUP_STORAGE = 'django.core.files.storage.FileSystemStorage'
Expand Down
7 changes: 7 additions & 0 deletions nmhs_cms/static/css/animate.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions nmhs_cms/static/css/bulma-carousel.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nmhs_cms/static/css/bulma-divider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nmhs_cms/static/css/bulma.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions nmhs_cms/static/css/maplibre-gl.css

Large diffs are not rendered by default.

Binary file added nmhs_cms/static/images/event_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions nmhs_cms/static/js/bulma-carousel.min.js

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions nmhs_cms/static/js/bulmahead.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const debounce = (callback, wait) => {
let timeoutId = null;
return (...args) => {
window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => {
callback.apply(null, args);
}, wait);
};
}

const bulmaHead = (id, idMenu, api, onSelect, delay, minLen = 2) => {
const input = document.getElementById(id)
const menuEl = document.getElementById(idMenu)
menuEl.innerHTML = '<div class="dropdown-content"></div>'

const setValue = e => {
e.preventDefault()
const label = e.target.text
const value = e.target.dataset.value
input.value = label
menuEl.style.display = 'none'
if (onSelect) {
onSelect({label, value})
}
return false
}

const handleApi = e => {
const value = e.target.value
menuEl.style.display = 'none'
menuEl.innerHTML = '<div class="dropdown-content"></div>'
if (value.length <= minLen) {
return
}

api(value).then(suggestions => {
const suggestionsEl = suggestions.map(({label, value}) => {
const a = document.createElement('a')
a.href = '#'
a.classList.add('dropdown-item')
a.innerHTML = label
a.dataset.value = value
a.addEventListener('click', setValue)
return a
})

suggestionsEl.map(suggEl => {
menuEl.childNodes[0].appendChild(suggEl)
})

if (suggestions.length > 0) {
menuEl.style.display = 'block'
}

if (suggestions.length === 0) {
const div = document.createElement('div')
div.classList.add('dropdown-item')
div.innerHTML = 'No result'
menuEl.childNodes[0].appendChild(div)

menuEl.style.display = 'block'
}
})
}
input.addEventListener('input', debounce(handleApi, delay))

input.addEventListener('focusout', e => {
if (e.relatedTarget === null || !e.relatedTarget.classList.contains('dropdown-item')) {
menuEl.style.display = 'none'
}
})

input.addEventListener('focusin', handleApi)
}

window.bulmaHead = bulmaHead
2 changes: 2 additions & 0 deletions nmhs_cms/static/js/jquery-3.6.3.min.js

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions nmhs_cms/static/js/maplibre-gl.js

Large diffs are not rendered by default.

Loading