diff --git a/helpers/config_helper.rb b/helpers/config_helper.rb index 9977c461ab..892f68a074 100644 --- a/helpers/config_helper.rb +++ b/helpers/config_helper.rb @@ -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 diff --git a/source/partials/_commands_sidebar.haml b/source/partials/_commands_sidebar.haml index ef449a8bb4..2199520391 100644 --- a/source/partials/_commands_sidebar.haml +++ b/source/partials/_commands_sidebar.haml @@ -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" : ""}