mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-20 11:43:57 +08:00
fix
This commit is contained in:
parent
647cd304a0
commit
91f972ce82
@ -24,7 +24,7 @@
|
||||
|
||||
<div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" (Iif $showTreeSidebar "repo-grid-tree-sidebar" "repo-grid-filelist-only")}}">
|
||||
{{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}}
|
||||
|
||||
<div class="repo-home-filelist">
|
||||
|
@ -70,6 +70,8 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25em;
|
||||
max-height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.repo-grid-tree-sidebar .view-file-tree-sidebar-top {
|
||||
@ -90,6 +92,11 @@
|
||||
gap: 0.25em;
|
||||
}
|
||||
|
||||
.repo-grid-tree-sidebar .view-file-tree-sidebar-bottom {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
.repo-grid-tree-sidebar {
|
||||
grid-template-columns: auto;
|
||||
|
@ -5,7 +5,7 @@ import ViewFileTree from '../components/ViewFileTree.vue';
|
||||
import RepoBranchTagSelector from '../components/RepoBranchTagSelector.vue';
|
||||
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 showBtnEl = document.querySelector('.show-tree-sidebar-button');
|
||||
const containerClassList = sidebarEl.parentElement.classList;
|
||||
@ -14,6 +14,8 @@ async function toggleSidebar(visibility) {
|
||||
toggleElem(sidebarEl, visibility);
|
||||
toggleElem(showBtnEl, !visibility);
|
||||
|
||||
if (!isSigned) return;
|
||||
|
||||
// save to session
|
||||
await PUT('/repo/preferences', {
|
||||
data: {
|
||||
@ -49,7 +51,7 @@ async function loadContent() {
|
||||
|
||||
function reloadContentScript() {
|
||||
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');
|
||||
if (refSelectorEl) {
|
||||
@ -62,11 +64,13 @@ export async function initViewFileTreeSidebar() {
|
||||
const sidebarElement = document.querySelector('.repo-view-file-tree-sidebar');
|
||||
if (!sidebarElement) return;
|
||||
|
||||
const isSigned = sidebarElement.hasAttribute('data-is-signed');
|
||||
|
||||
document.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
|
||||
toggleSidebar(false);
|
||||
toggleSidebar(false, isSigned);
|
||||
});
|
||||
document.querySelector('.repo-home-filelist .show-tree-sidebar-button').addEventListener('click', () => {
|
||||
toggleSidebar(true);
|
||||
toggleSidebar(true, isSigned);
|
||||
});
|
||||
|
||||
const fileTree = document.querySelector('#view-file-tree');
|
||||
|
Loading…
x
Reference in New Issue
Block a user