diff --git a/routers/web/devtest/devtest.go b/routers/web/devtest/devtest.go index 2ef030cb92..9b5804b976 100644 --- a/routers/web/devtest/devtest.go +++ b/routers/web/devtest/devtest.go @@ -11,6 +11,8 @@ import ( "strings" "time" + "forgejo.org/models/asymkey" + "forgejo.org/models/user" "forgejo.org/modules/base" "forgejo.org/modules/templates" "forgejo.org/services/context" @@ -65,6 +67,19 @@ func Tmpl(ctx *context.Context) { ctx.Data["TimePast1y"] = now.Add(-1 * 366 * 86400 * time.Second) ctx.Data["TimeFuture1y"] = now.Add(1 * 366 * 86400 * time.Second) + userNonZero := &user.User{ID: 1} + ctx.Data["TrustedVerif"] = &asymkey.ObjectVerification{Verified: true, Reason: asymkey.NotSigned, SigningUser: userNonZero, TrustStatus: "trusted"} + ctx.Data["UntrustedVerif"] = &asymkey.ObjectVerification{Verified: true, Reason: asymkey.NotSigned, SigningUser: userNonZero, TrustStatus: "untrusted"} + ctx.Data["UnmatchedVerif"] = &asymkey.ObjectVerification{Verified: true, Reason: asymkey.NotSigned, SigningUser: userNonZero, TrustStatus: ""} + ctx.Data["WarnVerif"] = &asymkey.ObjectVerification{Verified: false, Warning: true, Reason: asymkey.NotSigned, SigningUser: userNonZero} + ctx.Data["UnknownVerif"] = &asymkey.ObjectVerification{Verified: false, Warning: false, Reason: asymkey.NotSigned, SigningUser: userNonZero} + userUnknown := &user.User{ID: 0} + ctx.Data["TrustedVerifUnk"] = &asymkey.ObjectVerification{Verified: true, Reason: asymkey.NotSigned, SigningUser: userUnknown, TrustStatus: "trusted"} + ctx.Data["UntrustedVerifUnk"] = &asymkey.ObjectVerification{Verified: true, Reason: asymkey.NotSigned, SigningUser: userUnknown, TrustStatus: "untrusted"} + ctx.Data["UnmatchedVerifUnk"] = &asymkey.ObjectVerification{Verified: true, Reason: asymkey.NotSigned, SigningUser: userUnknown, TrustStatus: ""} + ctx.Data["WarnVerifUnk"] = &asymkey.ObjectVerification{Verified: false, Warning: true, Reason: asymkey.NotSigned, SigningUser: userUnknown} + ctx.Data["UnknownVerifUnk"] = &asymkey.ObjectVerification{Verified: false, Warning: false, Reason: asymkey.NotSigned, SigningUser: userUnknown} + if ctx.Req.Method == "POST" { _ = ctx.Req.ParseForm() ctx.Flash.Info("form: "+ctx.Req.Method+" "+ctx.Req.RequestURI+"
"+ diff --git a/templates/devtest/hashbox.tmpl b/templates/devtest/hashbox.tmpl new file mode 100644 index 0000000000..7321c9956d --- /dev/null +++ b/templates/devtest/hashbox.tmpl @@ -0,0 +1,82 @@ +{{template "base/head" .}} + +
+

Hashbox (shabox)

+ +

Unsigned

+ {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + )}} + +

Unknown signature

+
+ {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .UnknownVerif + )}} + {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .UnknownVerifUnk + )}} +
+ +

Trusted

+
+ {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .TrustedVerif + )}} + {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .TrustedVerifUnk + )}} +
+ +

Untrusted

+
+ {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .UntrustedVerif + )}} + {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .UntrustedVerifUnk + )}} +
+ +

Unmatched

+
+ {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .UnmatchedVerif + )}} + {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .UnmatchedVerifUnk + )}} +
+ +

Warning

