loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve show role (#26621)

Add a general show role template.

authored by

yp05327 and committed by
GitHub
bd8a2532 7934602a

+23 -61
+1 -12
templates/repo/issue/view_content.tmpl
··· 44 44 {{end}} 45 45 </div> 46 46 <div class="comment-header-right actions gt-df gt-ac"> 47 - {{if gt .Issue.ShowRole 0}} 48 - {{if (.Issue.ShowRole.HasRole "Writer")}} 49 - <div class="ui basic label role-label"> 50 - {{$.locale.Tr "repo.issues.collaborator"}} 51 - </div> 52 - {{end}} 53 - {{if (.Issue.ShowRole.HasRole "Owner")}} 54 - <div class="ui basic label role-label"> 55 - {{$.locale.Tr "repo.issues.owner"}} 56 - </div> 57 - {{end}} 58 - {{end}} 47 + {{template "repo/issue/view_content/show_role" dict "ShowRole" .Issue.ShowRole "IgnorePoster" true}} 59 48 {{if not $.Repository.IsArchived}} 60 49 {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} 61 50 {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
+7 -49
templates/repo/issue/view_content/comments.tmpl
··· 50 50 {{end}} 51 51 </div> 52 52 <div class="comment-header-right actions gt-df gt-ac"> 53 - {{if (.ShowRole.HasRole "Poster")}} 54 - <div class="ui basic label"> 55 - {{$.locale.Tr "repo.issues.poster"}} 56 - </div> 57 - {{end}} 58 - {{if (.ShowRole.HasRole "Writer")}} 59 - <div class="ui basic label"> 60 - {{$.locale.Tr "repo.issues.collaborator"}} 61 - </div> 62 - {{end}} 63 - {{if (.ShowRole.HasRole "Owner")}} 64 - <div class="ui basic label"> 65 - {{$.locale.Tr "repo.issues.owner"}} 66 - </div> 67 - {{end}} 53 + {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} 68 54 {{if not $.Repository.IsArchived}} 69 55 {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} 70 56 {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} ··· 442 428 </span> 443 429 </div> 444 430 <div class="comment-header-right actions gt-df gt-ac"> 445 - {{if (.ShowRole.HasRole "Poster")}} 446 - <div class="ui basic label"> 447 - {{$.locale.Tr "repo.issues.poster"}} 448 - </div> 449 - {{end}} 450 - {{if (.ShowRole.HasRole "Writer")}} 451 - <div class="ui basic label"> 452 - {{$.locale.Tr "repo.issues.collaborator"}} 453 - </div> 454 - {{end}} 455 - {{if (.ShowRole.HasRole "Owner")}} 456 - <div class="ui basic label"> 457 - {{$.locale.Tr "repo.issues.owner"}} 458 - </div> 459 - {{end}} 460 - {{if not $.Repository.IsArchived}} 461 - {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} 462 - {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} 463 - {{end}} 431 + {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} 432 + {{if not $.Repository.IsArchived}} 433 + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} 434 + {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} 435 + {{end}} 464 436 </div> 465 437 </div> 466 438 <div class="ui attached segment comment-body"> ··· 567 539 </span> 568 540 </div> 569 541 <div class="comment-header-right actions gt-df gt-ac"> 570 - {{if (.ShowRole.HasRole "Poster")}} 571 - <div class="ui basic label"> 572 - {{$.locale.Tr "repo.issues.poster"}} 573 - </div> 574 - {{end}} 575 - {{if (.ShowRole.HasRole "Writer")}} 576 - <div class="ui basic label"> 577 - {{$.locale.Tr "repo.issues.collaborator"}} 578 - </div> 579 - {{end}} 580 - {{if (.ShowRole.HasRole "Owner")}} 581 - <div class="ui basic label"> 582 - {{$.locale.Tr "repo.issues.owner"}} 583 - </div> 584 - {{end}} 542 + {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} 585 543 {{if not $.Repository.IsArchived}} 586 544 {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} 587 545 {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
+15
templates/repo/issue/view_content/show_role.tmpl
··· 1 + {{if and (.ShowRole.HasRole "Poster") (not .IgnorePoster)}} 2 + <div class="ui basic label role-label"> 3 + {{ctx.Locale.Tr "repo.issues.poster"}} 4 + </div> 5 + {{end}} 6 + {{if (.ShowRole.HasRole "Writer")}} 7 + <div class="ui basic label role-label"> 8 + {{ctx.Locale.Tr "repo.issues.collaborator"}} 9 + </div> 10 + {{end}} 11 + {{if (.ShowRole.HasRole "Owner")}} 12 + <div class="ui basic label role-label"> 13 + {{ctx.Locale.Tr "repo.issues.owner"}} 14 + </div> 15 + {{end}}