diff options
author | silverwind <me@silverwind.io> | 2020-11-12 06:55:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-12 07:55:34 +0200 |
commit | 4117a443c27cc5b8af75be32ed6949d028694eff (patch) | |
tree | e76c2423c95e7030a6afc73a479d1c44fc5cbf75 /templates | |
parent | 6838bacc4c5e7c8742dc009ad63eafb0b0201f9c (diff) | |
download | gitea-4117a443c27cc5b8af75be32ed6949d028694eff.tar.gz gitea-4117a443c27cc5b8af75be32ed6949d028694eff.zip |
Lazy-load issue reviewers and assignees avatars (#13526)
The avatars inside the dropdowns were previously fetched every time a
Pull Request was opened resulting in potential unnecessary downloads.
This lazy-loads through the newish loading=lazy attribute.
Also did a few minor adjustments on the file.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 4165ba49e6..dd4dadca51 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -26,7 +26,8 @@ <a class="{{if not .CanChange}}ui poping up{{end}} item {{if .Checked}} checked {{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-content="{{$.i18n.Tr "repo.issues.remove_request_review_block"}}"{{end}}> <span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check"}}</span> <span class="text"> - <img class="ui avatar image" src="{{.User.RelAvatarLink}}"> {{.User.GetDisplayName}} + <img class="ui avatar image mr-2" loading="lazy" src="{{.User.RelAvatarLink}}"> + {{.User.GetDisplayName}} </span> </a> {{end}} @@ -52,9 +53,12 @@ <span class="no-select item {{if or .OriginalReviews .PullReviewers}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_reviewers"}}</span> <div class="selected"> {{range .PullReviewers}} - <div class="item" style="margin-bottom: 10px;"> + <div class="item mb-2"> {{if .User}} - <a href="{{.User.HomeLink}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"> {{.User.GetDisplayName}}</a> + <a href="{{.User.HomeLink}}"> + <img class="ui avatar image mr-2" src="{{.User.RelAvatarLink}}"> + {{.User.GetDisplayName}} + </a> {{else if .Team}} <span class="text">{{svg "octicon-people" 16 "teamavatar"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}</span> {{end}} @@ -253,11 +257,7 @@ {{range .Assignees}} {{$AssigneeID := .ID}} - <a class="item{{range $.Issue.Assignees}} - {{if eq .ID $AssigneeID}} - checked - {{end}} - {{end}}" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}"> + <a class="item{{range $.Issue.Assignees}}{{if eq .ID $AssigneeID}} checked{{end}}{{end}}" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}"> {{$checked := false}} {{range $.Issue.Assignees}} {{if eq .ID $AssigneeID}} @@ -266,7 +266,8 @@ {{end}} <span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check"}}</span> <span class="text"> - <img class="ui avatar image" src="{{.RelAvatarLink}}"> {{.GetDisplayName}} + <img class="ui avatar image mr-2" loading="lazy" src="{{.RelAvatarLink}}"> + {{.GetDisplayName}} </span> </a> {{end}} @@ -277,7 +278,10 @@ <div class="selected"> {{range .Issue.Assignees}} <div class="item" style="margin-bottom: 10px;"> - <a href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?assignee={{.ID}}"><img class="ui avatar image" src="{{.RelAvatarLink}}"> {{.GetDisplayName}}</a> + <a href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> + <img class="ui avatar image mr-2" src="{{.RelAvatarLink}}"> + {{.GetDisplayName}} + </a> </div> {{end}} </div> |