summaryrefslogtreecommitdiffstats
path: root/templates/repo/issue
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-06-14 20:17:58 +0200
committerGitHub <noreply@github.com>2023-06-14 18:17:58 +0000
commite24f651c86a5168da8181f2c75f5f99b56561224 (patch)
tree1f604dc894e29a0c99adca856bd55ad1ca78d4be /templates/repo/issue
parenta0eaf0881235d41ca98f4718af815908d1237d2c (diff)
downloadgitea-e24f651c86a5168da8181f2c75f5f99b56561224.tar.gz
gitea-e24f651c86a5168da8181f2c75f5f99b56561224.zip
Add template linting via djlint (#25212)
So I found this [linter](https://github.com/Riverside-Healthcare/djlint) which features a mode for go templates, so I gave it a try and it did find a number of valid issue, like unbalanced tags etc. It also has a number of bugs, I had to disable/workaround many issues. Given that this linter is written in python, this does add a dependency on `python` >= 3.8 and `poetry` to the development environment to be able to run this linter locally. - `e.g.` prefixes on placeholders are removed because the linter had a false-positive on `placeholder="e.g. cn=Search"` for the `attr=value` syntax and it's not ideal anyways to write `e.g.` into a placeholder because a placeholder is meant to hold a sample value. - In `templates/repo/settings/options.tmpl` I simplified the logic to not conditionally create opening tags without closing tags because this stuff confuses the linter (and possibly the reader as well).
Diffstat (limited to 'templates/repo/issue')
-rw-r--r--templates/repo/issue/branch_selector_field.tmpl2
-rw-r--r--templates/repo/issue/choose.tmpl2
-rw-r--r--templates/repo/issue/labels.tmpl3
-rw-r--r--templates/repo/issue/view_content/comments.tmpl12
-rw-r--r--templates/repo/issue/view_content/comments_delete_time.tmpl2
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl18
6 files changed, 19 insertions, 20 deletions
diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl
index 2577a0feb0..4669c9e8e5 100644
--- a/templates/repo/issue/branch_selector_field.tmpl
+++ b/templates/repo/issue/branch_selector_field.tmpl
@@ -1,7 +1,7 @@
{{if and (not .Issue.IsPull) (not .PageIsComparePull)}}
<input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}">
<input id="editing_mode" name="edit_mode" type="hidden" value="{{(or .IsIssueWriter .HasIssuesOrPullsWritePermission)}}">
-<form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref" id="update_issueref_form">
+<form method="post" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref" id="update_issueref_form">
{{$.CsrfTokenHtml}}
</form>
diff --git a/templates/repo/issue/choose.tmpl b/templates/repo/issue/choose.tmpl
index b5316454ba..ccfeb7b331 100644
--- a/templates/repo/issue/choose.tmpl
+++ b/templates/repo/issue/choose.tmpl
@@ -50,7 +50,7 @@
<div class="ui warning message">
<div class="text left">
<div>{{.locale.Tr "repo.issues.choose.invalid_config"}}</div>
- <diy>{{.IssueConfigError}}</div>
+ <div>{{.IssueConfigError}}</div>
</div>
</div>
{{end}}
diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl
index a122333c89..f897590cc2 100644
--- a/templates/repo/issue/labels.tmpl
+++ b/templates/repo/issue/labels.tmpl
@@ -19,7 +19,6 @@
</div>
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
-{{template "repo/issue/labels/edit_delete_label" .}}
+ {{template "repo/issue/labels/edit_delete_label" .}}
{{end}}
-</div>
{{template "base/footer" .}}
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 0652198adf..bfcd292f44 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -249,7 +249,7 @@
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
- {{$.locale.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 13}}
@@ -258,7 +258,7 @@
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
- {{$.locale.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}
</span>
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
<div class="detail">
@@ -272,7 +272,7 @@
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
- {{$.locale.Tr "repo.issues.add_time_history" $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.add_time_history" $createdStr | Safe}}
</span>
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
<div class="detail">
@@ -286,7 +286,7 @@
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
- {{$.locale.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 16}}
@@ -672,7 +672,7 @@
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
- {{$.locale.Tr "repo.issues.del_time_history" $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.del_time_history" $createdStr | Safe}}
</span>
<div class="detail">
{{svg "octicon-clock"}}
@@ -719,7 +719,7 @@
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if .IsForcePush}}
- {{$.locale.Tr "repo.issues.force_push_codes" ($.Issue.PullRequest.HeadBranch|Escape) (ShortSha .OldCommit) (($.Issue.Repo.CommitLink .OldCommit)|Escape) (ShortSha .NewCommit) (($.Issue.Repo.CommitLink .NewCommit)|Escape) $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.force_push_codes" ($.Issue.PullRequest.HeadBranch|Escape) (ShortSha .OldCommit) (($.Issue.Repo.CommitLink .OldCommit)|Escape) (ShortSha .NewCommit) (($.Issue.Repo.CommitLink .NewCommit)|Escape) $createdStr | Safe}}
{{else}}
{{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}}
{{end}}
diff --git a/templates/repo/issue/view_content/comments_delete_time.tmpl b/templates/repo/issue/view_content/comments_delete_time.tmpl
index cbfb1144fd..b9072ca140 100644
--- a/templates/repo/issue/view_content/comments_delete_time.tmpl
+++ b/templates/repo/issue/view_content/comments_delete_time.tmpl
@@ -3,7 +3,7 @@
{{if (or .ctxData.IsAdmin (and .ctxData.IsSigned (eq .ctxData.SignedUserID .comment.PosterID)))}}
<span class="ui float right">
<div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}">
- <form method="POST" class="delete-time-form" action="{{.ctxData.RepoLink}}/issues/{{.ctxData.Issue.Index}}/times/{{.comment.TimeID}}/delete">
+ <form method="post" class="delete-time-form" action="{{.ctxData.RepoLink}}/issues/{{.ctxData.Issue.Index}}/times/{{.comment.TimeID}}/delete">
{{.ctxData.CsrfTokenHtml}}
</form>
<div class="header">{{.ctxData.locale.Tr "repo.issues.del_time"}}</div>
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 901f714e32..c0f5a8d3d7 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -270,7 +270,7 @@
<div class="ui watching">
<span class="text"><strong>{{.locale.Tr "notification.notifications"}}</strong></span>
<div class="gt-mt-3">
- <form method="POST" action="{{.Issue.Link}}/watch">
+ <form method="post" action="{{.Issue.Link}}/watch">
<input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}">
{{$.CsrfTokenHtml}}
<button class="fluid ui button">
@@ -292,13 +292,13 @@
<div class="ui timetrack">
<span class="text"><strong>{{.locale.Tr "repo.issues.tracker"}}</strong></span>
<div class="gt-mt-3">
- <form method="POST" action="{{.Issue.Link}}/times/stopwatch/toggle" id="toggle_stopwatch_form">
+ <form method="post" action="{{.Issue.Link}}/times/stopwatch/toggle" id="toggle_stopwatch_form">
{{$.CsrfTokenHtml}}
</form>
- <form method="POST" action="{{.Issue.Link}}/times/stopwatch/cancel" id="cancel_stopwatch_form">
+ <form method="post" action="{{.Issue.Link}}/times/stopwatch/cancel" id="cancel_stopwatch_form">
{{$.CsrfTokenHtml}}
</form>
- {{if $.IsStopwatchRunning}}
+ {{if $.IsStopwatchRunning}}
<button class="ui fluid button issue-stop-time">{{.locale.Tr "repo.issues.stop_tracking"}}</button>
<button class="ui fluid negative button issue-cancel-time gt-mt-3">{{.locale.Tr "repo.issues.cancel_tracking"}}</button>
{{else}}
@@ -311,7 +311,7 @@
<div class="ui mini modal issue-start-time-modal">
<div class="header">{{.locale.Tr "repo.issues.add_time"}}</div>
<div class="content">
- <form method="POST" id="add_time_manual_form" action="{{.Issue.Link}}/times/add" class="ui action input fluid">
+ <form method="post" id="add_time_manual_form" action="{{.Issue.Link}}/times/add" class="ui action input fluid">
{{$.CsrfTokenHtml}}
<input placeholder='{{.locale.Tr "repo.issues.add_time_hours"}}' type="number" name="hours">
<input placeholder='{{.locale.Tr "repo.issues.add_time_minutes"}}' type="number" name="minutes" class="ui compact">
@@ -330,7 +330,7 @@
{{if gt (len .WorkingUsers) 0}}
<div class="ui divider"></div>
<div class="ui comments">
- <span class="text"><strong>{{.locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time) | Safe}}</strong></span>
+ <span class="text"><strong>{{.locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time) | Safe}}</strong></span>
<div>
{{range $user, $trackedtime := .WorkingUsers}}
<div class="comment gt-mt-3">
@@ -498,7 +498,7 @@
{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}}
<div>
- <form method="POST" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm">
+ <form method="post" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm">
{{$.CsrfTokenHtml}}
<div class="ui fluid action input">
<div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}">
@@ -525,7 +525,7 @@
{{.locale.Tr "repo.issues.dependency.remove_header"}}
</div>
<div class="content">
- <form method="POST" action="{{.Issue.Link}}/dependency/delete" id="removeDependencyForm">
+ <form method="post" action="{{.Issue.Link}}/dependency/delete" id="removeDependencyForm">
{{$.CsrfTokenHtml}}
<input type="hidden" value="" name="removeDependencyID" id="removeDependencyID">
<input type="hidden" value="" name="dependencyType" id="dependencyType">
@@ -556,7 +556,7 @@
<div class="ui divider"></div>
{{if or .PinEnabled .Issue.IsPinned}}
- <form class="gt-mt-2" method="POST" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{.locale.Tr "repo.issues.max_pinned"}}"{{end}}>
+ <form class="gt-mt-2" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{.locale.Tr "repo.issues.max_pinned"}}"{{end}}>
{{$.CsrfTokenHtml}}
<button class="fluid ui button {{if not $.NewPinAllowed}}disabled{{end}}">
{{if not .Issue.IsPinned}}