Sha256: 046ca68c0ef990f39f4f24c6496006efce181e3a2f594a616f3a258bcddf3108

Contents?: true

Size: 499 Bytes

Versions: 31

Compression:

Stored size: 499 Bytes

Contents

import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
  static targets = ['container']

  connect() {
    window.toastr[this.type](this.message)
  }

  get type() {
    const typeMap = {
      info: 'info',
      warning: 'warning',
      success: 'success',
      error: 'error',
      notice: 'info',
      alert: 'error',
    }

    return typeMap[this.containerTarget.dataset.alertType]
  }

  get message() {
    return this.containerTarget.innerHTML
  }
}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
avo-1.25.2 app/javascript/js/controllers/alerts_controller.js
avo-2.5.2.pre.7 app/javascript/js/controllers/alerts_controller.js
avo-2.5.2.pre.2 app/javascript/js/controllers/alerts_controller.js
avo-2.5.2.pre.1 app/javascript/js/controllers/alerts_controller.js
avo-2.5.1 app/javascript/js/controllers/alerts_controller.js
avo-2.5.0 app/javascript/js/controllers/alerts_controller.js
avo-2.4.1 app/javascript/js/controllers/alerts_controller.js
avo-2.4.0 app/javascript/js/controllers/alerts_controller.js
avo-2.3.1.pre.6 app/javascript/js/controllers/alerts_controller.js
avo-2.3.1.pre.5 app/javascript/js/controllers/alerts_controller.js
avo-2.3.1.pre.4 app/javascript/js/controllers/alerts_controller.js
avo-2.3.1.pre.3 app/javascript/js/controllers/alerts_controller.js
avo-2.3.1.pre.2 app/javascript/js/controllers/alerts_controller.js
avo-2.3.1.pre.1 app/javascript/js/controllers/alerts_controller.js
avo-2.3.0 app/javascript/js/controllers/alerts_controller.js
avo-2.2.2 app/javascript/js/controllers/alerts_controller.js
avo-2.2.1 app/javascript/js/controllers/alerts_controller.js
avo-2.2.0 app/javascript/js/controllers/alerts_controller.js
avo-2.1.2.pre2 app/javascript/js/controllers/alerts_controller.js
avo-2.1.2.pre1 app/javascript/js/controllers/alerts_controller.js