Skip to content

Commit ce73492

Browse files
authored
Refactor ctx in templates (#23105)
Before, the `dict "ctx" ...` map is used to pass data between templates. Now, more and more templates need to use real Go context: * #22962 * #23092 `ctx` is a Go concept for `Context`, misusing it may cause problems, and it makes it difficult to review or refactor. This PR contains 2 major changes: * In the top scope of a template, the `$` is the same as the `.`, so the old labels_sidebar's `root` is the `ctx`. So this `ctx` could just be removed. bd7f218 * Rename all other `ctx` to `ctxData`, and it perfectly matches how it comes from backend: `"ctxData": ctx.Data`. 7c01260 From now on, there is no `ctx` in templates. There are only: * `ctxData` for passing data * `Context` for Go context
1 parent 0a9a3c2 commit ce73492

12 files changed

+51
-51
lines changed

routers/web/repo/issue.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2952,7 +2952,7 @@ func ChangeIssueReaction(ctx *context.Context) {
29522952
}
29532953

29542954
html, err := ctx.RenderToString(tplReactions, map[string]interface{}{
2955-
"ctx": ctx.Data,
2955+
"ctxData": ctx.Data,
29562956
"ActionURL": fmt.Sprintf("%s/issues/%d/reactions", ctx.Repo.RepoLink, issue.Index),
29572957
"Reactions": issue.Reactions.GroupByType(),
29582958
})
@@ -3054,7 +3054,7 @@ func ChangeCommentReaction(ctx *context.Context) {
30543054
}
30553055

30563056
html, err := ctx.RenderToString(tplReactions, map[string]interface{}{
3057-
"ctx": ctx.Data,
3057+
"ctxData": ctx.Data,
30583058
"ActionURL": fmt.Sprintf("%s/comments/%d/reactions", ctx.Repo.RepoLink, comment.ID),
30593059
"Reactions": comment.Reactions.GroupByType(),
30603060
})
@@ -3176,7 +3176,7 @@ func updateAttachments(ctx *context.Context, item interface{}, files []string) e
31763176

31773177
func attachmentsHTML(ctx *context.Context, attachments []*repo_model.Attachment, content string) string {
31783178
attachHTML, err := ctx.RenderToString(tplAttachment, map[string]interface{}{
3179-
"ctx": ctx.Data,
3179+
"ctxData": ctx.Data,
31803180
"Attachments": attachments,
31813181
"Content": content,
31823182
})

templates/repo/diff/comments.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
</div>
4343
{{end}}
4444
{{end}}
45-
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}}
46-
{{template "repo/issue/view_content/context_menu" Dict "ctx" $.root "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}
45+
{{template "repo/issue/view_content/add_reaction" Dict "ctxData" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}}
46+
{{template "repo/issue/view_content/context_menu" Dict "ctxData" $.root "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}
4747
</div>
4848
</div>
4949
<div class="ui attached segment comment-body">
@@ -60,7 +60,7 @@
6060
{{$reactions := .Reactions.GroupByType}}
6161
{{if $reactions}}
6262
<div class="ui attached segment reactions">
63-
{{template "repo/issue/view_content/reactions" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}}
63+
{{template "repo/issue/view_content/reactions" Dict "ctxData" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}}
6464
</div>
6565
{{end}}
6666
</div>

templates/repo/issue/labels/labels_sidebar.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div class="ui labels list">
2-
<span class="no-select item {{if .ctx.HasSelectedLabel}}gt-hidden{{end}}">{{.ctx.locale.Tr "repo.issues.new.no_label"}}</span>
2+
<span class="no-select item {{if .root.HasSelectedLabel}}gt-hidden{{end}}">{{.root.locale.Tr "repo.issues.new.no_label"}}</span>
33
<span class="labels-list">
4-
{{range .ctx.Labels}}
4+
{{range .root.Labels}}
55
{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
66
{{end}}
7-
{{range .ctx.OrgLabels}}
7+
{{range .root.OrgLabels}}
88
{{template "repo/issue/labels/label" dict "root" $.root "label" .}}
99
{{end}}
1010
</span>

templates/repo/issue/new_form.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
{{end}}
8181
</div>
8282
</div>
83-
{{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}}
83+
{{template "repo/issue/labels/labels_sidebar" dict "root" $}}
8484

8585
<div class="ui divider"></div>
8686

templates/repo/issue/view_content.tmpl

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
{{end}}
6565
{{end}}
6666
{{if not $.Repository.IsArchived}}
67-
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
68-
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
67+
{{template "repo/issue/view_content/add_reaction" Dict "ctxData" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
68+
{{template "repo/issue/view_content/context_menu" Dict "ctxData" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
6969
{{end}}
7070
</div>
7171
</div>
@@ -80,13 +80,13 @@
8080
<div id="issue-{{.Issue.ID}}-raw" class="raw-content gt-hidden">{{.Issue.Content}}</div>
8181
<div class="edit-content-zone gt-hidden" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" 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>
8282
{{if .Issue.Attachments}}
83-
{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}}
83+
{{template "repo/issue/view_content/attachments" Dict "ctxData" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}}
8484
{{end}}
8585
</div>
8686
{{$reactions := .Issue.Reactions.GroupByType}}
8787
{{if $reactions}}
8888
<div class="ui attached segment reactions" role="note">
89-
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
89+
{{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
9090
</div>
9191
{{end}}
9292
</div>

templates/repo/issue/view_content/add_reaction.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
{{if .ctx.IsSigned}}
1+
{{if .ctxData.IsSigned}}
22
<div class="item action ui pointing select-reaction dropdown top right" data-action-url="{{.ActionURL}}">
33
<a class="add-reaction">
44
{{svg "octicon-smiley"}}
55
</a>
66
<div class="menu">
7-
<div class="header">{{.ctx.locale.Tr "repo.pick_reaction"}}</div>
7+
<div class="header">{{.ctxData.locale.Tr "repo.pick_reaction"}}</div>
88
<div class="divider"></div>
99
{{range $value := AllowedReactions}}
1010
<a class="item reaction tooltip" data-content="{{$value}}">{{ReactionToEmoji $value}}</a>

templates/repo/issue/view_content/attachments.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{{$hasThumbnails := false}}
77
{{- range .Attachments -}}
88
<div class="twelve wide column" style="padding: 6px;">
9-
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
9+
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title='{{$.ctxData.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
1010
{{if FilenameIsImage .Name}}
1111
{{if not (containGeneric $.Content .UUID)}}
1212
{{$hasThumbnails = true}}
@@ -31,7 +31,7 @@
3131
{{if FilenameIsImage .Name}}
3232
{{if not (containGeneric $.Content .UUID)}}
3333
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
34-
<img src="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
34+
<img src="{{.DownloadURL}}" title='{{$.ctxData.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
3535
</a>
3636
{{end}}
3737
{{end}}

templates/repo/issue/view_content/comments.tmpl

+13-13
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
</div>
6565
{{end}}
6666
{{if not $.Repository.IsArchived}}
67-
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
68-
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
67+
{{template "repo/issue/view_content/add_reaction" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
68+
{{template "repo/issue/view_content/context_menu" Dict "ctxData" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
6969
{{end}}
7070
</div>
7171
</div>
@@ -80,13 +80,13 @@
8080
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
8181
<div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
8282
{{if .Attachments}}
83-
{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
83+
{{template "repo/issue/view_content/attachments" Dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}}
8484
{{end}}
8585
</div>
8686
{{$reactions := .Reactions.GroupByType}}
8787
{{if $reactions}}
8888
<div class="ui attached segment reactions" role="note">
89-
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
89+
{{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
9090
</div>
9191
{{end}}
9292
</div>
@@ -260,7 +260,7 @@
260260
{{template "shared/user/authorlink" .Poster}}
261261
{{$.locale.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}
262262
</span>
263-
{{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
263+
{{template "repo/issue/view_content/comments_delete_time" Dict "ctxData" $ "comment" .}}
264264
<div class="detail">
265265
{{svg "octicon-clock"}}
266266
<span class="text grey muted-links">{{.Content}}</span>
@@ -274,7 +274,7 @@
274274
{{template "shared/user/authorlink" .Poster}}
275275
{{$.locale.Tr "repo.issues.add_time_history" $createdStr | Safe}}
276276
</span>
277-
{{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
277+
{{template "repo/issue/view_content/comments_delete_time" Dict "ctxData" $ "comment" .}}
278278
<div class="detail">
279279
{{svg "octicon-clock"}}
280280
<span class="text grey muted-links">{{.Content}}</span>
@@ -436,8 +436,8 @@
436436
</div>
437437
{{end}}
438438
{{if not $.Repository.IsArchived}}
439-
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
440-
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
439+
{{template "repo/issue/view_content/add_reaction" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
440+
{{template "repo/issue/view_content/context_menu" Dict "ctxData" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
441441
{{end}}
442442
</div>
443443
</div>
@@ -452,13 +452,13 @@
452452
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
453453
<div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
454454
{{if .Attachments}}
455-
{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
455+
{{template "repo/issue/view_content/attachments" Dict "ctxData" $ "Attachments" .Attachments "Content" .RenderedContent}}
456456
{{end}}
457457
</div>
458458
{{$reactions := .Reactions.GroupByType}}
459459
{{if $reactions}}
460460
<div class="ui attached segment reactions">
461-
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
461+
{{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
462462
</div>
463463
{{end}}
464464
</div>
@@ -563,8 +563,8 @@
563563
</div>
564564
{{end}}
565565
{{if not $.Repository.IsArchived}}
566-
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
567-
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
566+
{{template "repo/issue/view_content/add_reaction" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
567+
{{template "repo/issue/view_content/context_menu" Dict "ctxData" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
568568
{{end}}
569569
</div>
570570
</div>
@@ -582,7 +582,7 @@
582582
{{$reactions := .Reactions.GroupByType}}
583583
{{if $reactions}}
584584
<div class="ui attached segment reactions">
585-
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
585+
{{template "repo/issue/view_content/reactions" Dict "ctxData" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
586586
</div>
587587
{{end}}
588588
</div>

templates/repo/issue/view_content/comments_delete_time.tmpl

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{{if .comment.Time}} {{/* compatibility with time comments made before v1.14 */}}
22
{{if (not .comment.Time.Deleted)}}
3-
{{if (or .ctx.IsAdmin (and .ctx.IsSigned (eq .ctx.SignedUserID .comment.PosterID)))}}
3+
{{if (or .ctxData.IsAdmin (and .ctxData.IsSigned (eq .ctxData.SignedUserID .comment.PosterID)))}}
44
<span class="ui float right">
55
<div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}">
6-
<form method="POST" class="delete-time-form" action="{{.ctx.RepoLink}}/issues/{{.ctx.Issue.Index}}/times/{{.comment.TimeID}}/delete">
7-
{{.ctx.CsrfTokenHtml}}
6+
<form method="POST" class="delete-time-form" action="{{.ctxData.RepoLink}}/issues/{{.ctxData.Issue.Index}}/times/{{.comment.TimeID}}/delete">
7+
{{.ctxData.CsrfTokenHtml}}
88
</form>
9-
<div class="header">{{.ctx.locale.Tr "repo.issues.del_time"}}</div>
9+
<div class="header">{{.ctxData.locale.Tr "repo.issues.del_time"}}</div>
1010
<div class="actions">
11-
<div class="ui red approve button">{{.ctx.locale.Tr "repo.issues.context.delete"}}</div>
12-
<div class="ui cancel button">{{.ctx.locale.Tr "repo.issues.add_time_cancel"}}</div>
11+
<div class="ui red approve button">{{.ctxData.locale.Tr "repo.issues.context.delete"}}</div>
12+
<div class="ui cancel button">{{.ctxData.locale.Tr "repo.issues.add_time_cancel"}}</div>
1313
</div>
1414
</div>
15-
<button class="ui icon button compact mini issue-delete-time tooltip" data-id="{{.comment.Time.ID}}" data-content="{{.ctx.locale.Tr "repo.issues.del_time"}}" data-position="top right">
15+
<button class="ui icon button compact mini issue-delete-time tooltip" data-id="{{.comment.Time.ID}}" data-content="{{.ctxData.locale.Tr "repo.issues.del_time"}}" data-position="top right">
1616
{{svg "octicon-trash"}}
1717
</button>
1818
</span>

templates/repo/issue/view_content/context_menu.tmpl

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
{{if .ctx.IsSigned}}
1+
{{if .ctxData.IsSigned}}
22
<div class="item action ui pointing custom dropdown top right context-dropdown">
33
<a class="context-menu">
44
{{svg "octicon-kebab-horizontal"}}
55
</a>
66
<div class="menu">
77
{{$referenceUrl := ""}}
88
{{if .issue}}
9-
{{$referenceUrl = Printf "%s#%s" .ctx.Issue.Link .item.HashTag}}
9+
{{$referenceUrl = Printf "%s#%s" .ctxData.Issue.Link .item.HashTag}}
1010
{{else}}
11-
{{$referenceUrl = Printf "%s/files#%s" .ctx.Issue.Link .item.HashTag}}
11+
{{$referenceUrl = Printf "%s/files#%s" .ctxData.Issue.Link .item.HashTag}}
1212
{{end}}
13-
<a class="item context" data-clipboard-text-type="url" data-clipboard-text="{{AppSubUrl}}{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.copy_link"}}</a>
14-
<a class="item context quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.HashTag}}-raw">{{.ctx.locale.Tr "repo.issues.context.quote_reply"}}</a>
15-
{{if not .ctx.UnitIssuesGlobalDisabled}}
16-
<a class="item context reference-issue" data-target="{{.item.HashTag}}-raw" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-poster-username="{{.item.Poster.Name}}" data-reference="{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.reference_issue"}}</a>
13+
<a class="item context" data-clipboard-text-type="url" data-clipboard-text="{{AppSubUrl}}{{$referenceUrl}}">{{.ctxData.locale.Tr "repo.issues.context.copy_link"}}</a>
14+
<a class="item context quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.HashTag}}-raw">{{.ctxData.locale.Tr "repo.issues.context.quote_reply"}}</a>
15+
{{if not .ctxData.UnitIssuesGlobalDisabled}}
16+
<a class="item context reference-issue" data-target="{{.item.HashTag}}-raw" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-poster-username="{{.item.Poster.Name}}" data-reference="{{$referenceUrl}}">{{.ctxData.locale.Tr "repo.issues.context.reference_issue"}}</a>
1717
{{end}}
18-
{{if or .ctx.Permission.IsAdmin .IsCommentPoster .ctx.HasIssuesOrPullsWritePermission}}
18+
{{if or .ctxData.Permission.IsAdmin .IsCommentPoster .ctxData.HasIssuesOrPullsWritePermission}}
1919
<div class="divider"></div>
20-
<a class="item context edit-content">{{.ctx.locale.Tr "repo.issues.context.edit"}}</a>
20+
<a class="item context edit-content">{{.ctxData.locale.Tr "repo.issues.context.edit"}}</a>
2121
{{if .delete}}
22-
<a class="item context delete-comment" data-comment-id={{.item.HashTag}} data-url="{{.ctx.RepoLink}}/comments/{{.item.ID}}/delete" data-locale="{{.ctx.locale.Tr "repo.issues.delete_comment_confirm"}}">{{.ctx.locale.Tr "repo.issues.context.delete"}}</a>
22+
<a class="item context delete-comment" data-comment-id={{.item.HashTag}} data-url="{{.ctxData.RepoLink}}/comments/{{.item.ID}}/delete" data-locale="{{.ctxData.locale.Tr "repo.issues.delete_comment_confirm"}}">{{.ctxData.locale.Tr "repo.issues.context.delete"}}</a>
2323
{{end}}
2424
{{end}}
2525
</div>
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{{range $key, $value := .Reactions}}
2-
<a class="ui label basic{{if $value.HasUser $.ctx.SignedUserID}} primary{{end}}{{if not $.ctx.IsSigned}} disabled{{end}}" data-title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{$.ctx.locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-content="{{$key}}" data-action-url="{{$.ActionURL}}">
2+
<a class="ui label basic{{if $value.HasUser $.ctxData.SignedUserID}} primary{{end}}{{if not $.ctxData.IsSigned}} disabled{{end}}" data-title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{$.ctxData.locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-content="{{$key}}" data-action-url="{{$.ActionURL}}">
33
<span class="reaction">{{ReactionToEmoji $key}}</span>
44
<span class="reaction-count">{{len $value}}</span>
55
</a>
66
{{end}}
77
{{if AllowedReactions}}
8-
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $.ctx "ActionURL" .ActionURL}}
8+
{{template "repo/issue/view_content/add_reaction" Dict "ctxData" $.ctxData "ActionURL" .ActionURL}}
99
{{end}}

templates/repo/issue/view_content/sidebar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
{{end}}
150150
</div>
151151
</div>
152-
{{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}}
152+
{{template "repo/issue/labels/labels_sidebar" dict "root" $}}
153153

154154
<div class="ui divider"></div>
155155

0 commit comments

Comments
 (0)