code.gitea.io/gitea@v1.22.3/templates/repo/issue/view_content.tmpl (about) 1 <div class="issue-content"> 2 <!-- I know, there is probably a better way to do this (moved from sidebar.tmpl, original author: 6543 @ 2021-02-28) --> 3 <!-- Agree, there should be a better way, eg: introduce window.config.pageData (original author: wxiaoguang @ 2021-09-05) --> 4 <input type="hidden" id="repolink" value="{{$.RepoRelPath}}"> 5 <input type="hidden" id="repoId" value="{{.Repository.ID}}"> 6 <input type="hidden" id="issueIndex" value="{{.Issue.Index}}"> 7 <input type="hidden" id="type" value="{{.IssueType}}"> 8 9 {{$createdStr:= TimeSinceUnix .Issue.CreatedUnix ctx.Locale}} 10 <div class="issue-content-left comment-list prevent-before-timeline"> 11 <div class="ui timeline"> 12 <div id="{{.Issue.HashTag}}" class="timeline-item comment first"> 13 {{if .Issue.OriginalAuthor}} 14 <span class="timeline-avatar"> 15 {{ctx.AvatarUtils.Avatar nil 40}} 16 </span> 17 {{else}} 18 <a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}> 19 {{ctx.AvatarUtils.Avatar .Issue.Poster 40}} 20 </a> 21 {{end}} 22 <div class="content comment-container"> 23 <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between" role="heading" aria-level="3"> 24 <div class="comment-header-left tw-flex tw-items-center"> 25 {{if .Issue.OriginalAuthor}} 26 <span class="text black tw-font-semibold"> 27 {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}} 28 {{.Issue.OriginalAuthor}} 29 </span> 30 <span class="text grey muted-links"> 31 {{ctx.Locale.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr}} 32 </span> 33 <span class="text migrate"> 34 {{if .Repository.OriginalURL}} ({{ctx.Locale.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname}}){{end}} 35 </span> 36 {{else}} 37 <a class="inline-timeline-avatar" href="{{.Issue.Poster.HomeLink}}"> 38 {{ctx.AvatarUtils.Avatar .Issue.Poster 24}} 39 </a> 40 <span class="text grey muted-links"> 41 {{template "shared/user/authorlink" .Issue.Poster}} 42 {{ctx.Locale.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr}} 43 </span> 44 {{end}} 45 </div> 46 <div class="comment-header-right actions tw-flex tw-items-center"> 47 {{template "repo/issue/view_content/show_role" dict "ShowRole" .Issue.ShowRole "IgnorePoster" true}} 48 {{if not $.Repository.IsArchived}} 49 {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} 50 {{end}} 51 {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}} 52 </div> 53 </div> 54 <div class="ui attached segment comment-body" role="article"> 55 <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}data-can-edit="true"{{end}}> 56 {{if .Issue.RenderedContent}} 57 {{.Issue.RenderedContent}} 58 {{else}} 59 <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> 60 {{end}} 61 </div> 62 <div id="issue-{{.Issue.ID}}-raw" class="raw-content tw-hidden">{{.Issue.Content}}</div> 63 <div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div> 64 {{if .Issue.Attachments}} 65 {{template "repo/issue/view_content/attachments" dict "Attachments" .Issue.Attachments "RenderedContent" .Issue.RenderedContent}} 66 {{end}} 67 </div> 68 {{$reactions := .Issue.Reactions.GroupByType}} 69 {{if $reactions}} 70 {{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} 71 {{end}} 72 </div> 73 </div> 74 75 {{template "repo/issue/view_content/comments" .}} 76 77 {{if and .Issue.IsPull (not $.Repository.IsArchived)}} 78 {{template "repo/issue/view_content/pull".}} 79 {{end}} 80 81 {{if .IsSigned}} 82 {{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}} 83 <div class="timeline-item comment form"> 84 <a class="timeline-avatar" href="{{.SignedUser.HomeLink}}"> 85 {{ctx.AvatarUtils.Avatar .SignedUser 40}} 86 </a> 87 <div class="content"> 88 <div class="ui segment"> 89 <form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post"> 90 {{template "repo/issue/comment_tab" .}} 91 {{.CsrfTokenHtml}} 92 <div class="field footer"> 93 <div class="text right"> 94 {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}} 95 {{if .Issue.IsClosed}} 96 <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"> 97 {{ctx.Locale.Tr "repo.issues.reopen_issue"}} 98 </button> 99 {{else}} 100 {{$closeTranslationKey := "repo.issues.close"}} 101 {{if .Issue.IsPull}} 102 {{$closeTranslationKey = "repo.pulls.close"}} 103 {{end}} 104 <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"> 105 {{ctx.Locale.Tr $closeTranslationKey}} 106 </button> 107 {{end}} 108 {{end}} 109 <button class="ui primary button"> 110 {{ctx.Locale.Tr "repo.issues.create_comment"}} 111 </button> 112 </div> 113 </div> 114 </form> 115 </div> 116 </div> 117 </div> 118 {{else if .Repository.IsArchived}} 119 <div class="ui warning message tw-text-center"> 120 {{if .Issue.IsPull}} 121 {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} 122 {{else}} 123 {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} 124 {{end}} 125 </div> 126 {{end}} 127 {{else}} {{/* not .IsSigned */}} 128 {{if .Repository.IsArchived}} 129 <div class="ui warning message tw-text-center"> 130 {{if .Issue.IsPull}} 131 {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} 132 {{else}} 133 {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} 134 {{end}} 135 </div> 136 {{else}} 137 <div class="ui warning message"> 138 {{ctx.Locale.Tr "repo.issues.sign_in_require_desc" .SignInLink}} 139 </div> 140 {{end}} 141 {{end}}{{/* end if: .IsSigned */}} 142 </div> 143 </div> 144 145 {{template "repo/issue/view_content/sidebar" .}} 146 </div> 147 148 <template id="issue-comment-editor-template"> 149 <div class="ui form comment"> 150 <div class="field"> 151 {{template "shared/combomarkdowneditor" (dict 152 "MarkdownPreviewUrl" (print .Repository.Link "/markup") 153 "MarkdownPreviewContext" .RepoLink 154 "TextareaName" "content" 155 "DropzoneParentContainer" ".ui.form" 156 )}} 157 </div> 158 159 {{if .IsAttachmentEnabled}} 160 <div class="field"> 161 {{template "repo/upload" .}} 162 </div> 163 {{end}} 164 165 <div class="field"> 166 <div class="text right edit"> 167 <button class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> 168 <button class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button> 169 </div> 170 </div> 171 </div> 172 </template> 173 174 {{template "repo/issue/view_content/reference_issue_dialog" .}} 175 {{template "shared/user/block_user_dialog" .}} 176 177 <div class="tw-hidden" id="no-content"> 178 <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> 179 </div> 180 181 <div class="ui g-modal-confirm delete modal"> 182 <div class="header"> 183 {{svg "octicon-trash"}} 184 {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}} 185 </div> 186 <div class="content"> 187 <p>{{ctx.Locale.Tr "repo.branch.delete_desc"}}</p> 188 </div> 189 {{template "base/modal_actions_confirm" .}} 190 </div>