{{template "repo/header" .}}
- {{$class := ""}} - {{if .Commit.Signature}} - {{$class = (print $class " isSigned")}} - {{if .Verification.Verified}} - {{if eq .Verification.TrustStatus "trusted"}} - {{$class = (print $class " isVerified")}} - {{else if eq .Verification.TrustStatus "untrusted"}} - {{$class = (print $class " isVerifiedUntrusted")}} - {{else}} - {{$class = (print $class " isVerifiedUnmatched")}} - {{end}} - {{else if .Verification.Warning}} - {{$class = (print $class " isWarning")}} - {{end}} - {{end}} -
+

{{RenderCommitMessage $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}

{{if not $.PageIsWiki}} @@ -139,7 +124,7 @@ {{end}} {{template "repo/commit_load_branches_and_tags" .}}
-
+
{{if .Author}} {{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}} @@ -163,6 +148,7 @@ {{.Commit.Committer.Name}} {{end}} {{end}} + {{template "shared/verifyicon" .}}
{{if .Parents}} @@ -183,81 +169,6 @@
- {{if .Commit.Signature}} -
-
- {{if .Verification.Verified}} - {{if ne .Verification.SigningUser.ID 0}} - {{svg "gitea-lock" 16 "tw-mr-2"}} - {{if eq .Verification.TrustStatus "trusted"}} - {{ctx.Locale.Tr "repo.commits.signed_by"}}: - {{else if eq .Verification.TrustStatus "untrusted"}} - {{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}: - {{else}} - {{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: - {{end}} - {{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}} - {{.Verification.SigningUser.GetDisplayName}} - {{else}} - {{svg "gitea-lock-cog" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.commits.signed_by"}}: - {{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}} - {{.Verification.SigningUser.GetDisplayName}} - {{end}} - {{else}} - {{svg "gitea-unlock" 16 "tw-mr-2"}} - {{ctx.Locale.Tr .Verification.Reason}} - {{end}} -
-
- {{if .Verification.Verified}} - {{if ne .Verification.SigningUser.ID 0}} - {{svg "octicon-verified" 16 "tw-mr-2"}} - {{if .Verification.SigningSSHKey}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{else}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{else}} - {{svg "octicon-unverified" 16 "tw-mr-2"}} - {{if .Verification.SigningSSHKey}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{else}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{end}} - {{else if .Verification.Warning}} - {{svg "octicon-unverified" 16 "tw-mr-2"}} - {{if .Verification.SigningSSHKey}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{else}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{else}} - {{if .Verification.SigningKey}} - {{if ne .Verification.SigningKey.KeyID ""}} - {{svg "octicon-verified" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{end}} - {{if .Verification.SigningSSHKey}} - {{if ne .Verification.SigningSSHKey.Fingerprint ""}} - {{svg "octicon-verified" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{end}} - {{end}} - {{end}} -
-
- {{end}} {{if .NoteRendered}}
{{svg "octicon-note" 16 "tw-mr-2"}} diff --git a/templates/repo/pulls/status.tmpl b/templates/repo/pulls/status.tmpl index e8636ba1b81ba..e6481f0c22880 100644 --- a/templates/repo/pulls/status.tmpl +++ b/templates/repo/pulls/status.tmpl @@ -9,7 +9,7 @@ Template Attributes: {{if .CommitStatus}}
-
+
{{if or (eq .CommitStatus.State "pending") (.MissingRequiredChecks)}} {{ctx.Locale.Tr "repo.pulls.status_checking"}} {{else if eq .CommitStatus.State "success"}} diff --git a/templates/shared/verifyicon.tmpl b/templates/shared/verifyicon.tmpl new file mode 100644 index 0000000000000..23ca1387b9c0d --- /dev/null +++ b/templates/shared/verifyicon.tmpl @@ -0,0 +1,114 @@ +{{/* +Template Attributes: +* Commit: Commit object +* Verification: Verification struct +*/}} +{{if (and .Commit .Commit.Signature .Verification)}} + {{$icon := "octicon-unverified"}} + {{$text := ""}} + {{$colorClass := ""}} + {{if .Verification.Verified}} + {{if eq .Verification.TrustStatus "trusted"}} + {{$icon = "octicon-verified"}} + {{$colorClass = "tw-text-green"}} + {{$text = (ctx.Locale.Tr "sig_verified")}} + {{else if eq .Verification.TrustStatus "untrusted"}} + {{$colorClass = "tw-text-orange"}} + {{$text = (ctx.Locale.Tr "repo.commits.signed_by_untrusted_user")}} + {{else}} + {{$colorClass = "tw-text-orange"}} + {{$text = (ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched")}} + {{end}} + {{else}} + {{if .Verification.Warning}} + {{$colorClass = "tw-text-red"}} + {{else}} + {{$colorClass = "tw-text-inherit"}} + {{end}} + {{if .Verification.Reason}} + {{$text = (ctx.Locale.Tr .Verification.Reason)}} + {{else}} + {{$text = (ctx.Locale.Tr "sig_failed")}} + {{end}} + {{end}} + +
+
+
{{svg $icon 16 (printf "%s tw-mr-2" $colorClass)}}{{$text}}
+
+ {{if .Verification.Verified}} +
+ {{if ne .Verification.SigningUser.ID 0}} + {{if eq .Verification.TrustStatus "trusted"}} + {{ctx.Locale.Tr "repo.commits.signed_by"}}: + {{else if eq .Verification.TrustStatus "untrusted"}} + {{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}: + {{else}} + {{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: + {{end}} + {{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}} + {{.Verification.SigningUser.GetDisplayName}} + {{else}} + + {{svg "gitea-lock-cog" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.commits.signed_by"}}: + {{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}} + {{.Verification.SigningUser.GetDisplayName}} + {{end}} +
+ {{end}} +
+ {{if .Verification.Verified}} + {{if ne .Verification.SigningUser.ID 0}} + {{if .Verification.SigningSSHKey}} + {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: + {{.Verification.SigningSSHKey.Fingerprint}} + {{else}} + {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{else}} + {{if .Verification.SigningSSHKey}} + {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: + {{.Verification.SigningSSHKey.Fingerprint}} + {{else}} + {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{end}} + {{else if .Verification.Warning}} + {{if .Verification.SigningSSHKey}} + {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: + {{.Verification.SigningSSHKey.Fingerprint}} + {{else}} + {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{else}} + {{if .Verification.SigningKey}} + {{if ne .Verification.SigningKey.KeyID ""}} + {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{end}} + {{if .Verification.SigningSSHKey}} + {{if ne .Verification.SigningSSHKey.Fingerprint ""}} + {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: + {{.Verification.SigningSSHKey.Fingerprint}} + {{end}} + {{end}} + {{end}} +
+
+
+
+{{end}} diff --git a/web_src/css/modules/tippy.css b/web_src/css/modules/tippy.css index 76d36b42930f3..2c2f86b587c19 100644 --- a/web_src/css/modules/tippy.css +++ b/web_src/css/modules/tippy.css @@ -83,6 +83,7 @@ .tippy-box[data-theme="box-with-header"] { box-shadow: 0 6px 18px var(--color-shadow); + color: var(--color-text); } .tippy-box[data-theme="box-with-header"] .tippy-content { @@ -99,6 +100,15 @@ fill: var(--color-box-header); } +.tippy-box[data-theme="box-with-header"] .ui.top.attached.header { + /* reset the default ".ui.attached.header" styles, to use the outer border */ + border: none !important; + /* add a bottom border to make sure the there is always a divider between the header and list when the list is scrolling */ + border-bottom: 1px solid var(--color-secondary) !important; + /* use negative margin to avoid the newly added border conflict with the list's top border */ + margin: 0 0 -1px !important; +} + .tippy-box[data-placement^="top"] > .tippy-svg-arrow { bottom: 0; } diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 705d652b54e4a..c30c23ae9d8bd 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -1789,92 +1789,6 @@ padding-top: 0; } -.repository .ui.attached.isSigned.isWarning { - border-left: 1px solid var(--color-error-border); - border-right: 1px solid var(--color-error-border); -} - -.repository .ui.attached.isSigned.isWarning.top, -.repository .ui.attached.isSigned.isWarning.message { - border-top: 1px solid var(--color-error-border); -} - -.repository .ui.attached.isSigned.isWarning.message { - box-shadow: none; - background-color: var(--color-error-bg); - color: var(--color-error-text); -} - -.repository .ui.attached.isSigned.isWarning.message .ui.text { - color: var(--color-error-text); -} - -.repository .ui.attached.isSigned.isWarning:last-child, -.repository .ui.attached.isSigned.isWarning.bottom { - border-bottom: 1px solid var(--color-error-border); -} - -.repository .ui.attached.isSigned.isVerified { - border-left: 1px solid var(--color-success-border); - border-right: 1px solid var(--color-success-border); -} - -.repository .ui.attached.isSigned.isVerified.top, -.repository .ui.attached.isSigned.isVerified.message { - border-top: 1px solid var(--color-success-border); -} - -.repository .ui.attached.isSigned.isVerified.message { - box-shadow: none; - background-color: var(--color-success-bg); - color: var(--color-success-text); -} - -.repository .ui.attached.isSigned.isVerified.message .pull-right { - color: var(--color-text); -} - -.repository .ui.attached.isSigned.isVerified.message .ui.text { - color: var(--color-success-text); -} - -.repository .ui.attached.isSigned.isVerified:last-child, -.repository .ui.attached.isSigned.isVerified.bottom { - border-bottom: 1px solid var(--color-success-border); -} - -.repository .ui.attached.isSigned.isVerifiedUntrusted, -.repository .ui.attached.isSigned.isVerifiedUnmatched { - border-left: 1px solid var(--color-warning-border); - border-right: 1px solid var(--color-warning-border); -} - -.repository .ui.attached.isSigned.isVerifiedUntrusted.top, -.repository .ui.attached.isSigned.isVerifiedUnmatched.top, -.repository .ui.attached.isSigned.isVerifiedUntrusted.message, -.repository .ui.attached.isSigned.isVerifiedUnmatched.message { - border-top: 1px solid var(--color-warning-border); -} - -.repository .ui.attached.isSigned.isVerifiedUntrusted.message, -.repository .ui.attached.isSigned.isVerifiedUnmatched.message { - box-shadow: none; - background-color: var(--color-warning-bg); - color: var(--color-warning-text); -} - -.repository .ui.attached.isSigned.isVerifiedUntrusted.message .ui.text, -.repository .ui.attached.isSigned.isVerifiedUnmatched.message .ui.text { - color: var(--color-warning-text); -} - -.repository .ui.attached.isSigned.isVerifiedUntrusted:last-child, -.repository .ui.attached.isSigned.isVerifiedUnmatched:last-child, -.repository .ui.attached.isSigned.isVerifiedUntrusted.bottom, -.repository .ui.attached.isSigned.isVerifiedUnmatched.bottom { - border-bottom: 1px solid var(--color-warning-border); -} - .repository .segment.reactions.dropdown .menu, .repository .select-reaction.dropdown .menu { right: 0 !important; @@ -2815,15 +2729,6 @@ tbody.commit-list { } } -.commit-status-header { - /* reset the default ".ui.attached.header" styles, to use the outer border */ - border: none !important; - /* add a bottom border to make sure the there is always a divider between the header and list when the list is scrolling */ - border-bottom: 1px solid var(--color-secondary) !important; - /* use negative margin to avoid the newly added border conflict with the list's top border */ - margin: 0 0 -1px !important; -} - .commit-status-list { max-height: 240px; /* fit exactly 6 items, commit-status-item.height * 6 */ overflow-x: hidden; diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js index 220c9e551213d..d40e193db17cf 100644 --- a/web_src/js/modules/tippy.js +++ b/web_src/js/modules/tippy.js @@ -172,6 +172,26 @@ export function initGlobalTooltips() { observerConnect(observer); attachChildrenLazyTooltip(document.documentElement); + attachTippyTriggers(); +} + +// generic tippy creation via sibling elements: +// +//
+function attachTippyTriggers() { + for (const el of document.getElementsByClassName('tippy-trigger')) { + const nextSibling = el.nextElementSibling; + if (nextSibling?.matches('.tippy-target')) { + createTippy(el, { + trigger: el.getAttribute('data-tippy-trigger'), + role: el.getAttribute('data-tippy-role'), + theme: el.getAttribute('data-tippy-theme'), + interactive: el.getAttribute('data-tippy-interactive') === 'true', + hideOnClick: el.getAttribute('data-tippy-hideOnClick') === 'true', + content: nextSibling, + }); + } + } } export function showTemporaryTooltip(target, content) {