diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-09 18:09:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-09 18:09:47 +0300 |
commit | ffd8742a62c5de81792942cd7f9031b1add6cab2 (patch) | |
tree | af7c8181baf971b55064a42eecc7a8da57878456 /app/assets/javascripts/search_autocomplete_utils.js | |
parent | a373ecffca1512404cb4f237399e3bf275d87f69 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/search_autocomplete_utils.js')
-rw-r--r-- | app/assets/javascripts/search_autocomplete_utils.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/assets/javascripts/search_autocomplete_utils.js b/app/assets/javascripts/search_autocomplete_utils.js new file mode 100644 index 00000000000..a9a0f941e93 --- /dev/null +++ b/app/assets/javascripts/search_autocomplete_utils.js @@ -0,0 +1,19 @@ +import { getPagePath } from './lib/utils/common_utils'; + +export const isInGroupsPage = () => getPagePath() === 'groups'; + +export const isInProjectPage = () => getPagePath() === 'projects'; + +export const getProjectSlug = () => { + if (isInProjectPage()) { + return document?.body?.dataset?.project; + } + return null; +}; + +export const getGroupSlug = () => { + if (isInProjectPage() || isInGroupsPage()) { + return document?.body?.dataset?.group; + } + return null; +}; |