From 9a92ffdfa84712edcf15437955d0c03ba193e62f Mon Sep 17 00:00:00 2001 From: Valentin Ryckaert Date: Thu, 23 Jul 2026 10:11:18 +0200 Subject: [PATCH 1/4] feat: add url to tess docs in tess.yml and add redirection --- app/controllers/about_controller.rb | 22 ++++++++++++++++------ app/views/layouts/_header.html.erb | 2 +- config/tess.example.yml | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb index 1ac45c73b..9cd5ed559 100644 --- a/app/controllers/about_controller.rb +++ b/app/controllers/about_controller.rb @@ -1,12 +1,8 @@ -# The controller for actions related to the about pages class AboutController < ApplicationController - + before_action :check_external_link, only: [:tess, :registering, :learning_paths, :developers, :us] skip_before_action :authenticate_user!, :authenticate_user_from_token! - - def tess - end - def us + def tess end def registering @@ -18,4 +14,18 @@ def learning_paths def developers end + def us + end + + private + + def check_external_link + if TeSS::Config.site['about_us_link'] + action_name_map = { + 'tess' => '/', 'registering' => '/content/intro-content/', + 'learning_paths' => '/content/learning-paths/', 'developers' => '/developers/code-data/', 'us' => '/overview/about' + } + redirect_to "#{TeSS::Config.site['about_us_link']}#{action_name_map[action_name]}", allow_other_host: true + end + end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 52da0aeca..2330a2aec 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -64,7 +64,7 @@ <%= menu_group(pull: 'right') do %> <% main_tabs.each do |t| %> - <%= menu_item t("features.#{t[:feature]}.short"), t[:link] %> + <%= menu_item t("features.#{t[:feature]}.short"), t[:link], (TeSS::Config.site['about_us_link'] ? { target: '_blank' } : {}) %> <% end %> <% if directory_tabs.present? %> diff --git a/config/tess.example.yml b/config/tess.example.yml index 70560649e..18d9042e1 100644 --- a/config/tess.example.yml +++ b/config/tess.example.yml @@ -131,6 +131,7 @@ default: &default directory_tabs: ['trainers', 'content_providers', 'nodes', 'spaces'] # The order in with the 'about us' tabs appear about_us_tab_order: ['tess_club', 'contact', 'team', 'funding', 'acknowledgements', 'cite'] + about_us_link: https://elixirtess.github.io/docs # no / at the end n_provider_ids: 5 calendar_event_maxlength: 5 content_provider_grid_long: true # true for full width in grid, false for short From 3a664153f67fef804c2b716c3c9a317632cd7bda Mon Sep 17 00:00:00 2001 From: Valentin Ryckaert Date: Thu, 23 Jul 2026 10:36:58 +0200 Subject: [PATCH 2/4] fix: fix some bugs --- app/controllers/about_controller.rb | 2 +- app/views/layouts/_header.html.erb | 2 +- test/config/test_tess.yml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb index 9cd5ed559..e52f48552 100644 --- a/app/controllers/about_controller.rb +++ b/app/controllers/about_controller.rb @@ -20,7 +20,7 @@ def us private def check_external_link - if TeSS::Config.site['about_us_link'] + if TeSS::Config.site['about_us_link'].present? action_name_map = { 'tess' => '/', 'registering' => '/content/intro-content/', 'learning_paths' => '/content/learning-paths/', 'developers' => '/developers/code-data/', 'us' => '/overview/about' diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 2330a2aec..472d97bc7 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -64,7 +64,7 @@ <%= menu_group(pull: 'right') do %> <% main_tabs.each do |t| %> - <%= menu_item t("features.#{t[:feature]}.short"), t[:link], (TeSS::Config.site['about_us_link'] ? { target: '_blank' } : {}) %> + <%= menu_item t("features.#{t[:feature]}.short"), t[:link], (TeSS::Config.site['about_us_link'].present? ? { target: '_blank' } : {}) %> <% end %> <% if directory_tabs.present? %> diff --git a/test/config/test_tess.yml b/test/config/test_tess.yml index b2511a0fe..7df36ac09 100644 --- a/test/config/test_tess.yml +++ b/test/config/test_tess.yml @@ -30,6 +30,7 @@ default: &default repository: '' supported_by: 'elixir_supported_by' widget_example: 'elixir_widget_example' + about_us_link: gmaps_api_key: '' mailer: delivery_method: test From eae1fb53adf15463e1b3b23a974fd7b713ffc167 Mon Sep 17 00:00:00 2001 From: Valentin Ryckaert <145444837+valentinRyckaert@users.noreply.github.com> Date: Thu, 20 Aug 2026 14:40:18 +0200 Subject: [PATCH 3/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- app/views/layouts/_header.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 472d97bc7..0de4eabe7 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -64,7 +64,7 @@ <%= menu_group(pull: 'right') do %> <% main_tabs.each do |t| %> - <%= menu_item t("features.#{t[:feature]}.short"), t[:link], (TeSS::Config.site['about_us_link'].present? ? { target: '_blank' } : {}) %> + <%= menu_item t("features.#{t[:feature]}.short"), t[:link], (t[:feature] == 'about' && TeSS::Config.site['about_us_link'].present? ? { target: '_blank', rel: 'noopener' } : {}) %> <% end %> <% if directory_tabs.present? %> From 6f9b057d8fc79a9ab4741e01b08e1efcaa79183f Mon Sep 17 00:00:00 2001 From: = Date: Thu, 20 Aug 2026 16:09:59 +0200 Subject: [PATCH 4/4] feat: apply copilot suggestions --- app/controllers/about_controller.rb | 12 ++++++---- test/controllers/about_controller_test.rb | 27 +++++++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb index e52f48552..fc970f5cc 100644 --- a/app/controllers/about_controller.rb +++ b/app/controllers/about_controller.rb @@ -21,11 +21,15 @@ def us def check_external_link if TeSS::Config.site['about_us_link'].present? - action_name_map = { - 'tess' => '/', 'registering' => '/content/intro-content/', - 'learning_paths' => '/content/learning-paths/', 'developers' => '/developers/code-data/', 'us' => '/overview/about' + base = TeSS::Config.site['about_us_link'].to_s.chomp('/') + action_name_map = { + 'tess' => '/', + 'registering' => '/content/intro-content/', + 'learning_paths' => '/content/learning-paths/', + 'developers' => '/developers/code-data/', + 'us' => '/overview/about/' } - redirect_to "#{TeSS::Config.site['about_us_link']}#{action_name_map[action_name]}", allow_other_host: true + redirect_to "#{base}#{action_name_map.fetch(action_name)}", allow_other_host: true end end end diff --git a/test/controllers/about_controller_test.rb b/test/controllers/about_controller_test.rb index 6f550d878..72ef8f4dc 100644 --- a/test/controllers/about_controller_test.rb +++ b/test/controllers/about_controller_test.rb @@ -127,4 +127,31 @@ class AboutControllerTest < ActionController::TestCase assert_response :success end end + + test 'should redirect about pages to external link when configured' do + site_settings = TeSS::Config.site.dup + site_settings['about_us_link'] = 'https://example.org' + + with_settings(site: site_settings) do + get :tess + assert_response :redirect + assert_redirected_to 'https://example.org/' + + get :registering + assert_response :redirect + assert_redirected_to 'https://example.org/content/intro-content/' + + get :learning_paths + assert_response :redirect + assert_redirected_to 'https://example.org/content/learning-paths/' + + get :developers + assert_response :redirect + assert_redirected_to 'https://example.org/developers/code-data/' + + get :us + assert_response :redirect + assert_redirected_to 'https://example.org/overview/about/' + end + end end