Skip to content

Commit 111798d

Browse files
committed
Hide disabled space features from front page counters
1 parent 452613e commit 111798d

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

app/views/static/home/_counters.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% features ||= ['events', 'materials', 'workflows', 'learning_paths', 'trainers'] %>
2-
<% features = features.select { |f| TeSS::Config.feature[f] } %>
2+
<% features = features.select { |f| feature_enabled?(f) } %>
33

44
<section id="counters">
55
<ul class="counter">

test/controllers/static_controller_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,4 +712,17 @@ class StaticControllerTest < ActionController::TestCase
712712
end
713713
end
714714
end
715+
716+
test 'disabled features do not show as counters on space front page' do
717+
space = spaces(:plants)
718+
space.disabled_features = ['materials']
719+
space.save!
720+
721+
with_host('plants.mytess.training') do
722+
get :home
723+
end
724+
725+
assert_select '.resource-counter a[href=?]', materials_path, count: 0
726+
assert_select '.resource-counter a[href=?]', events_path, count: 1
727+
end
715728
end

0 commit comments

Comments
 (0)