Sha256: 6b857f39b5cb1d6060c9b591c830e66d50de6712581c5d406e68524d8f81c534

Contents?: true

Size: 640 Bytes

Versions: 61

Compression:

Stored size: 640 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('label-danger').removeClass('label-default')
    }
  }
}

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
hyrax-3.6.0 app/assets/javascripts/hyrax/notification.es6
hyrax-3.5.0 app/assets/javascripts/hyrax/notification.es6
hyrax-3.4.2 app/assets/javascripts/hyrax/notification.es6
hyrax-3.4.1 app/assets/javascripts/hyrax/notification.es6
hyrax-3.4.0 app/assets/javascripts/hyrax/notification.es6
hyrax-3.3.0 app/assets/javascripts/hyrax/notification.es6
hyrax-3.2.0 app/assets/javascripts/hyrax/notification.es6
hyrax-2.9.6 app/assets/javascripts/hyrax/notification.es6
hyrax-3.1.0 app/assets/javascripts/hyrax/notification.es6
hyrax-2.9.5 app/assets/javascripts/hyrax/notification.es6
hyrax-3.0.2 app/assets/javascripts/hyrax/notification.es6
hyrax-3.0.1 app/assets/javascripts/hyrax/notification.es6
hyrax-3.0.0 app/assets/javascripts/hyrax/notification.es6
hyrax-3.0.0.pre.rc4 app/assets/javascripts/hyrax/notification.es6
hyrax-2.9.4 app/assets/javascripts/hyrax/notification.es6
hyrax-3.0.0.pre.rc3 app/assets/javascripts/hyrax/notification.es6
hyrax-2.9.3 app/assets/javascripts/hyrax/notification.es6
hyrax-2.9.2 app/assets/javascripts/hyrax/notification.es6
hyrax-2.9.1 app/assets/javascripts/hyrax/notification.es6
hyrax-2.9.0 app/assets/javascripts/hyrax/notification.es6