+
+ {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .WarnVerif + )}} + {{template "repo/shabox" (dict + "sha1" "475e3471b4e8da8776fe7e66a3390c8a30c19f08" + "signature" "true" + "verification" .WarnVerifUnk + )}} +
+
+ +{{template "base/footer" .}} diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 7bc6dd1c97..b3ae0c8f48 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -176,16 +176,22 @@ {{ctx.Locale.Tr "repo.diff.parent"}} {{range .Parents}} {{if $.PageIsWiki}} - {{ShortSha .}} + + {{ShortSha .}} + {{else}} - {{ShortSha .}} + + {{ShortSha .}} + {{end}} {{end}} {{end}}
{{ctx.Locale.Tr "repo.diff.commit"}} - {{ShortSha .CommitID}} + + {{ShortSha .CommitID}} +
diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 7249becbab..621fc44bf5 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -10,9 +10,13 @@ {{if .IsDiffCompare}}
- {{if not .BaseIsCommit}}{{if .BaseIsBranch}}{{svg "octicon-git-branch"}}{{else if .BaseIsTag}}{{svg "octicon-tag"}}{{end}}{{.BaseBranch}}{{else}}{{ShortSha .BaseBranch}}{{end}} + + {{if not .BaseIsCommit}}{{if .BaseIsBranch}}{{svg "octicon-git-branch"}}{{else if .BaseIsTag}}{{svg "octicon-tag"}}{{end}}{{.BaseBranch}}{{else}}{{ShortSha .BaseBranch}}{{end}} + ... - {{if not .HeadIsCommit}}{{if .HeadIsBranch}}{{svg "octicon-git-branch"}}{{else if .HeadIsTag}}{{svg "octicon-tag"}}{{end}}{{.HeadBranch}}{{else}}{{ShortSha .HeadBranch}}{{end}} + + {{if not .HeadIsCommit}}{{if .HeadIsBranch}}{{svg "octicon-git-branch"}}{{else if .HeadIsTag}}{{svg "octicon-tag"}}{{end}}{{.HeadBranch}}{{else}}{{ShortSha .HeadBranch}}{{end}} +
{{end}} diff --git a/templates/repo/editor/cherry_pick.tmpl b/templates/repo/editor/cherry_pick.tmpl index f9c9eef5aa..49b210f75c 100644 --- a/templates/repo/editor/cherry_pick.tmpl +++ b/templates/repo/editor/cherry_pick.tmpl @@ -11,7 +11,7 @@
{{DateUtils.TimeSince .Delivered}} diff --git a/templates/repo/shabox.tmpl b/templates/repo/shabox.tmpl index a33256b2ed..270eab7759 100644 --- a/templates/repo/shabox.tmpl +++ b/templates/repo/shabox.tmpl @@ -16,6 +16,6 @@ {{ShortSha .sha1}} {{- if .signature -}} - {{template "repo/shabox_badge" dict "verification" .verification "svgSize" .svgSize}} + {{template "repo/shabox_badge" dict "verification" .verification}} {{- end -}} diff --git a/templates/repo/shabox_badge.tmpl b/templates/repo/shabox_badge.tmpl index 4650a9fcdd..ef3b567177 100644 --- a/templates/repo/shabox_badge.tmpl +++ b/templates/repo/shabox_badge.tmpl @@ -1,15 +1,15 @@ -
+
{{if .verification.Verified}} -
- {{if ne .verification.SigningUser.ID 0}} - {{svg "gitea-lock" .svgSize}} - {{ctx.AvatarUtils.Avatar .verification.SigningUser 28 "signature"}} - {{else}} - {{svg "gitea-lock-cog" .svgSize}} - {{ctx.AvatarUtils.AvatarByEmail .verification.SigningEmail "" 28 "signature"}} - {{end}} -
+ + {{if ne .verification.SigningUser.ID 0}} + {{svg "gitea-lock"}} + {{ctx.AvatarUtils.Avatar .verification.SigningUser 28}} + {{else}} + {{svg "gitea-lock-cog"}} + {{ctx.AvatarUtils.AvatarByEmail .verification.SigningEmail "" 28}} + {{end}} + {{else}} - {{svg "gitea-unlock" .svgSize}} + {{svg "gitea-unlock"}} {{end}}
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index e93a0fbb48..d0ecb1fc36 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -96,7 +96,6 @@ "commitLink" (printf "%s/commit/%s" $repoLink .Sha1) "signature" .Signature "verification" .Verification - "svgSize" 13 )}} {{RenderCommitMessage $.Context .Message ($repo.ComposeMetas ctx)}} diff --git a/web_src/css/base.css b/web_src/css/base.css index b95cce3c3a..a962ea031a 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -809,19 +809,6 @@ img.ui.avatar, margin-left: 25px; } -.ui .sha.label { - font-family: var(--fonts-monospace); - font-size: 13px; - font-weight: var(--font-weight-normal); - margin: 0 6px; - padding: 5px 10px; - flex-shrink: 0; -} - -.ui .sha.label .shortsha { - display: inline-block; /* not sure whether it is still needed */ -} - .ui .button.truncate { display: inline-block; max-width: 100%; diff --git a/web_src/css/features/gitgraph.css b/web_src/css/features/gitgraph.css index 726ac7e9e2..9f44e884b7 100644 --- a/web_src/css/features/gitgraph.css +++ b/web_src/css/features/gitgraph.css @@ -125,14 +125,7 @@ } #git-graph-container #rev-list .sha.label { - padding-top: 5px; - padding-bottom: 3px; -} - -#git-graph-container #rev-list .sha.label .ui.detail.icon.button { - padding-top: 3px; - margin-top: -5px; - padding-bottom: 1px; + height: 23px; } #git-graph-container #rev-list .author img.ui.avatar { diff --git a/web_src/css/repo.css b/web_src/css/repo.css index e2627fda8f..35133b965f 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -865,43 +865,6 @@ td .commit-summary { .singular-commit .shabox .sha.label { margin: 0; - border: 1px solid var(--color-light-border); -} - -.singular-commit .shabox .sha.label.isSigned.isWarning { - border: 1px solid var(--color-red-badge); - background: var(--color-red-badge-bg); -} - -.singular-commit .shabox .sha.label.isSigned.isWarning:hover { - background: var(--color-red-badge-hover-bg) !important; -} - -.singular-commit .shabox .sha.label.isSigned.isVerified { - border: 1px solid var(--color-green-badge); - background: var(--color-green-badge-bg); -} - -.singular-commit .shabox .sha.label.isSigned.isVerified:hover { - background: var(--color-green-badge-hover-bg) !important; -} - -.singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted { - border: 1px solid var(--color-yellow-badge); - background: var(--color-yellow-badge-bg); -} - -.singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted:hover { - background: var(--color-yellow-badge-hover-bg) !important; -} - -.singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched { - border: 1px solid var(--color-orange-badge); - background: var(--color-orange-badge-bg); -} - -.singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched:hover { - background: var(--color-orange-badge-hover-bg) !important; } @media (min-width: 768px) { @@ -1272,189 +1235,100 @@ td .commit-summary { background-color: var(--color-light) !important; } -#activity-feed .sha.label, -.repository #commits-table td.sha .sha.label, -.repository #repo-files-table .sha.label, -.repository #repo-file-commit-box .sha.label, -.repository #rev-list .sha.label, -.repository .timeline-item.commits-list .singular-commit .sha.label { +.ui .sha.label { + font-family: var(--fonts-monospace); + font-size: 13px; + font-weight: var(--font-weight-normal); + margin: 0 6px; + padding: 0; + gap: 0; + flex-shrink: 0; +} + +.ui.ui .sha.label { border: 1px solid var(--color-light-border); } -#activity-feed .sha.label .ui.signature.avatar { - height: 13px; - margin-bottom: 0; - width: 13px; +.ui.primary.sha.label { + border: none !important; + background: var(--color-primary) !important; } -.repository #commits-table td.sha .sha.label .ui.signature.avatar, -.repository #repo-files-table .sha.label .ui.signature.avatar, -.repository #repo-file-commit-box .sha.label .ui.signature.avatar, -.repository #rev-list .sha.label .ui.signature.avatar, -.repository .timeline-item.commits-list .singular-commit .sha.label .ui.signature.avatar { +.sha.label .shortsha { + padding: 0.33rem 0.5rem; +} + +.sha.label .signature { + color: var(--color-text); + background: var(--color-light); + padding: 0.25rem 0.33rem; + border-left: 1px solid var(--color-light-border); +} + +.sha.label .signature-author { + display: flex; + gap: 0.25rem; +} + +.sha.label .signature-author .avatar { height: 16px; margin-bottom: 0; width: 16px; } -#activity-feed .sha.label .detail.icon, -.repository #commits-table td.sha .sha.label .detail.icon, -.repository #repo-files-table .sha.label .detail.icon, -.repository #repo-file-commit-box .sha.label .detail.icon, -.repository #rev-list .sha.label .detail.icon, -.repository .timeline-item.commits-list .singular-commit .sha.label .detail.icon { - background: var(--color-light); - margin: -6px -10px -4px 0; - padding: 5px 4px 5px 6px; - border-left: 1px solid var(--color-light-border); - border-top: 0; - border-right: 0; - border-bottom: 0; - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -#activity-feed .sha.label .detail.icon img, -.repository #commits-table td.sha .sha.label .detail.icon img, -.repository #repo-files-table .sha.label .detail.icon img, -.repository #repo-file-commit-box .sha.label .detail.icon img, -.repository #rev-list .sha.label .detail.icon img, -.repository .timeline-item.commits-list .singular-commit .sha.label .detail.icon img { - margin-right: 0; -} - -#activity-feed .sha.label .detail.icon .svg, -.repository #commits-table td.sha .sha.label .detail.icon .svg, -.repository #repo-files-table .sha.label .detail.icon .svg, -.repository #repo-file-commit-box .sha.label .detail.icon .svg, -.repository #rev-list .sha.label .detail.icon .svg, -.repository .timeline-item.commits-list .singular-commit .sha.label .detail.icon .svg { - margin: 0 0.25em 0 0; -} - -#activity-feed .sha.label .detail.icon > div, -.repository #commits-table td.sha .sha.label .detail.icon > div, -.repository #repo-files-table .sha.label .detail.icon > div, -.repository #repo-file-commit-box .sha.label .detail.icon > div, -.repository #rev-list .sha.label .detail.icon > div, -.repository .timeline-item.commits-list .singular-commit .sha.label .detail.icon > div { - display: flex; - align-items: center; -} - -#activity-feed .sha.label.isSigned.isWarning, -.repository #commits-table td.sha .sha.label.isSigned.isWarning, -.repository #repo-files-table .sha.label.isSigned.isWarning, -.repository #repo-file-commit-box .sha.label.isSigned.isWarning, -.repository #rev-list .sha.label.isSigned.isWarning, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isWarning { +.sha.label.isSigned.isWarning { border: 1px solid var(--color-red-badge); background: var(--color-red-badge-bg); } -#activity-feed .sha.label.isSigned.isWarning .detail.icon, -.repository #commits-table td.sha .sha.label.isSigned.isWarning .detail.icon, -.repository #repo-files-table .sha.label.isSigned.isWarning .detail.icon, -.repository #repo-file-commit-box .sha.label.isSigned.isWarning .detail.icon, -.repository #rev-list .sha.label.isSigned.isWarning .detail.icon, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isWarning .detail.icon { +.sha.label.isSigned.isWarning .signature { border-left: 1px solid var(--color-red-badge); color: var(--color-red-badge); } -#activity-feed .sha.label.isSigned.isWarning:hover, -.repository #commits-table td.sha .sha.label.isSigned.isWarning:hover, -.repository #repo-files-table .sha.label.isSigned.isWarning:hover, -.repository #repo-file-commit-box .sha.label.isSigned.isWarning:hover, -.repository #rev-list .sha.label.isSigned.isWarning:hover, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isWarning:hover { +.sha.label.isSigned.isWarning:hover { background: var(--color-red-badge-hover-bg) !important; } -#activity-feed .sha.label.isSigned.isVerified, -.repository #commits-table td.sha .sha.label.isSigned.isVerified, -.repository #repo-files-table .sha.label.isSigned.isVerified, -.repository #repo-file-commit-box .sha.label.isSigned.isVerified, -.repository #rev-list .sha.label.isSigned.isVerified, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerified { +.sha.label.isSigned.isVerified { border: 1px solid var(--color-green-badge); background: var(--color-green-badge-bg); } -#activity-feed .sha.label.isSigned.isVerified .detail.icon, -.repository #commits-table td.sha .sha.label.isSigned.isVerified .detail.icon, -.repository #repo-files-table .sha.label.isSigned.isVerified .detail.icon, -.repository #repo-file-commit-box .sha.label.isSigned.isVerified .detail.icon, -.repository #rev-list .sha.label.isSigned.isVerified .detail.icon, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerified .detail.icon { +.sha.label.isSigned.isVerified .signature { border-left: 1px solid var(--color-green-badge); color: var(--color-green-badge); } -#activity-feed .sha.label.isSigned.isVerified:hover, -.repository #commits-table td.sha .sha.label.isSigned.isVerified:hover, -.repository #repo-files-table .sha.label.isSigned.isVerified:hover, -.repository #repo-file-commit-box .sha.label.isSigned.isVerified:hover, -.repository #rev-list .sha.label.isSigned.isVerified:hover, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerified:hover { +.sha.label.isSigned.isVerified:hover { background: var(--color-green-badge-hover-bg) !important; } -#activity-feed .sha.label.isSigned.isVerifiedUntrusted, -.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted, -.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted, -.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUntrusted, -.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUntrusted { +.sha.label.isSigned.isVerifiedUntrusted { border: 1px solid var(--color-yellow-badge); background: var(--color-yellow-badge-bg); } -#activity-feed .sha.label.isSigned.isVerifiedUntrusted .detail.icon, -.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted .detail.icon, -.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted .detail.icon, -.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUntrusted .detail.icon, -.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted .detail.icon, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUntrusted .detail.icon { +.sha.label.isSigned.isVerifiedUntrusted .signature { border-left: 1px solid var(--color-yellow-badge); color: var(--color-yellow-badge); } -#activity-feed .sha.label.isSigned.isVerifiedUntrusted:hover, -.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted:hover, -.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted:hover, -.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUntrusted:hover, -.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted:hover, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUntrusted:hover { +.sha.label.isSigned.isVerifiedUntrusted:hover { background: var(--color-yellow-badge-hover-bg) !important; } -#activity-feed .sha.label.isSigned.isVerifiedUnmatched, -.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched, -.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched, -.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUnmatched, -.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUnmatched { +.sha.label.isSigned.isVerifiedUnmatched { border: 1px solid var(--color-orange-badge); background: var(--color-orange-badge-bg); } -#activity-feed .sha.label.isSigned.isVerifiedUnmatched .detail.icon, -.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched .detail.icon, -.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched .detail.icon, -.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUnmatched .detail.icon, -.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched .detail.icon, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUnmatched .detail.icon { +.sha.label.isSigned.isVerifiedUnmatched .signature { border-left: 1px solid var(--color-orange-badge); color: var(--color-orange-badge); } -#activity-feed .sha.label.isSigned.isVerifiedUnmatched:hover, -.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched:hover, -.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched:hover, -.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUnmatched:hover, -.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched:hover, -.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUnmatched:hover { +.sha.label.isSigned.isVerifiedUnmatched:hover { background: var(--color-orange-badge-hover-bg) !important; }