Skip to content

Commit 56b6b2b

Browse files
authored
Fix tooltip of commit select button (#26472)
Previously, the tooltip for this button was only shown after opening and closing it once because it was only set after the server response, now it shows before opening it.
1 parent 7456573 commit 56b6b2b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

routers/web/repo/pull.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,6 @@ func GetPullCommits(ctx *context.Context) {
718718
// Get the needed locale
719719
resp.Locale = map[string]string{
720720
"lang": ctx.Locale.Language(),
721-
"filter_changes_by_commit": ctx.Tr("repo.pulls.filter_changes_by_commit"),
722721
"show_all_commits": ctx.Tr("repo.pulls.show_all_commits"),
723722
"stats_num_commits": ctx.TrN(len(commits), "repo.activity.git_stats_commit_1", "repo.activity.git_stats_commit_n", len(commits)),
724723
"show_changes_since_your_last_review": ctx.Tr("repo.pulls.show_changes_since_your_last_review"),

templates/repo/diff/box.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{{template "repo/diff/whitespace_dropdown" .}}
3333
{{template "repo/diff/options_dropdown" .}}
3434
{{if .PageIsPullFiles}}
35-
<div id="diff-commit-select" data-issuelink="{{$.Issue.Link}}" data-queryparams="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}">
35+
<div id="diff-commit-select" data-issuelink="{{$.Issue.Link}}" data-queryparams="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}" data-filter_changes_by_commit="{{.locale.Tr "repo.pulls.filter_changes_by_commit"}}">
3636
{{/*
3737
the following will be replaced by vue component
3838
but this avoids any loading artifacts till the vue component is initialized

web_src/js/components/DiffCommitSelector.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ import {SvgIcon} from '../svg.js';
7777
export default {
7878
components: {SvgIcon},
7979
data: () => {
80+
const el = document.getElementById('diff-commit-select');
8081
return {
8182
menuVisible: false,
8283
isLoading: false,
83-
locale: {},
84+
locale: {
85+
filter_changes_by_commit: el.getAttribute('data-filter_changes_by_commit'),
86+
},
8487
commits: [],
8588
hoverActivated: false,
8689
lastReviewCommitSha: null

0 commit comments

Comments
 (0)