Skip to content

Commit

Permalink
Add feature flag for topic pages on WDTK
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Apr 30, 2024
1 parent 3c64a44 commit 0114e9e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/alavetelitheme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def prepend_theme_assets
'school_late_calculator.rb',
'volunteer_contact_form.rb',
'data_breach.rb',
'excel_analyzer.rb']
'excel_analyzer.rb',
'topic_pages.rb']
require File.expand_path "../#{patch}", __FILE__
end

Expand Down
8 changes: 8 additions & 0 deletions lib/topic_pages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Rails.configuration.after_initialize do
feature_keys = AlaveteliFeatures.features.all.map(&:key)

AlaveteliFeatures.features.add(
:wdtk_topic_pages,
label: 'Browse request topic pages'
) unless feature_keys.include?(:wdtk_topic_pages)
end
10 changes: 10 additions & 0 deletions lib/views/request/_tabs.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% if feature_enabled?(:wdtk_topic_pages, current_user) %>
<% content_for :subnav do %>
<li class="<%= 'selected' unless current_page?(requests_path) %>">
<%= link_to _('Search requests'), request_list_path %>
</li>
<li class="<%= 'selected' if current_page?(requests_path) %>">
<%= link_to _('Browse by category'), requests_path %>
</li>
<% end %>
<% end %>

0 comments on commit 0114e9e

Please sign in to comment.