Skip to content

Commit 263f7d9

Browse files
committed
Allow spaces to be hidden from directory
1 parent 111798d commit 263f7d9

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

app/models/space.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Space < ApplicationRecord
2-
FEATURES = %w[events materials elearning_materials learning_paths workflows collections trainers content_providers nodes].freeze
2+
FEATURES = %w[events materials elearning_materials learning_paths workflows collections trainers content_providers nodes spaces].freeze
33

44
include PublicActivity::Common
55
include LogParameterChanges

app/views/layouts/_footer.html.erb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
<div class="footer-item">
2828
<%= link_to t('footer.about', title: TeSS::Config.site['title_short']), about_path %>
2929
</div>
30+
<% if TeSS::Config.feature['spaces'] %>
31+
<div class="footer-item">
32+
<%= link_to t('footer.browse_spaces'), spaces_path %>
33+
</div>
34+
<% end %>
3035
<div class="footer-item">
3136
<%= link_to t('footer.funding'), us_path(anchor: 'funding') %>
3237
</div>

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ en:
853853
funding: Funding & acknowledgements
854854
privacy: Privacy
855855
cookie_preferences: Cookie preferences
856+
browse_spaces: Browse Spaces
856857
version: 'Version:'
857858
source_code: Source code
858859
api_documentation: API documentation

test/controllers/static_controller_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,4 +725,18 @@ class StaticControllerTest < ActionController::TestCase
725725
assert_select '.resource-counter a[href=?]', materials_path, count: 0
726726
assert_select '.resource-counter a[href=?]', events_path, count: 1
727727
end
728+
729+
test 'can disable spaces index from directory, but it still shows up in the footer' do
730+
space = spaces(:plants)
731+
space.disabled_features = ['spaces']
732+
space.save!
733+
734+
with_settings(feature: { 'events': false }) do
735+
with_host('plants.mytess.training') do
736+
get :home
737+
assert_select 'ul.nav.navbar-nav li a[href=?]', spaces_path, count: 0
738+
assert_select '.footer-item a[href=?]', spaces_path, count: 1
739+
end
740+
end
741+
end
728742
end

0 commit comments

Comments
 (0)