diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-28 09:09:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-28 09:09:06 +0000 |
commit | 7e8278c0f46cf6058efad5afd0aef177977bd663 (patch) | |
tree | 7ac46710921145bb782bcb208ea896e1548b168b /app/assets/javascripts/repository | |
parent | bbf6581214128ae12a6ff32f66a0d03ee57a2e91 (diff) | |
download | gitlab-ce-7e8278c0f46cf6058efad5afd0aef177977bd663.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/repository')
-rw-r--r-- | app/assets/javascripts/repository/utils/title.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/assets/javascripts/repository/utils/title.js b/app/assets/javascripts/repository/utils/title.js index ff16fbdd420..9c4b334a1ce 100644 --- a/app/assets/javascripts/repository/utils/title.js +++ b/app/assets/javascripts/repository/utils/title.js @@ -1,5 +1,5 @@ const DEFAULT_TITLE = '· GitLab'; -// eslint-disable-next-line import/prefer-default-export + export const setTitle = (pathMatch, ref, project) => { if (!pathMatch) { document.title = `${project} ${DEFAULT_TITLE}`; @@ -12,3 +12,15 @@ export const setTitle = (pathMatch, ref, project) => { /* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */ document.title = `${isEmpty ? 'Files' : path} · ${ref} · ${project} ${DEFAULT_TITLE}`; }; + +export function updateRefPortionOfTitle(sha, doc = document) { + const { title = '' } = doc; + const titleParts = title.split(' · '); + + if (titleParts.length > 1) { + titleParts[1] = sha; + + /* eslint-disable-next-line no-param-reassign */ + doc.title = titleParts.join(' · '); + } +} |