Skip to content

Commit

Permalink
Merge pull request #78 from wmo-raf/dev
Browse files Browse the repository at this point in the history
Updates and Bug Fixes
  • Loading branch information
erick-otenyo authored Mar 15, 2024
2 parents cab0857 + 997adbb commit afc9df1
Show file tree
Hide file tree
Showing 70 changed files with 1,905 additions and 1,846 deletions.
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

0 comments on commit afc9df1

Please sign in to comment.