Sha256: 013e045ca3458847526e7a47dfe1fad3e62790593aec82a6663603c280d494e5

Contents?: true

Size: 549 Bytes

Versions: 5

Compression:

Stored size: 549 Bytes

Contents

import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
  static get targets() {
    return ["email", "password", "submit"];
  }

  connect() {
    this.email = this.emailTarget.value;
    this.pass = this.passwordTarget.value;

    this.syncState();
  }

  updateEmail(e) {
    this.email = e.target.value;
    this.syncState();
  }

  updatePassword(e) {
    this.pass = e.target.value;
    this.syncState();
  }

  syncState() {
    this.submitTarget.disabled = !this.email?.includes("@") || !this.pass;
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masks-0.4.0 app/assets/javascripts/controllers/emails_controller.js
masks-0.3.2 app/assets/javascripts/controllers/emails_controller.js
masks-0.3.1 app/assets/javascripts/controllers/emails_controller.js
masks-0.3.0 app/assets/javascripts/controllers/emails_controller.js
masks-0.2.0 app/assets/javascripts/controllers/emails_controller.js