Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use unique class for breadcrumb divider #26524

Merged
merged 5 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/repo/editor/cherry_pick.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{.locale.Tr "repo.editor.cherry_pick" $shalink | Str2html}}
{{end}}
<a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a>
<div class="divider">:</div>
<div class="breadcrumb-divider">:</div>
<a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a>
<span>{{.locale.Tr "repo.editor.or"}} <a href="{{$shaurl}}">{{.locale.Tr "repo.editor.cancel_lower"}}</a></span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/editor/edit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{$n := len .TreeNames}}
{{$l := Eval $n "-" 1}}
{{range $i, $v := .TreeNames}}
<div class="divider"> / </div>
<div class="breadcrumb-divider">/</div>
{{if eq $i $l}}
<input id="file-name" value="{{$v}}" placeholder="{{$.locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus>
<span data-tooltip-content="{{$.locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/editor/patch.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}">
{{.locale.Tr "repo.editor.patching"}}
<a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a>
<div class="divider">:</div>
<div class="breadcrumb-divider">:</div>
<a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a>
<span>{{.locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}">{{.locale.Tr "repo.editor.cancel_lower"}}</a></span>
<input type="hidden" id="tree_path" name="tree_path" value="" required>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/editor/upload.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{$n := len .TreeNames}}
{{$l := Eval $n "-" 1}}
{{range $i, $v := .TreeNames}}
<div class="divider"> / </div>
<div class="breadcrumb-divider">/</div>
{{if eq $i $l}}
<input type="text" id="file-name" value="{{$v}}" placeholder="{{$.locale.Tr "repo.editor.add_subdir"}}" autofocus>
<span data-tooltip-content="{{$.locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<span class="breadcrumb repo-path gt-ml-2">
<a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a>
{{- range $i, $v := .TreeNames -}}
<span class="divider">/</span>
<span class="breadcrumb-divider">/</span>
{{- if eq $i $l -}}
<span class="active section" title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</span>
{{- else -}}
Expand Down
11 changes: 8 additions & 3 deletions web_src/css/modules/breadcrumb.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
.breadcrumb .divider {
.breadcrumb {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 3px;
}

.breadcrumb .breadcrumb-divider {
color: var(--color-text-light-2);
margin-left: 3px;
margin-right: 3px;
}

.breadcrumb > * {
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/repo-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function initRepoEditor() {
if (i < parts.length - 1) {
if (value.length) {
$(`<span class="section"><a href="#">${htmlEscape(value)}</a></span>`).insertBefore($(this));
$('<div class="divider"> / </div>').insertBefore($(this));
$('<div class="breadcrumb-divider">/</div>').insertBefore($(this));
}
} else {
$(this).val(value);
Expand All @@ -132,7 +132,7 @@ export function initRepoEditor() {
// Jump back to last directory once the filename is empty
if (e.code === 'Backspace' && getCursorPosition($(this)) === 0 && $section.length > 0) {
e.preventDefault();
const $divider = $('.breadcrumb div.divider');
const $divider = $('.breadcrumb .breadcrumb-divider');
const value = $section.last().find('a').text();
$(this).val(value + $(this).val());
this.setSelectionRange(value.length, value.length);
Expand Down