Skip to content

Commit 3e044d2

Browse files
authored
Use unique class for breadcrumb divider (#26524)
Fix regression from #25539: #26519 (comment). Before: <img width="429" alt="Screenshot 2023-08-15 at 15 46 12" src="https://github.com/go-gitea/gitea/assets/115237/a818f60a-77a2-48fe-8e6f-363d152ccb1e"> After: <img width="424" alt="Screenshot 2023-08-15 at 15 46 19" src="https://github.com/go-gitea/gitea/assets/115237/c90159e2-ced2-4a74-8a0f-a1b2b5d0b565"> <img width="605" alt="Screenshot 2023-08-15 at 15 56 11" src="https://github.com/go-gitea/gitea/assets/115237/3ded6f57-86f4-422a-86cb-56dd2c216dee">
1 parent bc930f3 commit 3e044d2

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

templates/repo/editor/cherry_pick.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{.locale.Tr "repo.editor.cherry_pick" $shalink | Str2html}}
1919
{{end}}
2020
<a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a>
21-
<div class="divider">:</div>
21+
<div class="breadcrumb-divider">:</div>
2222
<a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a>
2323
<span>{{.locale.Tr "repo.editor.or"}} <a href="{{$shaurl}}">{{.locale.Tr "repo.editor.cancel_lower"}}</a></span>
2424
</div>

templates/repo/editor/edit.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{{$n := len .TreeNames}}
1414
{{$l := Eval $n "-" 1}}
1515
{{range $i, $v := .TreeNames}}
16-
<div class="divider"> / </div>
16+
<div class="breadcrumb-divider">/</div>
1717
{{if eq $i $l}}
1818
<input id="file-name" value="{{$v}}" placeholder="{{$.locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus>
1919
<span data-tooltip-content="{{$.locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>

templates/repo/editor/patch.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}">
1212
{{.locale.Tr "repo.editor.patching"}}
1313
<a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a>
14-
<div class="divider">:</div>
14+
<div class="breadcrumb-divider">:</div>
1515
<a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a>
1616
<span>{{.locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}">{{.locale.Tr "repo.editor.cancel_lower"}}</a></span>
1717
<input type="hidden" id="tree_path" name="tree_path" value="" required>

templates/repo/editor/upload.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{$n := len .TreeNames}}
1212
{{$l := Eval $n "-" 1}}
1313
{{range $i, $v := .TreeNames}}
14-
<div class="divider"> / </div>
14+
<div class="breadcrumb-divider">/</div>
1515
{{if eq $i $l}}
1616
<input type="text" id="file-name" value="{{$v}}" placeholder="{{$.locale.Tr "repo.editor.add_subdir"}}" autofocus>
1717
<span data-tooltip-content="{{$.locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>

templates/repo/home.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<span class="breadcrumb repo-path gt-ml-2">
114114
<a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a>
115115
{{- range $i, $v := .TreeNames -}}
116-
<span class="divider">/</span>
116+
<span class="breadcrumb-divider">/</span>
117117
{{- if eq $i $l -}}
118118
<span class="active section" title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</span>
119119
{{- else -}}

web_src/css/modules/breadcrumb.css

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
.breadcrumb .divider {
1+
.breadcrumb {
2+
display: flex;
3+
flex-wrap: wrap;
4+
align-items: center;
5+
gap: 3px;
6+
}
7+
8+
.breadcrumb .breadcrumb-divider {
29
color: var(--color-text-light-2);
3-
margin-left: 3px;
4-
margin-right: 3px;
510
}
611

712
.breadcrumb > * {

web_src/js/features/repo-editor.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function initRepoEditor() {
114114
if (i < parts.length - 1) {
115115
if (value.length) {
116116
$(`<span class="section"><a href="#">${htmlEscape(value)}</a></span>`).insertBefore($(this));
117-
$('<div class="divider"> / </div>').insertBefore($(this));
117+
$('<div class="breadcrumb-divider">/</div>').insertBefore($(this));
118118
}
119119
} else {
120120
$(this).val(value);
@@ -132,7 +132,7 @@ export function initRepoEditor() {
132132
// Jump back to last directory once the filename is empty
133133
if (e.code === 'Backspace' && getCursorPosition($(this)) === 0 && $section.length > 0) {
134134
e.preventDefault();
135-
const $divider = $('.breadcrumb div.divider');
135+
const $divider = $('.breadcrumb .breadcrumb-divider');
136136
const value = $section.last().find('a').text();
137137
$(this).val(value + $(this).val());
138138
this.setSelectionRange(value.length, value.length);

0 commit comments

Comments
 (0)