1import { Controller } from "@hotwired/stimulus"; 2import { patch } from "@rails/request.js"; 3 4export default class extends Controller { 5 static targets = ["checkbox", "status"]; 6 7 async toggle() { 8 const url = this.checkboxTarget.dataset.url; 9 const value = this.checkboxTarget.checked; 10 11 await patch(url, { 12 body: JSON.stringify({ user: { notify_at_sign_in: value } }), 13 contentType: "application/json", 14 }); 15 16 this.showSaved(); 17 } 18 19 showSaved() { 20 const saved = document.createElement("span"); 21 saved.className = "notify-sign-in-saved"; 22 saved.innerHTML = " saved!"; 23 this.statusTarget.appendChild(saved); 24 25 setTimeout(() => saved.remove(), 1500); 26 } 27}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.