Skip to content

Commit

Permalink
ref: notifications without jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Feb 3, 2024
1 parent 3451ad0 commit 9d7ac40
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions EMS/admin-ui-bundle/assets/js/core/components/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ class Notifications {

startActivity () {
if (++this.counter > 0) {
document.getElementById('ajax-activity').classList.add("fa-spin")
document.getElementById('ajax-activity').classList.add('fa-spin')
}
}

stopActivity () {
if (--this.counter === 0) {
document.getElementById('ajax-activity').classList.remove("fa-spin")
document.getElementById('ajax-activity').classList.remove('fa-spin')
}
}

Expand All @@ -23,17 +23,17 @@ class Notifications {
}
const activityList = document.getElementById('activity-log')
for (let index = 0; index < messages.length; ++index) {
const listItem = document.createElement('li')
listItem.innerHTML = messages[index]
listItem.setAttribute('title', listItem.textContent)
activityList.insertAdjacentElement("beforeend", listItem)
const listItem = document.createElement('li')
listItem.innerHTML = messages[index]
listItem.setAttribute('title', listItem.textContent)
activityList.insertAdjacentElement('beforeend', listItem)
}
this.updateCounter()
}

updateCounter () {
const numberOfElem = document.querySelectorAll('ul#activity-log>li').length
document.getElementById('activity-counter').innerHTML = 0 === numberOfElem ? '' : numberOfElem
document.getElementById('activity-counter').innerHTML = numberOfElem === 0 ? '' : numberOfElem
}

addNoticeMessages (notices) {
Expand Down

0 comments on commit 9d7ac40

Please sign in to comment.