Sha256: 8d4e0e49e0ce2e2f7c6408caa04706f25eaf402972f46db8fae8fa20f7e1e0dd

Contents?: true

Size: 642 Bytes

Versions: 14

Compression:

Stored size: 642 Bytes

Contents

export default class Notification {
  /**
   * Initializes the notification widget on the page and allows
   * updating of the notification count and notification label
   *
   * @param {jQuery} element the notification widget
   */
  constructor(element) {
    this.element = element
    this.counter = element.find('.count')
  }

  update(count, label) {
    this.element.attr('aria-label', label)
    this.counter.html(count)

    if (count === 0) {
      this.counter.addClass('invisible')
    }
    else {
      this.counter.removeClass('invisible')
      this.counter.addClass('badge-danger').removeClass('badge-secondary')
    }
  }
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hyrax-5.0.4 app/assets/javascripts/hyrax/notification.es6
hyrax-5.0.3 app/assets/javascripts/hyrax/notification.es6
hyrax-5.0.2 app/assets/javascripts/hyrax/notification.es6
hyrax-5.0.1 app/assets/javascripts/hyrax/notification.es6
hyrax-5.0.0 app/assets/javascripts/hyrax/notification.es6
hyrax-5.0.0.rc3 app/assets/javascripts/hyrax/notification.es6
hyrax-5.0.0.rc2 app/assets/javascripts/hyrax/notification.es6
hyrax-5.0.0.rc1 app/assets/javascripts/hyrax/notification.es6
hyrax-4.0.0 app/assets/javascripts/hyrax/notification.es6
hyrax-4.0.0.rc3 app/assets/javascripts/hyrax/notification.es6
hyrax-4.0.0.rc2 app/assets/javascripts/hyrax/notification.es6
hyrax-4.0.0.rc1 app/assets/javascripts/hyrax/notification.es6
hyrax-4.0.0.beta2 app/assets/javascripts/hyrax/notification.es6
hyrax-4.0.0.beta1 app/assets/javascripts/hyrax/notification.es6