Skip to content

Commit

Permalink
Only show version selector if there's more than one version
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jan 23, 2025
1 parent bb5791b commit 79262cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions helpers/config_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def versions
config[:versions]
end

def versions_grouped_by_status
versions.select {|version| documentation_path(current_page_without_version, version) }.reverse.group_by { status(_1) }
def versions_with_documentation_page
versions.select {|version| documentation_path(current_page_without_version, version) }
end

private
Expand Down
19 changes: 10 additions & 9 deletions source/partials/_commands_sidebar.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
- primary_commands = %w(bundle-install.1 bundle-update.1 bundle-cache.1 bundle-exec.1 bundle-config.1 bundle-help.1)

%h4 Choose version
%select.version-selects.form-select.mb-3
- versions_grouped_by_status.each do |status, _versions|
%optgroup{label: status}
- _versions.each do |version|
- selected = version == current_visible_version
- value = documentation_path(current_page_without_version, version)
%option{selected: selected, value: value}
= version
- if versions_with_documentation_page.size > 1
%h4 Choose version
%select.version-selects.form-select.mb-3
- versions_with_documentation_page.reverse.group_by { status(_1) }.each do |status, _versions|
%optgroup{label: status}
- _versions.each do |version|
- selected = version == current_visible_version
- value = documentation_path(current_page_without_version, version)
%option{selected: selected, value: value}
= version
%h4 General
%ul
%li{class: current_page.url.end_with?("whats_new.html") ? "active" : ""}
Expand Down

0 comments on commit 79262cf

Please sign in to comment.