summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-05-07 07:43:52 +0000
committerPhil Hughes <me@iamphill.com>2019-05-07 07:43:52 +0000
commit2f8154a4e57334292336bc726d215debe38caa8a (patch)
treeac3a69c128f7e493d6179cd7f9facce36ce886c3
parentbd73925b858cbb7229b3d335da0e5d0023f57caf (diff)
downloadgitlab-ce-2f8154a4e57334292336bc726d215debe38caa8a.tar.gz
Only renders Next badge for gitlab.com
-rw-r--r--app/assets/javascripts/main.js18
-rw-r--r--app/views/layouts/header/_default.html.haml5
-rw-r--r--changelogs/unreleased/61278-next.yml5
3 files changed, 23 insertions, 5 deletions
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index a2ca4b07a66..b503c746801 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -136,10 +136,22 @@ function deferredInitialisation() {
loadAwardsHandler();
- // Toggle Canary Badge
+ /**
+ * Toggle Canary Badge
+ *
+ * For GitLab.com only, when the user is using canary
+ * we render a Next badge and hide the option to switch
+ * to canay
+ */
if (Cookies.get('gitlab_canary') && Cookies.get('gitlab_canary') === 'true') {
- document.querySelector('.js-canary-badge').classList.remove('hidden');
- document.querySelector('.js-canary-link').classList.add('hidden');
+ const canaryBadge = document.querySelector('.js-canary-badge');
+ const canaryLink = document.querySelector('.js-canary-link');
+ if (canaryBadge) {
+ canaryBadge.classList.remove('hidden');
+ }
+ if (canaryLink) {
+ canaryLink.classList.add('hidden');
+ }
}
}
diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml
index 319d0307f78..724c9976954 100644
--- a/app/views/layouts/header/_default.html.haml
+++ b/app/views/layouts/header/_default.html.haml
@@ -17,8 +17,9 @@
- if logo_text.present?
%span.logo-text.d-none.d-lg-block.prepend-left-8
= logo_text
- %span.js-canary-badge.badge.badge-pill.green-badge.align-self-center
- = _('Next')
+ - if Gitlab.com?
+ %span.js-canary-badge.badge.badge-pill.green-badge.align-self-center
+ = _('Next')
- if current_user
= render "layouts/nav/dashboard"
diff --git a/changelogs/unreleased/61278-next.yml b/changelogs/unreleased/61278-next.yml
new file mode 100644
index 00000000000..829f37f75ba
--- /dev/null
+++ b/changelogs/unreleased/61278-next.yml
@@ -0,0 +1,5 @@
+---
+title: Render Next badge only for gitlab.com
+merge_request: 28056
+author:
+type: fixed