Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2022-10-27 00:15:19 +0300
committerSarah German <sgerman@gitlab.com>2022-10-27 00:15:19 +0300
commite858e8ab4e79e1c7dabf6cb701701dff9d964dc3 (patch)
treea479b06222dc0c1cc1b48e135b8071107fbbd75f /content/frontend
parentccbae814bb1140e932265e30c4bfea160106be59 (diff)
Do not render Versions menu on Archives page
Diffstat (limited to 'content/frontend')
-rw-r--r--content/frontend/default/components/versions_menu.vue12
-rw-r--r--content/frontend/default/environment.js2
2 files changed, 11 insertions, 3 deletions
diff --git a/content/frontend/default/components/versions_menu.vue b/content/frontend/default/components/versions_menu.vue
index f5862ec1..be9884f1 100644
--- a/content/frontend/default/components/versions_menu.vue
+++ b/content/frontend/default/components/versions_menu.vue
@@ -1,7 +1,7 @@
<script>
import { GlDropdown, GlDropdownItem, GlDropdownDivider } from '@gitlab/ui';
import { getVersions } from '../../services/fetch_versions';
-import { isGitLabHosted, isArchives } from '../environment';
+import { isGitLabHosted, isArchivesSite } from '../environment';
export default {
components: {
@@ -15,10 +15,17 @@ export default {
activeVersion: '',
};
},
+ computed: {
+ // Do not render this menu on pages that aren't version-specific.
+ showMenu() {
+ const excludePaths = ['/archives/'];
+ return !excludePaths.includes(window.location.pathname);
+ },
+ },
async created() {
// Only fetch version lists for the production site.
// Archives and self-hosted docs will only include one version, so they don't need this.
- if (isGitLabHosted() && !isArchives()) {
+ if (isGitLabHosted() && !isArchivesSite()) {
try {
this.versions = await getVersions();
} catch (err) {
@@ -49,6 +56,7 @@ export default {
<template>
<gl-dropdown
+ v-if="showMenu"
:text="activeVersion"
class="gl-mb-4 gl-md-mb-0 gl-md-mr-5 gl-md-ml-3 gl-display-flex"
data-testid="versions-menu"
diff --git a/content/frontend/default/environment.js b/content/frontend/default/environment.js
index 5f7665b7..8d530ded 100644
--- a/content/frontend/default/environment.js
+++ b/content/frontend/default/environment.js
@@ -25,6 +25,6 @@ export function isGitLabHosted() {
return GlHosts.some((e) => window.location.host.includes(e.host));
}
-export function isArchives() {
+export function isArchivesSite() {
return window.location.host === GlHosts.find((x) => x.environment === 'archives').host;
}