From f21eca4ccc245276495c5ee3a1914333eba538f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 5 Oct 2023 21:26:13 +0200 Subject: [PATCH] Open custom dashboard links in the same window We were opening these links in a new tab/window because we assume they were external links. But, on the one hand, we don't even know whether these links are external, since they could also point to URLs from our site. And, on the other hand, opening external links in new windows results in usability issues as well [1, 2]. On top of that, old browsers have security issues when opening links in new tabs unless we add `rel="noopener"` [3], and we aren't doing so. [1] https://www.nngroup.com/articles/new-browser-windows-and-tabs [2] https://css-tricks.com/use-target_blank [3] https://mathiasbynens.github.io/rel-noopener/ --- app/views/dashboard/_proposed_action.html.erb | 2 +- app/views/dashboard/actions/new_request.html.erb | 2 +- app/views/dashboard/polls/index.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/dashboard/_proposed_action.html.erb b/app/views/dashboard/_proposed_action.html.erb index a19a047e1..082ddf0ed 100644 --- a/app/views/dashboard/_proposed_action.html.erb +++ b/app/views/dashboard/_proposed_action.html.erb @@ -46,7 +46,7 @@ <% end %> <% proposed_action.links.each do |link| %> -

<%= link_to link.label, link.url, target: "_blank" %>

+

<%= link_to link.label, link.url %>

<% end %> <% proposed_action.documents.each do |document| %> diff --git a/app/views/dashboard/actions/new_request.html.erb b/app/views/dashboard/actions/new_request.html.erb index 93549ec36..907d1b090 100644 --- a/app/views/dashboard/actions/new_request.html.erb +++ b/app/views/dashboard/actions/new_request.html.erb @@ -13,7 +13,7 @@

<%= t("dashboard.new_request.links") %>

<% dashboard_action.links.each do |link| %> -

<%= link_to link.label, link.url, target: "_blank" %>

+

<%= link_to link.label, link.url %>

<% end %>
<% end %> diff --git a/app/views/dashboard/polls/index.html.erb b/app/views/dashboard/polls/index.html.erb index 24c9fd82d..fb7eebae8 100644 --- a/app/views/dashboard/polls/index.html.erb +++ b/app/views/dashboard/polls/index.html.erb @@ -14,7 +14,7 @@ <% if Setting["proposals.poll_link"].present? %>

<%= t("dashboard.polls.index.links") %>

<%= link_to t("dashboard.polls.index.additiontal_information"), - Setting["proposals.poll_link"], target: "_blank" %> + Setting["proposals.poll_link"] %> <% end %>

<%= t("dashboard.polls.index.count", count: @polls.count) %>