0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-21 12:24:38 +02:00
This commit is contained in:
Kerwin Bryant 2025-01-06 06:59:04 +00:00
parent 647cd304a0
commit 91f972ce82
3 changed files with 16 additions and 5 deletions

View File

@ -24,7 +24,7 @@
<div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" (Iif $showTreeSidebar "repo-grid-tree-sidebar" "repo-grid-filelist-only")}}"> <div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" (Iif $showTreeSidebar "repo-grid-tree-sidebar" "repo-grid-filelist-only")}}">
{{if $hasTreeSidebar}} {{if $hasTreeSidebar}}
<div class="repo-view-file-tree-sidebar not-mobile {{if $hideTreeSidebar}}tw-hidden{{end}}">{{template "repo/view_file_tree_sidebar" .}}</div> <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>
{{end}} {{end}}
<div class="repo-home-filelist"> <div class="repo-home-filelist">

View File

@ -70,6 +70,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.25em; gap: 0.25em;
max-height: 100vh;
overflow: hidden;
} }
.repo-grid-tree-sidebar .view-file-tree-sidebar-top { .repo-grid-tree-sidebar .view-file-tree-sidebar-top {
@ -90,6 +92,11 @@
gap: 0.25em; gap: 0.25em;
} }
.repo-grid-tree-sidebar .view-file-tree-sidebar-bottom {
flex: 1;
overflow: auto;
}
@media (max-width: 767.98px) { @media (max-width: 767.98px) {
.repo-grid-tree-sidebar { .repo-grid-tree-sidebar {
grid-template-columns: auto; grid-template-columns: auto;

View File

@ -5,7 +5,7 @@ import ViewFileTree from '../components/ViewFileTree.vue';
import RepoBranchTagSelector from '../components/RepoBranchTagSelector.vue'; import RepoBranchTagSelector from '../components/RepoBranchTagSelector.vue';
import {initGlobalDropdown} from './common-page.ts'; import {initGlobalDropdown} from './common-page.ts';
async function toggleSidebar(visibility) { async function toggleSidebar(visibility, isSigned) {
const sidebarEl = document.querySelector('.repo-view-file-tree-sidebar'); const sidebarEl = document.querySelector('.repo-view-file-tree-sidebar');
const showBtnEl = document.querySelector('.show-tree-sidebar-button'); const showBtnEl = document.querySelector('.show-tree-sidebar-button');
const containerClassList = sidebarEl.parentElement.classList; const containerClassList = sidebarEl.parentElement.classList;
@ -14,6 +14,8 @@ async function toggleSidebar(visibility) {
toggleElem(sidebarEl, visibility); toggleElem(sidebarEl, visibility);
toggleElem(showBtnEl, !visibility); toggleElem(showBtnEl, !visibility);
if (!isSigned) return;
// save to session // save to session
await PUT('/repo/preferences', { await PUT('/repo/preferences', {
data: { data: {
@ -49,7 +51,7 @@ async function loadContent() {
function reloadContentScript() { function reloadContentScript() {
document.querySelector('.repo-home-filelist .show-tree-sidebar-button').addEventListener('click', () => { document.querySelector('.repo-home-filelist .show-tree-sidebar-button').addEventListener('click', () => {
toggleSidebar(true); toggleSidebar(true, document.querySelector('.repo-view-file-tree-sidebar').hasAttribute('data-is-signed'));
}); });
const refSelectorEl = document.querySelector('.repo-home-filelist .js-branch-tag-selector'); const refSelectorEl = document.querySelector('.repo-home-filelist .js-branch-tag-selector');
if (refSelectorEl) { if (refSelectorEl) {
@ -62,11 +64,13 @@ export async function initViewFileTreeSidebar() {
const sidebarElement = document.querySelector('.repo-view-file-tree-sidebar'); const sidebarElement = document.querySelector('.repo-view-file-tree-sidebar');
if (!sidebarElement) return; if (!sidebarElement) return;
const isSigned = sidebarElement.hasAttribute('data-is-signed');
document.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => { document.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
toggleSidebar(false); toggleSidebar(false, isSigned);
}); });
document.querySelector('.repo-home-filelist .show-tree-sidebar-button').addEventListener('click', () => { document.querySelector('.repo-home-filelist .show-tree-sidebar-button').addEventListener('click', () => {
toggleSidebar(true); toggleSidebar(true, isSigned);
}); });
const fileTree = document.querySelector('#view-file-tree'); const fileTree = document.querySelector('#view-file-tree');