diff --git a/routers/web/repo/issue_view.go b/routers/web/repo/issue_view.go index b593ad5c34d..dfff6c295b5 100644 --- a/routers/web/repo/issue_view.go +++ b/routers/web/repo/issue_view.go @@ -525,10 +525,7 @@ func (prInfo *pullRequestViewInfo) prepareMergeBoxCommitSigning(ctx *context.Con } if data.requireSigned && !data.willSign { - data.infoProtectionBlockers.AddErrorItem( - svg.RenderHTML("octicon-x"), - ctx.Locale.Tr("repo.pulls.require_signed_wont_sign"), - ) + data.infoProtectionBlockers.AddErrorItem(ctx.Locale.Tr("repo.pulls.require_signed_wont_sign")) if wontSignReason != "" { data.infoProtectionBlockers.AddInfoItem( svg.RenderHTML("octicon-unlock"), @@ -1053,29 +1050,28 @@ func (prInfo *pullRequestViewInfo) prepareMergeBoxProtectedRules(ctx *context.Co if pb.EnableApprovalsWhitelist { blockerInfo = ctx.Locale.Tr("repo.pulls.blocked_by_approvals_whitelisted", grantedApprovals, pb.RequiredApprovals) } - data.infoProtectionBlockers.AddErrorItem(svg.RenderHTML("octicon-x"), blockerInfo) + data.infoProtectionBlockers.AddErrorItem(blockerInfo) } data.isBlockedByRejection = issues_model.MergeBlockedByRejectedReview(ctx, pb, pull) if data.isBlockedByRejection { - data.infoProtectionBlockers.AddErrorItem(svg.RenderHTML("octicon-x"), ctx.Locale.Tr("repo.pulls.blocked_by_rejection")) + data.infoProtectionBlockers.AddErrorItem(ctx.Locale.Tr("repo.pulls.blocked_by_rejection")) } data.isBlockedByOfficialReviewRequests = issues_model.MergeBlockedByOfficialReviewRequests(ctx, pb, pull) if data.isBlockedByOfficialReviewRequests { - data.infoProtectionBlockers.AddErrorItem(svg.RenderHTML("octicon-x"), ctx.Locale.Tr("repo.pulls.blocked_by_official_review_requests")) + data.infoProtectionBlockers.AddErrorItem(ctx.Locale.Tr("repo.pulls.blocked_by_official_review_requests")) } data.isBlockedByOutdatedBranch = issues_model.MergeBlockedByOutdatedBranch(pb, pull) if data.isBlockedByOutdatedBranch { - data.infoProtectionBlockers.AddErrorItem(svg.RenderHTML("octicon-x"), ctx.Locale.Tr("repo.pulls.blocked_by_outdated_branch")) + data.infoProtectionBlockers.AddErrorItem(ctx.Locale.Tr("repo.pulls.blocked_by_outdated_branch")) } data.isBlockedByChangedProtectedFiles = len(pull.ChangedProtectedFiles) != 0 if data.isBlockedByChangedProtectedFiles { detailItems := escapeStringSliceToHTML(pull.ChangedProtectedFiles) data.infoProtectionBlockers.AddErrorItem( - svg.RenderHTML("octicon-x"), ctx.Locale.TrN(len(pull.ChangedProtectedFiles), "repo.pulls.blocked_by_changed_protected_files_1", "repo.pulls.blocked_by_changed_protected_files_n"), detailItems, ) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index eb6d5408a52..fcd45deea0a 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -36,7 +36,6 @@ import ( "gitea.dev/modules/log" "gitea.dev/modules/optional" "gitea.dev/modules/setting" - "gitea.dev/modules/svg" "gitea.dev/modules/templates" "gitea.dev/modules/translation" "gitea.dev/modules/util" @@ -484,15 +483,9 @@ func (prInfo *pullRequestViewInfo) prepareMergeBoxStatusCheckData(ctx *context.C if data.enableStatusCheck { if statusCheckData.RequiredChecksState.IsError() || statusCheckData.RequiredChecksState.IsFailure() { - data.infoProtectionBlockers.AddErrorItem( - svg.RenderHTML("octicon-x"), - ctx.Locale.Tr("repo.pulls.required_status_check_failed"), - ) + data.infoProtectionBlockers.AddErrorItem(ctx.Locale.Tr("repo.pulls.required_status_check_failed")) } else if !statusCheckData.RequiredChecksState.IsSuccess() { - data.infoProtectionBlockers.AddErrorItem( - svg.RenderHTML("octicon-x"), - ctx.Locale.Tr("repo.pulls.required_status_check_missing"), - ) + data.infoProtectionBlockers.AddErrorItem(ctx.Locale.Tr("repo.pulls.required_status_check_missing")) } } } diff --git a/routers/web/repo/pull_merge_box.go b/routers/web/repo/pull_merge_box.go index 471909f4253..4a167c2912f 100644 --- a/routers/web/repo/pull_merge_box.go +++ b/routers/web/repo/pull_merge_box.go @@ -13,7 +13,6 @@ import ( ) type pullMergeBoxInfoItem struct { - ItemClass string SvgIconHTML template.HTML InfoHTML template.HTML ListItems []template.HTML @@ -42,10 +41,9 @@ func (c *pullMergeBoxInfoItemCollection) AddInfoItem(svg, info template.HTML, op }) } -func (c *pullMergeBoxInfoItemCollection) AddErrorItem(svg, info template.HTML, optItems ...[]template.HTML) { +func (c *pullMergeBoxInfoItemCollection) AddErrorItem(info template.HTML, optItems ...[]template.HTML) { c.items = append(c.items, &pullMergeBoxInfoItem{ - ItemClass: "tw-text-red", - SvgIconHTML: svg, + SvgIconHTML: svg.RenderHTML("octicon-x", 16, "tw-text-red"), InfoHTML: info, ListItems: util.OptionalArg(optItems), }) @@ -151,10 +149,7 @@ func (prInfo *pullRequestViewInfo) prepareMergeBoxInfoItems(ctx *context.Context ctx.Locale.Tr("repo.pulls.is_empty"), ) } else { - prInfo.MergeBoxData.infoProtectionBlockers.AddErrorItem( - svg.RenderHTML("octicon-x"), - ctx.Locale.Tr("repo.pulls.cannot_auto_merge_desc"), - ) + prInfo.MergeBoxData.infoProtectionBlockers.AddErrorItem(ctx.Locale.Tr("repo.pulls.cannot_auto_merge_desc")) prInfo.MergeBoxData.infoProtectionBlockers.AddInfoItem( svg.RenderHTML("octicon-info"), ctx.Locale.Tr("repo.pulls.cannot_auto_merge_helper"), diff --git a/templates/repo/issue/view_content/pull_merge_box.tmpl b/templates/repo/issue/view_content/pull_merge_box.tmpl index d1594a52dda..8be1079e809 100644 --- a/templates/repo/issue/view_content/pull_merge_box.tmpl +++ b/templates/repo/issue/view_content/pull_merge_box.tmpl @@ -32,7 +32,7 @@ {{if $infoSection.InfoItems}}
{{range $infoItem := $infoSection.InfoItems}} -
{{$infoItem.SvgIconHTML}} {{$infoItem.InfoHTML}}
+
{{$infoItem.SvgIconHTML}} {{$infoItem.InfoHTML}}
{{if $infoItem.ListItems}}
-
+
{{if and $statusCheckData $statusCheckData.IsContextRequired}} {{if (call $statusCheckData.IsContextRequired $cs.Context)}}
{{ctx.Locale.Tr "repo.pulls.status_checks_requested"}}
diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 0682290e1a6..ad9a43b098c 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -1855,8 +1855,10 @@ tbody.commit-list { width: 100%; } -.commit-status-item { +.commit-status-item { /* the item can be used at 2 places: PR's merge box (commit-status-list), commit's status popup (no commit-status-list) */ height: 40px; + padding-top: 0 !important; /* use "height" + "align items center", don't use padding-y (from the list container) to layout */ + padding-bottom: 0 !important; display: flex; gap: var(--gap-block); align-items: center;