From b33190f3659f89d7b847b1df6e80725ec694bfdb Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 14 Jul 2022 10:57:32 +0100 Subject: [PATCH] Add special link for NI charities The NI Charity Commission site only accepts the numeric part of the ID (i.e. without the "NIC" prefix), so we need to strip that for the query param. Fixes https://github.com/mysociety/whatdotheyknow-theme/issues/1267. --- lib/views/public_body/_more_info.html.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/views/public_body/_more_info.html.erb b/lib/views/public_body/_more_info.html.erb index 17a111ca..42730cdc 100644 --- a/lib/views/public_body/_more_info.html.erb +++ b/lib/views/public_body/_more_info.html.erb @@ -17,6 +17,9 @@ <% if tag_value.match(/^SC/) %> <%= link_to _('Charity registration'), "https://www.oscr.org.uk/about-charities/search-the-register/charity-details?number=#{ tag_value }" %>
+ <% elsif tag_value.match(/^NIC/) %> + <%= link_to _('Charity registration'), + "https://www.charitycommissionni.org.uk/charity-search/?regId=#{ tag_value.gsub(/^NIC/, '') }" %>
<% else %> <%= link_to _('Charity registration'), "https://register-of-charities.charitycommission.gov.uk/charity-search/-/results/page/1/delta/20/keywords/#{ tag_value }" %>