From f163f6518b350a22b4ad830d37f55b50b5e52b86 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Fri, 20 Feb 2026 19:46:55 -0500 Subject: [PATCH] Use DIV and not A for vin element --- app/views/issues/_show_issue_view_right.html.erb | 2 +- app/views/vehicles/_details.html.erb | 2 +- app/views/vehicles/_list.html.erb | 2 +- assets/javascripts/copy.js | 11 ++++------- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/views/issues/_show_issue_view_right.html.erb b/app/views/issues/_show_issue_view_right.html.erb index b1d53eb..86942f4 100644 --- a/app/views/issues/_show_issue_view_right.html.erb +++ b/app/views/issues/_show_issue_view_right.html.erb @@ -6,7 +6,7 @@
<%=t(:field_vin)%>:
- <%=split_vin[0] if split_vin%><%=split_vin[1] if split_vin%> +
diff --git a/app/views/vehicles/_details.html.erb b/app/views/vehicles/_details.html.erb index cc0c538..1ab5436 100644 --- a/app/views/vehicles/_details.html.erb +++ b/app/views/vehicles/_details.html.erb @@ -19,7 +19,7 @@ <%= t(:field_vin) %> - <%= @vin[0] if @vin %><%=@vin[1] if @vin%> +
<%= @vin[0] if @vin %><%=@vin[1] if @vin%>
diff --git a/app/views/vehicles/_list.html.erb b/app/views/vehicles/_list.html.erb index 68208cf..cd8fd25 100644 --- a/app/views/vehicles/_list.html.erb +++ b/app/views/vehicles/_list.html.erb @@ -17,7 +17,7 @@
- <%= vehicle.vin.scan(/.{1,9}/)[0] if vehicle.vin %><%=vehicle.vin.scan(/.{1,9}/)[1] if vehicle.vin%> +
<%= vehicle.vin.scan(/.{1,9}/)[0] if vehicle.vin %><%=vehicle.vin.scan(/.{1,9}/)[1] if vehicle.vin%>
<% if show_customer %>
<%= vehicle.customer %> diff --git a/assets/javascripts/copy.js b/assets/javascripts/copy.js index adf0bf3..3410714 100644 --- a/assets/javascripts/copy.js +++ b/assets/javascripts/copy.js @@ -1,12 +1,9 @@ async function handleCopy(event) { console.log("Copy link clicked"); - - // 1. Prevent the link from actually navigating - event.preventDefault(); let text; let link; - // 2. Grab the text from our clicked link + // Grab the text from our clicked link if(event.target.tagName.toLowerCase() === 'b'){ text = event.target.parentElement.innerText; link = event.target.parentElement; @@ -16,15 +13,15 @@ async function handleCopy(event) { } try { - // 3. Write to clipboard + // Write to clipboard await navigator.clipboard.writeText(text); - // 4. Update the UI to show it worked + // Update the UI to show it worked const originalText = link.innerText; link.innerHTML = "Copied!"; link.style.color = "#4CAF50"; // Turn green - // 5. Reset after 2 seconds + // Reset after 2 seconds setTimeout(() => { // Check if the text is long enough to prevent errors if (originalText.length >= 8) {