From ac24f28198841e919317032086b8d8d8b8903cf3 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Sun, 1 Oct 2023 20:24:48 +0000 Subject: [PATCH] Switch over more links --- app/helpers/application_helper.rb | 7 +++++++ app/views/_tailwind/alerts_new/index.html.erb | 4 ++-- .../devise/registrations/edit.html.erb | 2 +- app/views/_tailwind/profiles/_menu.html.erb | 18 +++++++++--------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2ef9ad48c..9ef66e1ce 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -18,6 +18,13 @@ def pa_link_to(body, url, html_options = {}) link_to(body, url, class: "#{html_options[:class]} text-fuchsia font-bold hover:underline") end + # Only to be used in tailwind theme + # TODO: Generalise to support all the variants + sig { params(body: String, url: String, html_options: T::Hash[Symbol, String]).returns(String) } + def pa_link_to_unless_current(body, url, html_options = {}) + link_to_unless_current(body, url, class: "#{html_options[:class]} text-fuchsia font-bold hover:underline") + end + sig { params(path: String, extra_classes: T::Array[Symbol], block: T.untyped).returns(T.untyped) } def menu_item(path, extra_classes: [], &block) li_selected(current_page?(path), extra_classes:) do diff --git a/app/views/_tailwind/alerts_new/index.html.erb b/app/views/_tailwind/alerts_new/index.html.erb index 318c08b46..d76fde5dc 100644 --- a/app/views/_tailwind/alerts_new/index.html.erb +++ b/app/views/_tailwind/alerts_new/index.html.erb @@ -4,7 +4,7 @@ Alerts are sent to your email at <%= current_user.email %>

- <%= link_to "Change", edit_user_registration_path, class: "text-orange underline font-bold text-2xl mt-1 inline-block" %> + <%= pa_link_to "Change", edit_user_registration_path, class: "text-2xl mt-1 inline-block" %> <% if @alerts.empty? %> @@ -12,7 +12,7 @@

You have no saved alerts

- <%= link_to "Create your first one", new_profile_alert_path, class: "text-orange text-2xl font-bold underline" %> + <%= pa_link_to "Create your first one", new_profile_alert_path, class: "text-2xl" %>
<%= image_tag "tailwind/illustration/woman-looking-off.svg", class: "mt-6", alt: "Illustration of a woman looking off into the distance" %> diff --git a/app/views/_tailwind/devise/registrations/edit.html.erb b/app/views/_tailwind/devise/registrations/edit.html.erb index 970d1ca8f..060f7ea04 100644 --- a/app/views/_tailwind/devise/registrations/edit.html.erb +++ b/app/views/_tailwind/devise/registrations/edit.html.erb @@ -46,7 +46,7 @@ <% unless resource.comments.visible.empty? %>

Note that the - <%= link_to pluralize(resource.comments.visible.count, "comment"), comments_profile_path, class: "text-orange underline" %> + <%= pa_link_to pluralize(resource.comments.visible.count, "comment"), comments_profile_path %> you have made (including the name attached to the comment) will not be removed as it is part of the public record. However the private information, your email address, will be removed.

diff --git a/app/views/_tailwind/profiles/_menu.html.erb b/app/views/_tailwind/profiles/_menu.html.erb index 53022fe05..b11c37dd5 100644 --- a/app/views/_tailwind/profiles/_menu.html.erb +++ b/app/views/_tailwind/profiles/_menu.html.erb @@ -1,15 +1,15 @@ -