From a596d7cea7bf130812fbaae66ba3d98dbbb8e438 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Tue, 14 Jan 2025 16:45:29 -0600 Subject: [PATCH] Cancel and go back for forms with autofocused inputs --- app/views/buckets/edit.html.erb | 4 +++- app/views/buckets/new.html.erb | 5 +++-- app/views/users/edit.html.erb | 6 ++++-- app/views/users/new.html.erb | 2 +- app/views/users/show.html.erb | 2 +- app/views/workflows/edit.html.erb | 5 +++-- app/views/workflows/index.html.erb | 2 +- app/views/workflows/new.html.erb | 7 ++++--- app/views/workflows/stages/edit.html.erb | 5 +++-- app/views/workflows/stages/new.html.erb | 6 +++--- 10 files changed, 26 insertions(+), 18 deletions(-) diff --git a/app/views/buckets/edit.html.erb b/app/views/buckets/edit.html.erb index 2b4814a2f..aa6d02076 100644 --- a/app/views/buckets/edit.html.erb +++ b/app/views/buckets/edit.html.erb @@ -24,7 +24,7 @@ @@ -71,5 +71,7 @@ <%= image_tag "check.svg", aria: { hidden: true }, size: 24 %> Save + + <%= link_to "Cancel and go back", buckets_path, data: { form_target: "cancel", turbo_frame: "_top" }, hidden: true %> <% end %> diff --git a/app/views/buckets/new.html.erb b/app/views/buckets/new.html.erb index 0483796d6..e8e334a79 100644 --- a/app/views/buckets/new.html.erb +++ b/app/views/buckets/new.html.erb @@ -10,15 +10,16 @@ <% end %>
- <%= form_with model: @bucket, class: "flex flex-column gap txt-large" do |form| %> + <%= form_with model: @bucket, class: "flex flex-column gap txt-large", data: { controller: "form" } do |form| %> <%= image_tag "bubbles.svg", aria: { hidden: "true" }, size: 150, class: "colorize--black center" %> + <%= link_to "Cancel and go back", buckets_path, data: { form_target: "cancel", turbo_frame: "_top" }, hidden: true %> <% end %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 8b4714384..0646d5a29 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -2,7 +2,7 @@ <% content_for :header do %>