Sha256: 340c5a6ed10ca19c8f9f8fa23f1b5afe3b14b7f9780a1fe346ad54a80a7bf1bc

Contents?: true

Size: 951 Bytes

Versions: 7

Compression:

Stored size: 951 Bytes

Contents

import { Controller } from '@hotwired/stimulus'
import Rollbar from 'rollbar'

export default class extends Controller {
  connect () {
    this.element.querySelectorAll('.form-select, .form-control').forEach((slct) => {
      slct.addEventListener('change', (e) => {
        if (e.target.value) {
          slct.classList.remove('is-invalid')
        }
      })
    })
    const notBaseErrors = this.element.querySelector('.not_base_errors')

    if (notBaseErrors) {
      const invalidFeedback = document.querySelector('.invalid-feedback')
      if (!invalidFeedback) {
        console.error(notBaseErrors.dataset.errors)
        Rollbar.error(notBaseErrors.dataset.errors)
        const errorTitle = this.element.querySelector('.error-title')
        errorTitle.innerText = 'Lo lamentamos mucho pero ocurrió algo inesperado. Por favor, intentá nuevamente o ponete en contacto con nosotros.'
        // FIXME: link a contacto
      }
    }
  }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pg_rails-7.0.8.pre.alpha.37 pg_layout/app/javascript/controllers/pg_form_controller.js
pg_rails-7.0.8.pre.alpha.36 pg_layout/app/javascript/controllers/pg_form_controller.js
pg_rails-7.0.8.pre.alpha.35 pg_layout/app/javascript/controllers/pg_form_controller.js
pg_rails-7.0.8.pre.alpha.34 pg_layout/app/javascript/controllers/pg_form_controller.js
pg_rails-7.0.8.pre.alpha.33 pg_layout/app/javascript/controllers/pg_form_controller.js
pg_rails-7.0.8.pre.alpha.32 pg_layout/app/javascript/controllers/pg_form_controller.js
pg_rails-7.0.8.pre.alpha.31 pg_layout/app/javascript/controllers/pg_form_controller.js