From a7aae833d1ed7796ad31b63a8575dab5fcf7df24 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Mon, 7 Apr 2025 11:14:50 +0200 Subject: [PATCH] Extract helper with fallback for the "go to back" and use consistently --- app/helpers/navigation_helper.rb | 6 ++++++ app/views/bubbles/show.html.erb | 6 +----- app/views/buckets/edit.html.erb | 5 +---- app/views/notifications/settings/show.html.erb | 5 +---- app/views/users/edit.html.erb | 9 +++------ app/views/users/show.html.erb | 5 +---- app/views/workflows/index.html.erb | 6 ++---- app/views/workflows/new.html.erb | 5 +---- 8 files changed, 16 insertions(+), 31 deletions(-) diff --git a/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb index d7c99ec86..39f008a90 100644 --- a/app/helpers/navigation_helper.rb +++ b/app/helpers/navigation_helper.rb @@ -6,4 +6,10 @@ module NavigationHelper icon_tag(icon) + tag.span(label, class: "for-screen-reader") end end + + def link_to_back(fallback_path: root_path) + link_to "#", class: "btn flex-item-justify-start", data: { controller: "back-navigation hotkey", action: "keydown.esc@document->hotkey#click", back_navigation_fallback_destination_value: fallback_path } do + icon_tag("arrow-left") + tag.span("Go Back", class: "for-screen-reader") + end + end end diff --git a/app/views/bubbles/show.html.erb b/app/views/bubbles/show.html.erb index cdd73d38f..8d98ac80a 100644 --- a/app/views/bubbles/show.html.erb +++ b/app/views/bubbles/show.html.erb @@ -22,12 +22,8 @@