Skip to content

Commit

Permalink
show collapse/Expand Btns only in fileTree view
Browse files Browse the repository at this point in the history
  • Loading branch information
LariWa authored and Hans Unzner committed Jun 10, 2022
1 parent 0d87007 commit 86a0388
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion web/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2637,7 +2637,7 @@ class GitGraphView {
}
html += '</div><div id="cdvControls"><div id="cdvClose" class="cdvControlBtn" title="Close">' + SVG_ICONS.close + '</div>' +
(codeReviewPossible ? '<div id="cdvCodeReview" class="cdvControlBtn">' + SVG_ICONS.review + '</div>' : '') +
(!expandedCommit.loading ? '<div id="cdvFileViewTypeTree" class="cdvControlBtn cdvFileViewTypeBtn" title="File Tree View">' + SVG_ICONS.fileTree + '</div><div id="cdvFileViewTypeList" class="cdvControlBtn cdvFileViewTypeBtn" title="File List View">' + SVG_ICONS.fileList + '</div><div id="cdvCollapse" class="cdvControlBtn" title="Collapse/Expand Folders">' + SVG_ICONS.collapseAll + '</div><div id="cdvExpand" class="cdvControlBtn" title="Expand Folders">' + SVG_ICONS.expandAll + '</div>' : '') +
(!expandedCommit.loading ? '<div id="cdvFileViewTypeList" class="cdvControlBtn cdvFileViewTypeBtn" title="File List View">' + SVG_ICONS.fileList + '</div><div id="cdvFileViewTypeTree" class="cdvControlBtn cdvFileViewTypeBtn" title="File Tree View">' + SVG_ICONS.fileTree + '</div><div id="cdvCollapse" class="cdvControlBtn cdvFolderBtn" title="Collapse/Expand Folders">' + SVG_ICONS.collapseAll + '</div><div id="cdvExpand" class="cdvControlBtn cdvFolderBtn" title="Expand Folders">' + SVG_ICONS.expandAll + '</div>' : '') +
(externalDiffPossible ? '<div id="cdvExternalDiff" class="cdvControlBtn">' + SVG_ICONS.linkExternal + '</div>' : '') +
'</div><div class="cdvHeightResize"></div>';

Expand Down Expand Up @@ -3200,6 +3200,16 @@ class GitGraphView {
let listView = this.getFileViewType() === GG.FileViewType.List;
alterClass(treeBtnElem, CLASS_ACTIVE, !listView);
alterClass(listBtnElem, CLASS_ACTIVE, listView);
setFolderBtns();
function setFolderBtns() {
let btns = document.getElementsByClassName('cdvFolderBtn');
for (let i = 0; i < btns.length; i++) {
if(listView)
btns[i].classList.add('hidden');
else
btns[i].classList.remove('hidden');
}
}
}

private renderCdvExternalDiffBtn() {
Expand Down
3 changes: 3 additions & 0 deletions web/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ table { border-collapse: collapse; }
.cdvControlBtn.active:hover{
background-color:rgba(128,128,128,0.35);
}
.cdvFolderBtn.hidden{
display:none;
}

#cdvCodeReview{
border-radius:4px;
Expand Down

0 comments on commit 86a0388

Please sign in to comment.