Fix comment form orphan tag issue with lint

This commit is contained in:
RedCocoon 2024-10-31 00:08:47 +08:00
parent 5ba8ae10fc
commit fddda21ea2
2 changed files with 28 additions and 25 deletions

View File

@ -11,34 +11,13 @@
<div class="ui segment"> <div class="ui segment">
{{if .IsIssue}} {{if .IsIssue}}
<form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post"> <form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
{{template "repo/conversation/comment_form_content" .}}
</form>
{{else}} {{else}}
<form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/conversations/{{.Conversation.Index}}/comments" method="post"> <form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/conversations/{{.Conversation.Index}}/comments" method="post">
{{end}} {{template "repo/conversation/comment_form_content" .}}
{{template "repo/conversation/comment_tab" .}}
{{.CsrfTokenHtml}}
<div class="field footer">
<div class="text right">
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
{{if and .IsIssue .Issue.IsClosed}}
<button id="status-button" class="ui primary basic button" data-status="{{ctx.Locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.reopen_comment_issue"}}" name="status" value="reopen">
{{ctx.Locale.Tr "repo.issues.reopen_issue"}}
</button>
{{else}}
{{$closeTranslationKey := "repo.issues.close"}}
{{if and .IsIssue .Issue.IsPull}}
{{$closeTranslationKey = "repo.pulls.close"}}
{{end}}
<button id="status-button" class="ui red basic button" data-status="{{ctx.Locale.Tr $closeTranslationKey}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.close_comment_issue"}}" name="status" value="close">
{{ctx.Locale.Tr $closeTranslationKey}}
</button>
{{end}}
{{end}}
<button id="comment-button" class="ui primary button">
{{ctx.Locale.Tr "repo.issues.create_comment"}}
</button>
</div>
</div>
</form> </form>
{{end}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,24 @@
{{template "repo/conversation/comment_tab" .}}
{{.CsrfTokenHtml}}
<div class="field footer">
<div class="text right">
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
{{if and .IsIssue .Issue.IsClosed}}
<button id="status-button" class="ui primary basic button" data-status="{{ctx.Locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.reopen_comment_issue"}}" name="status" value="reopen">
{{ctx.Locale.Tr "repo.issues.reopen_issue"}}
</button>
{{else}}
{{$closeTranslationKey := "repo.issues.close"}}
{{if and .IsIssue .Issue.IsPull}}
{{$closeTranslationKey = "repo.pulls.close"}}
{{end}}
<button id="status-button" class="ui red basic button" data-status="{{ctx.Locale.Tr $closeTranslationKey}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.close_comment_issue"}}" name="status" value="close">
{{ctx.Locale.Tr $closeTranslationKey}}
</button>
{{end}}
{{end}}
<button id="comment-button" class="ui primary button">
{{ctx.Locale.Tr "repo.issues.create_comment"}}
</button>
</div>
</div>