Skip to content

Commit

Permalink
Append maintenance status per version
Browse files Browse the repository at this point in the history
Signed-off-by: Takuya Noguchi <[email protected]>
  • Loading branch information
tnir committed Jul 27, 2022
1 parent b2722f8 commit cc9a40d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
18 changes: 17 additions & 1 deletion helpers/config_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,20 @@ def current_version
def versions
config[:versions]
end
end

def versions_grouped_by_status
versions.reverse.group_by { status(_1) }
end

private

def status(version)
if version == "v2.3"
"Current release"
elsif %w[v2.2 v2.1].include?(version)
"Legacy release"
else
"Deprecated release"
end
end
end
10 changes: 6 additions & 4 deletions source/partials/_commands_sidebar.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

%h4 Choose version
%select.version-selects.form-select.mb-3
- versions.reverse.each do |version|
%option{selected: version == current_visible_version,
value: documentation_path(current_page_without_version, version) || documentation_path('bundle-install.1', version)}
= version
- versions_grouped_by_status.each do |status, _versions|
%optgroup{label: status}
- _versions.each do |version|
%option{selected: version == current_visible_version,
value: documentation_path(current_page_without_version, version) || documentation_path('bundle-install.1', version)}
= version
%h4 Primary Commands
%ul
- primary_commands.select{ |page| path_exist?(page, current_visible_version) }.each do |page|
Expand Down

0 comments on commit cc9a40d

Please sign in to comment.