Skip to content

Commit 91f972c

Browse files
committed
fix
1 parent 647cd30 commit 91f972c

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

templates/repo/home.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" (Iif $showTreeSidebar "repo-grid-tree-sidebar" "repo-grid-filelist-only")}}">
2626
{{if $hasTreeSidebar}}
27-
<div class="repo-view-file-tree-sidebar not-mobile {{if $hideTreeSidebar}}tw-hidden{{end}}">{{template "repo/view_file_tree_sidebar" .}}</div>
27+
<div class="repo-view-file-tree-sidebar not-mobile {{if $hideTreeSidebar}}tw-hidden{{end}}" {{if .IsSigned}} data-is-signed {{end}}>{{template "repo/view_file_tree_sidebar" .}}</div>
2828
{{end}}
2929

3030
<div class="repo-home-filelist">

web_src/css/repo/home.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
display: flex;
7171
flex-direction: column;
7272
gap: 0.25em;
73+
max-height: 100vh;
74+
overflow: hidden;
7375
}
7476

7577
.repo-grid-tree-sidebar .view-file-tree-sidebar-top {
@@ -90,6 +92,11 @@
9092
gap: 0.25em;
9193
}
9294

95+
.repo-grid-tree-sidebar .view-file-tree-sidebar-bottom {
96+
flex: 1;
97+
overflow: auto;
98+
}
99+
93100
@media (max-width: 767.98px) {
94101
.repo-grid-tree-sidebar {
95102
grid-template-columns: auto;

web_src/js/features/repo-view-file-tree-sidebar.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ViewFileTree from '../components/ViewFileTree.vue';
55
import RepoBranchTagSelector from '../components/RepoBranchTagSelector.vue';
66
import {initGlobalDropdown} from './common-page.ts';
77

8-
async function toggleSidebar(visibility) {
8+
async function toggleSidebar(visibility, isSigned) {
99
const sidebarEl = document.querySelector('.repo-view-file-tree-sidebar');
1010
const showBtnEl = document.querySelector('.show-tree-sidebar-button');
1111
const containerClassList = sidebarEl.parentElement.classList;
@@ -14,6 +14,8 @@ async function toggleSidebar(visibility) {
1414
toggleElem(sidebarEl, visibility);
1515
toggleElem(showBtnEl, !visibility);
1616

17+
if (!isSigned) return;
18+
1719
// save to session
1820
await PUT('/repo/preferences', {
1921
data: {
@@ -49,7 +51,7 @@ async function loadContent() {
4951

5052
function reloadContentScript() {
5153
document.querySelector('.repo-home-filelist .show-tree-sidebar-button').addEventListener('click', () => {
52-
toggleSidebar(true);
54+
toggleSidebar(true, document.querySelector('.repo-view-file-tree-sidebar').hasAttribute('data-is-signed'));
5355
});
5456
const refSelectorEl = document.querySelector('.repo-home-filelist .js-branch-tag-selector');
5557
if (refSelectorEl) {
@@ -62,11 +64,13 @@ export async function initViewFileTreeSidebar() {
6264
const sidebarElement = document.querySelector('.repo-view-file-tree-sidebar');
6365
if (!sidebarElement) return;
6466

67+
const isSigned = sidebarElement.hasAttribute('data-is-signed');
68+
6569
document.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
66-
toggleSidebar(false);
70+
toggleSidebar(false, isSigned);
6771
});
6872
document.querySelector('.repo-home-filelist .show-tree-sidebar-button').addEventListener('click', () => {
69-
toggleSidebar(true);
73+
toggleSidebar(true, isSigned);
7074
});
7175

7276
const fileTree = document.querySelector('#view-file-tree');

0 commit comments

Comments
 (0)