Commit aaa0fb72 authored by Phil Hughes's avatar Phil Hughes

Fixes repository Vue router hiding elements on root URL

parent fe090797
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
); );
}, },
showParentRow() { showParentRow() {
return !this.isLoadingFiles && this.path !== ''; return !this.isLoadingFiles && ['', '/'].indexOf(this.path) === -1;
}, },
}, },
watch: { watch: {
......
...@@ -17,6 +17,19 @@ export default function setupVueRepositoryList() { ...@@ -17,6 +17,19 @@ export default function setupVueRepositoryList() {
}); });
router.afterEach(({ params: { pathMatch } }) => setTitle(pathMatch, ref, fullName)); router.afterEach(({ params: { pathMatch } }) => setTitle(pathMatch, ref, fullName));
router.afterEach(to => {
const isRoot = to.params.pathMatch === undefined || to.params.pathMatch === '/';
if (!isRoot) {
document
.querySelectorAll('.js-keep-hidden-on-navigation')
.forEach(elem => elem.classList.add('hidden'));
}
document
.querySelectorAll('.js-hide-on-navigation')
.forEach(elem => elem.classList.toggle('hidden', !isRoot));
});
return new Vue({ return new Vue({
el, el,
......
...@@ -16,15 +16,8 @@ export default function createRouter(base, baseRef) { ...@@ -16,15 +16,8 @@ export default function createRouter(base, baseRef) {
name: 'treePath', name: 'treePath',
component: TreePage, component: TreePage,
props: route => ({ props: route => ({
path: route.params.pathMatch.replace(/^\//, ''), path: route.params.pathMatch && route.params.pathMatch.replace(/^\//, ''),
}), }),
beforeEnter(to, from, next) {
document
.querySelectorAll('.js-hide-on-navigation')
.forEach(el => el.classList.add('hidden'));
next();
},
}, },
{ {
path: '/', path: '/',
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
= render 'shared/commit_well', commit: commit, ref: ref, project: project = render 'shared/commit_well', commit: commit, ref: ref, project: project
- if is_project_overview - if is_project_overview
.project-buttons.append-bottom-default{ class: ("js-hide-on-navigation" if vue_file_list) } .project-buttons.append-bottom-default{ class: ("js-keep-hidden-on-navigation" if vue_file_list) }
= render 'stat_anchor_list', anchors: @project.statistics_buttons(show_auto_devops_callout: show_auto_devops_callout) = render 'stat_anchor_list', anchors: @project.statistics_buttons(show_auto_devops_callout: show_auto_devops_callout)
- if vue_file_list - if vue_file_list
......
- empty_repo = @project.empty_repo? - empty_repo = @project.empty_repo?
- show_auto_devops_callout = show_auto_devops_callout?(@project) - show_auto_devops_callout = show_auto_devops_callout?(@project)
- max_project_topic_length = 15 - max_project_topic_length = 15
.project-home-panel{ class: [("empty-project" if empty_repo), ("js-hide-on-navigation" if Feature.enabled?(:vue_file_list, @project))] } .project-home-panel{ class: [("empty-project" if empty_repo), ("js-keep-hidden-on-navigation" if Feature.enabled?(:vue_file_list, @project))] }
.row.append-bottom-8 .row.append-bottom-8
.home-panel-title-row.col-md-12.col-lg-6.d-flex .home-panel-title-row.col-md-12.col-lg-6.d-flex
.avatar-container.rect-avatar.s64.home-panel-avatar.append-right-default.float-none .avatar-container.rect-avatar.s64.home-panel-avatar.append-right-default.float-none
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment