diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2018-11-23 10:19:12 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2018-11-23 10:19:12 +0300 |
commit | 99165f7643878e00bff4dfd1a650e1102124e380 (patch) | |
tree | eba1a613d4e3623c27d42d673f4d29be05055084 /layouts/versions_dropdown.html | |
parent | ce4cab084771541fe2e5687017073ed93df9e6c9 (diff) |
Active class versions
Diffstat (limited to 'layouts/versions_dropdown.html')
-rw-r--r-- | layouts/versions_dropdown.html | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/layouts/versions_dropdown.html b/layouts/versions_dropdown.html index a811f11c..8de983d9 100644 --- a/layouts/versions_dropdown.html +++ b/layouts/versions_dropdown.html @@ -9,7 +9,7 @@ name in the dropdown menu. For local development and review apps, show "Versions". --> - <% if @item.identifier.to_s.split('/')[1] == 'archives' %> + <% if archives? %> Archives <% else %> <% if ENV['NANOC_ENV'] == 'production' %> @@ -21,26 +21,36 @@ <span class="caret"></span> </a> <ul class="dropdown-menu versions-menu" aria-labelledby="versions"> - <li> + <li<%= active_dropdown('master') %>> <a href='<%= @item.identifier.without_ext + '.html' %>' class="versions-tooltip">master <i class="fa fa-question-circle-o" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="The latest docs from GitLab's master branches, to which this site defaults."></i> </a> </li> <li role="separator" class="divider"></li> - <li> - <a href='/<%= @items['/_data/versions.yaml'][:online].first %><%= @item.identifier.without_ext + '.html' %>'> - <%= @items['/_data/versions.yaml'][:online].first %> - </a> - </li> - <% @items['/_data/versions.yaml'][:online].drop(1).each do |version| %> - <li> - <a href='/<%= version %><%= @item.identifier.without_ext + '.html' %>'> - <%= version %> - </a> - </li> + <% @items['/_data/versions.yaml'][:online].each do |version| %> + <!-- + If we are on the archives page, the link here is hardcoded to always + point to `/archives/`. If you visit https://docs.gitlab.com/archives/ + and select a version from the dropdown, that version's archives page + will be shown. We want to always show the latest archives page as it + contains all current versions and offline archives. + --> + <% if archives? %> + <li> + <a href='/archives/'> + <%= version %> + </a> + </li> + <% else %> + <li<%= active_dropdown(version) %>> + <a href='/<%= version %><%= @item.identifier.without_ext + '.html' %>'> + <%= version %> + </a> + </li> + <% end %> <% end %> <li role="separator" class="divider"></li> - <li><a href='/archives/'>Archives</a></li> + <li<%= active_dropdown('archives') %>><a href='/archives/'>Archives</a></li> </ul> </div> <!-- versions dropdown--> |