refactor(templates): update djlint to 1.46.0 and resolve its new findings (#39231)

This commit is contained in:
silverwind
2026-09-08 23:17:17 +00:00
committed by GitHub
parent 459fc13783
commit f5c7b21f1d
175 changed files with 533 additions and 528 deletions
+3 -3
View File
@@ -2,12 +2,12 @@
{{if not .Repository.IsArchived}}
<!-- Action Button -->
{{if and .IsShowClosed.Has .IsShowClosed.Value}}
<button class="ui primary basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_open"}}</button>
<button type="button" class="ui primary basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_open"}}</button>
{{else if and .IsShowClosed.Has (not .IsShowClosed.Value)}}
<button class="ui red basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_close"}}</button>
<button type="button" class="ui red basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_close"}}</button>
{{end}}
{{if $.IsRepoAdmin}}
<button class="ui red button issue-action"
<button type="button" class="ui red button issue-action"
data-action="delete" data-url="{{$.RepoLink}}/issues/delete"
data-action-delete-confirm="{{ctx.Locale.Tr "confirm_delete_selected"}}"
>{{ctx.Locale.Tr "repo.issues.delete"}}</button>
+1 -1
View File
@@ -5,7 +5,7 @@
<div class="issue-navbar tw-mb-4">
{{template "repo/issue/navbar" .}}
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
<button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button>
<button type="button" class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button>
{{end}}
</div>
{{template "base/alert" .}}
@@ -57,11 +57,11 @@
</form>
</div>
<div class="actions">
<button class="ui small basic cancel button">
<button type="button" class="ui small basic cancel button">
{{svg "octicon-x"}}
{{ctx.Locale.Tr "cancel"}}
</button>
<button class="ui primary small approve button">
<button type="button" class="ui primary small approve button">
{{svg "fontawesome-save"}}
{{ctx.Locale.Tr "save"}}
</button>
+2 -2
View File
@@ -47,11 +47,11 @@
<a class="ui primary basic button" href="{{.RepoLink}}/milestones">
{{ctx.Locale.Tr "repo.milestones.cancel"}}
</a>
<button class="ui primary button">
<button type="submit" class="ui primary button">
{{ctx.Locale.Tr "repo.milestones.modify"}}
</button>
{{else}}
<button class="ui primary button">
<button type="submit" class="ui primary button">
{{ctx.Locale.Tr "repo.milestones.create"}}
</button>
{{end}}
+1 -1
View File
@@ -33,7 +33,7 @@
{{template "repo/issue/comment_tab" .}}
{{end}}
<div class="flex-text-block tw-justify-end">
<button class="ui primary button">
<button type="submit" class="ui primary button">
{{if .PageIsComparePull}}
{{ctx.Locale.Tr "repo.pulls.create"}}
{{else}}
+1 -1
View File
@@ -22,7 +22,7 @@
method="post" action="{{AppSubUrl}}/{{PathEscape .Repository.Owner.Name}}/{{PathEscape .Repository.Name}}/issues/{{.Issue.Index}}/deadline"
>
<input required type="date" name="deadline" placeholder="{{ctx.Locale.Tr "repo.issues.due_date_form"}}" {{if .Issue.DeadlineUnix}}value="{{.Issue.DeadlineUnix.FormatDate}}"{{end}}>
<button class="ui icon button">{{Iif .Issue.DeadlineUnix (svg "octicon-pencil") (svg "octicon-plus")}}</button>
<button type="submit" class="ui icon button">{{Iif .Issue.DeadlineUnix (svg "octicon-pencil") (svg "octicon-plus")}}</button>
</form>
{{end}}
</div>
@@ -117,7 +117,7 @@
<input type="text" class="search">
<div class="default text">{{ctx.Locale.Tr "repo.issues.dependency.add"}}</div>
</div>
<button class="ui icon button">
<button type="submit" class="ui icon button">
{{svg "octicon-plus"}}
</button>
</div>
@@ -4,7 +4,7 @@
{{/* Pin issue */}}
{{if or .PinEnabled .Issue.IsPinned}}
<form class="tw-mt-1 form-fetch-action single-button-form" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.max_pinned"}}"{{end}}>
<button class="fluid ui button {{if not $.NewPinAllowed}}disabled{{end}}">
<button type="submit" class="fluid ui button {{if not $.NewPinAllowed}}disabled{{end}}">
{{if not .Issue.IsPinned}}
{{svg "octicon-pin"}}
{{ctx.Locale.Tr "pin"}}
@@ -17,7 +17,7 @@
{{end}}
{{/* Lock/unlock conversation */}}
<button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock-conversation">
<button type="button" class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock-conversation">
{{if .Issue.IsLocked}}
{{svg "octicon-key"}} {{ctx.Locale.Tr "repo.issues.unlock"}}
{{else}}
@@ -66,9 +66,9 @@
{{end}}
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button type="button" class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
{{/* explicitly focus the submit button, to avoid Fomantic modal focuses and popups the dropdown */}}
<button class="ui red button" autofocus>
<button type="submit" class="ui red button" autofocus>
{{if .Issue.IsLocked}}
{{ctx.Locale.Tr "repo.issues.unlock_confirm"}}
{{else}}
@@ -79,7 +79,7 @@
</form>
</div>
</div>
<button class="tw-mt-1 fluid ui show-modal button" data-modal="#sidebar-delete-issue">
<button type="button" class="tw-mt-1 fluid ui show-modal button" data-modal="#sidebar-delete-issue">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "repo.issues.delete"}}
</button>
@@ -2,5 +2,5 @@
{{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}}
<div class="flex-text-block" data-tooltip-content="{{$issueReferenceLink}}">
<span class="tw-flex-1 gt-ellipsis">{{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}</span>
<button class="ui compact tiny icon button" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button>
<button type="button" class="ui compact tiny icon button" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button>
</div>
@@ -121,7 +121,7 @@
<input id="issue-sidebar-dismiss-review-message" name="message">
</div>
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button type="button" class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button" type="submit">{{ctx.Locale.Tr "ok"}}</button>
</div>
</form>
@@ -4,23 +4,23 @@
<div>
<div class="flex-text-block">
<strong class="tw-flex-1">{{ctx.Locale.Tr "repo.issues.tracker"}}</strong>
<button class="btn interact-fg show-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.time_estimate_set"}}" data-modal="#issue-time-set-estimate-modal">
<button type="button" class="btn interact-fg show-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.time_estimate_set"}}" data-modal="#issue-time-set-estimate-modal">
{{svg "octicon-pencil"}}
</button>
</div>
<div class="ui buttons tw-mt-2 tw-w-full">
{{if $.IsStopwatchRunning}}
<button class="ui button tw-flex-1 issue-stop-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/stop">
<button type="button" class="ui button tw-flex-1 issue-stop-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/stop">
{{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_stop"}}
</button>
<button class="ui icon button issue-cancel-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/cancel" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.timetracker_timer_discard"}}">
<button type="button" class="ui icon button issue-cancel-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/cancel" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.timetracker_timer_discard"}}">
{{svg "octicon-trash"}}
</button>
{{else}}
<button class="ui button tw-flex-1 issue-start-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/start">
<button type="button" class="ui button tw-flex-1 issue-start-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/start">
{{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_start"}}
</button>
<button class="ui icon button issue-add-time show-modal" data-modal="#issue-time-manually-add-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.timetracker_timer_manually_add"}}">
<button type="button" class="ui icon button issue-add-time show-modal" data-modal="#issue-time-manually-add-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.timetracker_timer_manually_add"}}">
{{svg "octicon-plus"}}
</button>
{{end}}
@@ -41,8 +41,8 @@
<div class="content">
<input name="time_estimate" placeholder="1h 2m" value="{{TimeEstimateString .Issue.TimeEstimate}}">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button>
<button class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button>
<button type="button" class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button>
</div>
</div>
</form>
@@ -57,8 +57,8 @@
<input placeholder='{{ctx.Locale.Tr "repo.issues.add_time_minutes"}}' type="number" name="minutes">
</div>
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button>
<button class="ui primary button">{{ctx.Locale.Tr "repo.issues.timetracker_timer_manually_add"}}</button>
<button type="button" class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.timetracker_timer_manually_add"}}</button>
</div>
</form>
</div>
+2 -2
View File
@@ -99,12 +99,12 @@
{{$btnTextNoComment = ctx.Locale.Tr (Iif .Issue.IsPull "repo.pulls.close" "repo.issues.close")}}
{{$btnTextWithComment = ctx.Locale.Tr "repo.issues.close_comment_issue"}}{{/* general: Close with Comment */}}
{{end}}
<button id="status-button" class="ui button" data-status="{{$btnTextNoComment}}" data-status-and-comment="{{$btnTextWithComment}}" name="status" value="{{$btnValue}}">
<button type="submit" id="status-button" class="ui button" data-status="{{$btnTextNoComment}}" data-status-and-comment="{{$btnTextWithComment}}" name="status" value="{{$btnValue}}">
<span class="status-button-icon {{$btnIconColor}}">{{svg $btnIcon}}</span>
<span class="status-button-text">{{$btnTextNoComment}}</span>
</button>
{{end}}
<button id="comment-button" class="ui primary button">
<button type="submit" id="comment-button" class="ui primary button">
{{ctx.Locale.Tr "repo.issues.create_comment"}}
</button>
</div>
@@ -2,7 +2,7 @@
{{if (not .comment.Time.Deleted)}}
{{if (or ctx.RootData.IsAdmin (and ctx.RootData.IsSigned (eq ctx.RootData.SignedUserID .comment.PosterID)))}}
<span class="tw-ml-auto">
<button class="ui icon button compact mini link-action" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.del_time"}}"
<button type="button" class="ui icon button compact mini link-action" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.del_time"}}"
data-url="{{ctx.RootData.RepoLink}}/issues/{{ctx.RootData.Issue.Index}}/times/{{.comment.TimeID}}/delete?id={{.comment.Time.ID}}"
data-modal-confirm="{{ctx.Locale.Tr "repo.issues.del_time"}}"
>
@@ -22,7 +22,7 @@ The variables in "ctx.Data" are different in each case, making this template fra
</div>
<div class="tw-flex tw-items-center">
{{if or $invalid $resolved}}
<button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}tw-hidden{{end}} btn tiny show-outdated">
<button type="button" id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}tw-hidden{{end}} btn tiny show-outdated">
{{svg "octicon-unfold" 16 "tw-mr-2"}}
{{if $resolved}}
{{ctx.Locale.Tr "repo.issues.review.show_resolved"}}
@@ -30,7 +30,7 @@ The variables in "ctx.Data" are different in each case, making this template fra
{{ctx.Locale.Tr "repo.issues.review.show_outdated"}}
{{end}}
</button>
<button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if $resolved}}tw-hidden {{end}} btn tiny hide-outdated">
<button type="button" id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if $resolved}}tw-hidden {{end}} btn tiny hide-outdated">
{{svg "octicon-fold" 16 "tw-mr-2"}}
{{if $resolved}}
{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
@@ -125,7 +125,7 @@ The variables in "ctx.Data" are different in each case, making this template fra
</div>
<div class="flex-text-block">
{{if and $.CanMarkConversation $hasReview (not $isReviewPending)}}
<button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
<button type="button" class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
{{if $resolved}}
{{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}}
{{else}}
@@ -134,7 +134,7 @@ The variables in "ctx.Data" are different in each case, making this template fra
</button>
{{end}}
{{if and $.SignedUserID (not $.Repository.IsArchived)}}
<button class="comment-form-reply ui primary icon tiny button">
<button type="button" class="comment-form-reply ui primary icon tiny button">
{{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
</button>
{{end}}
@@ -23,7 +23,7 @@
</div>
{{if $data.IsPullBranchDeletable}}
<div>
<button class="ui button link-action delete-branch-after-merge" data-url="{{.DeleteBranchLink}}">{{ctx.Locale.Tr "repo.branch.delete_html"}}</button>
<button type="button" class="ui button link-action delete-branch-after-merge" data-url="{{.DeleteBranchLink}}">{{ctx.Locale.Tr "repo.branch.delete_html"}}</button>
</div>
{{end}}
</div>
@@ -56,7 +56,7 @@
{{svg "octicon-x"}} {{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}}
</div>
{{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}}
<button class="ui compact button" data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title">
<button type="button" class="ui compact button" data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title">
{{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}}
</button>
{{end}}
@@ -6,7 +6,7 @@
{{$commitStatuses := $statusCheckData.PullCommitStatuses}}
<div class="item flex-left-right commit-status-toggle">
<div>{{$statusCheckData.CommitStatusCheckPrompt ctx.Locale}}</div>
<button data-global-click="onCommitStatusChecksToggle" class="btn interact-fg"
<button type="button" data-global-click="onCommitStatusChecksToggle" class="btn interact-fg"
data-show-all="{{ctx.Locale.Tr "repo.pulls.status_checks_show_all"}}"
data-hide-all="{{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}"
>{{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}</button>
@@ -19,7 +19,7 @@
<p>{{ctx.Locale.Tr "repo.pulls.status_checks_need_approvals_helper"}}</p>
</div>
{{if $statusCheckData.CanApprove}}
<button class="ui basic button link-action" data-url="{{$statusCheckData.ApproveLink}}">
<button type="button" class="ui basic button link-action" data-url="{{$statusCheckData.ApproveLink}}">
{{ctx.Locale.Tr "repo.pulls.status_checks_approve_all"}}
</button>
{{end}}
@@ -20,7 +20,7 @@
<textarea name="content"></textarea>
</div>
<div class="flex-text-block tw-justify-end">
<button class="ui primary button">{{ctx.Locale.Tr "repo.issues.create"}}</button>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.create"}}</button>
</div>
</form>
</div>
@@ -6,7 +6,7 @@
</div>
{{if $data.UpdatePrimaryAction}}
<div class="ui buttons"{{if $data.UpdateStyleOptions}} data-global-init="initRepoPullRequestUpdate"{{end}}>
<button class="ui button link-action" data-url="{{$data.UpdatePrimaryAction.URL}}">
<button type="button" class="ui button link-action" data-url="{{$data.UpdatePrimaryAction.URL}}">
{{$data.UpdatePrimaryAction.Text}}
</button>
{{if gt (len $data.UpdateStyleOptions) 1}}
+2 -2
View File
@@ -18,7 +18,7 @@
</h1>
<div class="issue-title-buttons">
{{if $canEditIssueTitle}}
<button id="issue-title-edit-show" class="ui small basic button">{{ctx.Locale.Tr "repo.issues.edit"}}</button>
<button type="button" id="issue-title-edit-show" class="ui small basic button">{{ctx.Locale.Tr "repo.issues.edit"}}</button>
{{end}}
{{if not .Issue.IsPull}}
<a role="button" class="ui small primary button" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}">{{ctx.Locale.Tr "repo.issues.new"}}</a>
@@ -56,7 +56,7 @@
{{if .Issue.IsPull}}
{{$headHref := .HeadTarget}}
{{if .HeadBranchLink}}
{{$headHref = HTMLFormat `<a href="%s">%s</a> <button class="btn interact-fg" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` .HeadBranchLink $headHref (ctx.Locale.Tr "copy_branch") .HeadTarget (svg "octicon-copy" 14)}}
{{$headHref = HTMLFormat `<a href="%s">%s</a> <button type="button" class="btn interact-fg" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` .HeadBranchLink $headHref (ctx.Locale.Tr "copy_branch") .HeadTarget (svg "octicon-copy" 14)}}
{{else}}
{{if .Issue.PullRequest.IsAgitFlow}}
{{$headHref = HTMLFormat `%s <a href="%s" target="_blank"><span class="ui label basic tiny" data-tooltip-content="%s">AGit</span></a>` $headHref "https://docs.gitea.com/usage/agit" (ctx.Locale.Tr "repo.pull.agit_documentation")}}