Sha256: c962ce1d32987274312c79845970f86b3df4824d1e6d2c707f5cbf7ad8cfc0a3

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

/* global Swal */
document.addEventListener('DOMContentLoaded', function() {
  const infoToggle = document.querySelectorAll('[data-show-info]')

  infoToggle.forEach(function(infoElem) {
    infoElem.addEventListener('click', function() {
      const alertType = infoElem.dataset.alertKind
      const alertTitle = infoElem.dataset.alertTitle
      const alertHtml = infoElem.dataset.alertHtml
      const alertMessage = infoElem.dataset.alertMessage

      showInfoAlert(alertType, alertTitle, alertMessage, alertHtml)
    })
  })
})

// eslint-disable-next-line no-unused-vars
function showInfoAlert(type = null, title = null, message = null, html = null) {
  const infoAlert = Swal.mixin({
    showConfirmButton: false,
    showCloseButton: true,
    timer: null,
    timerProgressBar: false,
    showClass: {
      popup: 'animate__animated animate__fadeInUp animate__faster'
    },
    hideClass: {
      popup: 'animate__animated animate__fadeOutDown animate__faster'
    }
  })

  infoAlert.fire({
    icon: type,
    title: title,
    text: message,
    html: html
  })
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spree_backend-4.3.3 app/assets/javascripts/spree/backend/global/info_alert.es6
spree_backend-4.3.2 app/assets/javascripts/spree/backend/global/info_alert.es6
spree_backend-4.3.1 app/assets/javascripts/spree/backend/global/info_alert.es6
spree_backend-4.3.0 app/assets/javascripts/spree/backend/global/info_alert.es6
spree_backend-4.3.0.rc3 app/assets/javascripts/spree/backend/global/info_alert.es6
spree_backend-4.3.0.rc2 app/assets/javascripts/spree/backend/global/info_alert.es6
spree_backend-4.3.0.rc1 app/assets/javascripts/spree/backend/global/info_alert.es6