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.
This commit is contained in:
silverwind 2023-08-14 04:16:40 +02:00 committed by GitHub
parent 7456573541
commit 56b6b2b88e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

@ -718,7 +718,6 @@ func GetPullCommits(ctx *context.Context) {
// Get the needed locale // Get the needed locale
resp.Locale = map[string]string{ resp.Locale = map[string]string{
"lang": ctx.Locale.Language(), "lang": ctx.Locale.Language(),
"filter_changes_by_commit": ctx.Tr("repo.pulls.filter_changes_by_commit"),
"show_all_commits": ctx.Tr("repo.pulls.show_all_commits"), "show_all_commits": ctx.Tr("repo.pulls.show_all_commits"),
"stats_num_commits": ctx.TrN(len(commits), "repo.activity.git_stats_commit_1", "repo.activity.git_stats_commit_n", len(commits)), "stats_num_commits": ctx.TrN(len(commits), "repo.activity.git_stats_commit_1", "repo.activity.git_stats_commit_n", len(commits)),
"show_changes_since_your_last_review": ctx.Tr("repo.pulls.show_changes_since_your_last_review"), "show_changes_since_your_last_review": ctx.Tr("repo.pulls.show_changes_since_your_last_review"),

View file

@ -32,7 +32,7 @@
{{template "repo/diff/whitespace_dropdown" .}} {{template "repo/diff/whitespace_dropdown" .}}
{{template "repo/diff/options_dropdown" .}} {{template "repo/diff/options_dropdown" .}}
{{if .PageIsPullFiles}} {{if .PageIsPullFiles}}
<div id="diff-commit-select" data-issuelink="{{$.Issue.Link}}" data-queryparams="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}"> <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"}}">
{{/* {{/*
the following will be replaced by vue component the following will be replaced by vue component
but this avoids any loading artifacts till the vue component is initialized but this avoids any loading artifacts till the vue component is initialized

View file

@ -77,10 +77,13 @@ import {SvgIcon} from '../svg.js';
export default { export default {
components: {SvgIcon}, components: {SvgIcon},
data: () => { data: () => {
const el = document.getElementById('diff-commit-select');
return { return {
menuVisible: false, menuVisible: false,
isLoading: false, isLoading: false,
locale: {}, locale: {
filter_changes_by_commit: el.getAttribute('data-filter_changes_by_commit'),
},
commits: [], commits: [],
hoverActivated: false, hoverActivated: false,
lastReviewCommitSha: null lastReviewCommitSha: null