Sha256: 228361f0b44934efd8104224646cfc6580e028f445acc75706cf5728df4ae52f

Contents?: true

Size: 764 Bytes

Versions: 5

Compression:

Stored size: 764 Bytes

Contents

import { Controller } from "@hotwired/stimulus"
import { useTransition } from "stimulus-use"

/**
 * Alert Controller
 *
 * Este controlador funciona con el template _notification.html.erb que es utilizado
 * en el layout NoPassword.
 * Cuando hay información en el objeto Flash de Rails se muestra con una animación
 * el mensaje y desaparece solo después de 10 segundos o cerrándolo con la X.
 */

export default class extends Controller {
  static targets = ["notification"];

  connect() {
    let element = this.element;
    if (this.hasNotificationTarget) {
      element = this.notificationTarget
    }
    useTransition(this, { element: element })

    this.enter()

    setTimeout(this.close.bind(this), 10000)
  }

  close() {
    this.leave()
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
no_password_auth-0.5.0 app/assets/javascripts/no_password/controllers/alert_controller.js
no_password_auth-0.4.1 app/assets/javascripts/no_password/controllers/alert_controller.js
no_password_auth-0.4.0 app/assets/javascripts/no_password/controllers/alert_controller.js
no_password_auth-0.3.0 app/assets/javascripts/no_password/controllers/alert_controller.js
no_password_auth-0.2.1 app/assets/javascripts/no_password/controllers/alert_controller.js