debian-mirror-gitlab/app/assets/javascripts/repository/utils/title.js

11 lines
359 B
JavaScript
Raw Normal View History

2019-09-04 21:01:54 +05:30
// eslint-disable-next-line import/prefer-default-export
export const setTitle = (pathMatch, ref, project) => {
if (!pathMatch) return;
const path = pathMatch.replace(/^\//, '');
const isEmpty = path === '';
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
document.title = `${isEmpty ? 'Files' : path} · ${ref} · ${project}`;
};