Merge pull request #230 from bigchaindb/fix/empty-meetup

Check for existing next meetup
This commit is contained in:
Matthias Kretschmann 2018-05-03 17:10:54 +02:00 committed by GitHub
commit 118f458c3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 7 deletions

View File

@ -7,15 +7,23 @@ document.addEventListener('DOMContentLoaded', function() {
// just grab the first item of array
const nextEvent = events[0]
const name = nextEvent.name
const link = nextEvent.link
const date = new Date(nextEvent.time).toLocaleDateString('en-us', { month: 'short', day: 'numeric' })
const element = document.getElementsByClassName('js-social-link--meetup')[0]
const elementTitle = document.getElementsByClassName('meetup-title')[0]
elementTitle.innerHTML = '<span class="hero__community__label">' + date + '</span> ' + '<strong>' + name + '</strong>'
elementTitle.style.opacity = 1
element.href = link
if (nextEvent) {
const name = nextEvent.name
const link = nextEvent.link
const date = new Date(nextEvent.time).toLocaleDateString('en-us', {
month: 'short',
day: 'numeric'
})
const elementTitle = document.getElementsByClassName('meetup-title')[0]
elementTitle.innerHTML = `<span class="hero__community__label">${date}</span><strong>${name}</strong>`
elementTitle.style.opacity = 1
element.href = link
} else {
element.classList.add('hide')
}
}
fetch(url)