Add Gitea Profile Readmes (#23260)

Implements displaying a README.md file present in a users ```.profile```
repository on the users profile page. If no such repository/file is
present, the user's profile page remains unchanged.

Example of user with ```.profile/README.md```

![image](https://user-images.githubusercontent.com/34464552/222757202-5d53ac62-60d9-432f-b9e3-2537ffa91041.png)

Example of user without ```.profile/README.md```

![image](https://user-images.githubusercontent.com/34464552/222759972-576e058b-acd4-47ac-be33-38a7cb58cc81.png)

This pull request closes the feature request in #12233 

Special thanks to @techknowlogick for the help in the Gitea discord!

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
This commit is contained in:
Nicholas Pease 2023-05-09 01:57:24 -04:00 committed by GitHub
parent b6fc2cdf82
commit c090f87a8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 38 deletions

View file

@ -1,6 +1,7 @@
<!-- TODO: make template org and user can share -->
{{with .ContextUser}}
<div class="ui container">
{{if or (.IsPackagesPage) (.PageIsViewProjects)}}
{{with .ContextUser}}
<div class="ui container">
<div class="ui vertically grid head">
<div class="column">
<div class="ui header">
@ -14,11 +15,17 @@
</div>
</div>
</div>
{{end}}
{{end}}
<div class="ui tabs container">
<div class="ui secondary stackable pointing menu">
<a class="item" href="{{.ContextUser.HomeLink}}">
{{if .ProfileReadme}}
<a class='{{if or (eq .TabName "overview") (and (eq .TabName "") (not .IsPackagesPage) (not .PageIsViewProjects))}}active {{end}}item' href="{{.ContextUser.HomeLink}}?tab=overview">
{{svg "octicon-info"}} {{.locale.Tr "user.overview"}}
</a>
{{end}}
<a class="{{if or (eq .TabName "repositories") (and (eq .TabName "") (not .IsPackagesPage) (not .PageIsViewProjects) (not .ProfileReadme))}}active {{end}} item" href="{{.ContextUser.HomeLink}}?tab=repositories">
{{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}}
{{if .ContextUser.NumRepos}}
<div class="ui small label">{{.ContextUser.NumRepos}}</div>