Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions app/controllers/about_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'].present?
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
2 changes: 1 addition & 1 deletion app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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'].present? ? { target: '_blank' } : {}) %>
<% end %>

<% if directory_tabs.present? %>
Expand Down
1 change: 1 addition & 0 deletions config/tess.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/config/test_tess.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down