Skip to content

Commit e460b6e

Browse files
gempirzeripathlunny
authored
Fix PR file tree folders no longer collapsing (#22864)
Collapsing folders currently just throws a console error ``` index.js?v=1.19.0~dev-403-gb6b8feb3d:10 TypeError: this.$set is not a function at Proxy.handleClick (index.js?v=1.19.0~dev-403-gb6b8feb3d:58:7159) at index.js?v=1.19.0~dev-403-gb6b8feb3d:58:6466 at index.js?v=1.19.0~dev-403-gb6b8feb3d:10:93922 at ce (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:1472) at Q (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:1567) at HTMLDivElement.$e (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:79198) ``` This PR fixes this and allows folders to be collapsed again. Also: - better cursor interaction with folders - added some color to the diff detail stats - remove green link color from all the file names Screenshots: ![image](https://user-images.githubusercontent.com/9765622/218269712-2f3dda55-6d70-407f-8d34-2a5d9c8df548.png) ![image](https://user-images.githubusercontent.com/9765622/218269714-6ce8a954-daea-4ed6-9eea-8b2323db4d8f.png) --------- Co-authored-by: zeripath <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 51ab495 commit e460b6e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

web_src/js/components/DiffFileTreeItem.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/>
1111
<a
1212
v-if="item.isFile"
13-
class="file ellipsis"
13+
class="file ellipsis muted"
1414
:href="item.isFile ? '#diff-' + item.file.NameHash : ''"
1515
>{{ item.name }}</a>
1616
<SvgIcon
@@ -63,7 +63,7 @@ export default {
6363
if (itemIsFile) {
6464
return;
6565
}
66-
this.$set(this, 'collapsed', !this.collapsed);
66+
this.collapsed = !this.collapsed;
6767
},
6868
getIconForDiffType(pType) {
6969
const diffTypes = {
@@ -83,6 +83,7 @@ export default {
8383
span.svg-icon.status {
8484
float: right;
8585
}
86+
8687
span.svg-icon.file {
8788
color: var(--color-secondary-dark-7);
8889
}
@@ -122,6 +123,8 @@ span.svg-icon.octicon-diff-renamed {
122123
div.directory {
123124
display: grid;
124125
grid-template-columns: 18px 20px auto;
126+
user-select: none;
127+
cursor: pointer;
125128
}
126129
127130
div.directory:hover {

web_src/less/_repository.less

+14
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,20 @@
16141614
margin-right: .25rem;
16151615
}
16161616

1617+
// Because the translations contain the <strong> we need to style with nth-of-type
1618+
1619+
.diff-detail-stats strong:nth-of-type(1) {
1620+
color: var(--color-yellow);
1621+
}
1622+
1623+
.diff-detail-stats strong:nth-of-type(2) {
1624+
color: var(--color-green);
1625+
}
1626+
1627+
.diff-detail-stats strong:nth-of-type(3) {
1628+
color: var(--color-red);
1629+
}
1630+
16171631
.diff-detail-stats {
16181632
@media (max-width: 480px) {
16191633
font-size: 0;

0 commit comments

Comments
 (0)