Skip to content

Commit

Permalink
Merge pull request #1020 from ElixirTeSS/hide-lp-docs
Browse files Browse the repository at this point in the history
Hide learning paths help section if the feature is not enabled
  • Loading branch information
fbacall authored Sep 13, 2024
2 parents 7804a5f + 601f185 commit fe307fd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
22 changes: 12 additions & 10 deletions app/views/about/_about_nav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
</ul>

<!-- REGISTERING YOUR LEARNING PATHS -->
<ul class="nav nav-stacked <%= show_active(show, 'learningpaths') %>">
<li class="about-page-category">
<%= link_to 'Learning Paths', registering_learning_paths_path %>
</li>
<li><%= about_nav_link('Editorial process', registering_learning_paths_path, 'editorial') %></li>
<li><%= about_nav_link('Overview of registering learning paths', registering_learning_paths_path, 'overview') %></li>
<li><%= about_nav_link('Learning path topics', registering_learning_paths_path, 'topics') %></li>
<li><%= about_nav_link('Registering learning paths', registering_learning_paths_path, 'register_paths') %></li>
<li><%= about_nav_link('Viewing learning paths', registering_learning_paths_path, 'viewing') %></li>
</ul>
<% if TeSS::Config.feature['learning_paths'] %>
<ul class="nav nav-stacked <%= show_active(show, 'learning_paths') %>">
<li class="about-page-category">
<%= link_to 'Learning Paths', registering_learning_paths_path %>
</li>
<li><%= about_nav_link('Editorial process', registering_learning_paths_path, 'editorial') %></li>
<li><%= about_nav_link('Overview of registering learning paths', registering_learning_paths_path, 'overview') %></li>
<li><%= about_nav_link('Learning path topics', registering_learning_paths_path, 'topics') %></li>
<li><%= about_nav_link('Registering learning paths', registering_learning_paths_path, 'register_paths') %></li>
<li><%= about_nav_link('Viewing learning paths', registering_learning_paths_path, 'viewing') %></li>
</ul>
<% end %>

<!-- DEVELOPERS -->
<ul class="nav nav-stacked <%= show_active(show, 'developers') %>">
Expand Down
4 changes: 3 additions & 1 deletion app/views/about/_links.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<div class="quick-links">
<%= link_to 'What is ' + TeSS::Config.site['title_short'] + '?', about_path, class: ('selected-tab' if show == 'tess') %>
| <%= link_to 'How to Register', registering_resources_path, class: ('selected-tab' if show == 'registering') %>
| <%= link_to 'Learning Paths', registering_learning_paths_path, class: ('selected-tab' if show == 'learningpaths') %>
<% if TeSS::Config.feature['learning_paths'] %>
| <%= link_to 'Learning Paths', registering_learning_paths_path, class: ('selected-tab' if show == 'learning_paths') %>
<% end %>
| <%= link_to 'Developers Guide', developers_path, class: ('selected-tab' if show == 'developer') %>
| <%= link_to 'About us', us_path, class: ('selected-tab' if show == 'about') %>
</div>
2 changes: 1 addition & 1 deletion app/views/about/learning_paths.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="wrapper">
<div id="sidebar" class="popout-sidebar">
<%= render partial: 'about_nav', locals: { show: 'learningpaths' } %>
<%= render partial: 'about_nav', locals: { show: 'learning_paths' } %>
</div>

<div id="content">
Expand Down
22 changes: 20 additions & 2 deletions test/controllers/about_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,41 @@ class AboutControllerTest < ActionController::TestCase
test 'should get first about page' do
get :tess
assert_response :success
assert_select 'li.about-page-category a[href=?]', registering_learning_paths_path, count: 1
end

test 'should get about us' do
get :us
assert_response :success
end


test 'should get about registering' do
get :registering
assert_response :success
end


test 'should get about developers' do
get :developers
assert_response :success
end

test 'should get about learning paths' do
get :learning_paths
assert_response :success
end

test 'should not list learning path help if feature disabled' do
with_settings(feature: { learning_paths: false }) do
get :tess
assert_response :success
assert_select 'li.about-page-category a[href=?]', registering_learning_paths_path, count: 0
end
end

test 'should access learning paths help directly even if feature disabled' do
with_settings(feature: { learning_paths: false }) do
get :learning_paths
assert_response :success
end
end
end

0 comments on commit fe307fd

Please sign in to comment.