mirror of
https://github.com/go-gitea/gitea
synced 2025-08-06 09:38:21 +00:00
Introduce flex-list
& flex-item
elements for Gitea UI (#25790)
This PR introduces a new UI element type for Gitea called `flex-item`. It consists of a horizontal card with a leading, main and trailing part:  The idea behind it is that in Gitea UI, we have many cases where we use this kind of layout, but it is achieved in many different ways: - grid layout - `.ui.list` with additional hacky flexbox - `.ui.key.list` - looks to me like a style set originally created for ssh/gpg key list, was used in many other places - `.issue.list` - created for issue cards, used in many other places - ... This new style is based on `.issue.list`, specifically the refactoring of it done in #25750. In this PR, the new element is introduced and lots of templates are being refactored to use that style. This allows to remove a lot of page-specific css, makes many of the elements responsive or simply provides a cleaner/better-looking way to present information. A devtest section with the new style is also available. <details> <summary>Screenshots (left: before, right: after)</summary>                    </details> --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
@@ -21,27 +21,35 @@
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="ui bottom attached table segment members">
|
||||
{{range .Team.Members}}
|
||||
<div class="item gt-df gt-ac gt-fw">
|
||||
<a href="{{.HomeLink}}">{{avatar $.Context . 48 "gt-mr-3 gt-mb-0"}}</a>
|
||||
<a class="gt-f1" href="{{.HomeLink}}">
|
||||
<strong>{{.DisplayName}}</strong>
|
||||
</a>
|
||||
{{if and $.IsOrganizationOwner (not (and ($.Team.IsOwnerTeam) (eq (len $.Team.Members) 1)))}}
|
||||
<form>
|
||||
<button class="ui red button delete-button" data-modal-id="remove-team-member"
|
||||
data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/remove" data-datauid="{{.ID}}"
|
||||
data-name="{{.DisplayName}}"
|
||||
data-data-team-name="{{$.Team.Name}}">{{$.locale.Tr "org.members.remove"}}</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="item">
|
||||
<span class="text grey italic">{{$.locale.Tr "org.teams.members.none"}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="ui attached segment">
|
||||
<div class="flex-list">
|
||||
{{range .Team.Members}}
|
||||
<div class="flex-item flex-item-center">
|
||||
<div class="flex-item-leading">
|
||||
<a href="{{.HomeLink}}">{{avatar $.Context . 32}}</a>
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<div class="flex-item-title">
|
||||
{{template "shared/user/name" .}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-item-trailing">
|
||||
{{if and $.IsOrganizationOwner (not (and ($.Team.IsOwnerTeam) (eq (len $.Team.Members) 1)))}}
|
||||
<form>
|
||||
<button class="ui red button delete-button" data-modal-id="remove-team-member"
|
||||
data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/remove" data-datauid="{{.ID}}"
|
||||
data-name="{{.DisplayName}}"
|
||||
data-data-team-name="{{$.Team.Name}}">{{$.locale.Tr "org.members.remove"}}</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="flex-item">
|
||||
<span class="text grey italic">{{$.locale.Tr "org.teams.members.none"}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{if and .Invites $.IsOrganizationOwner}}
|
||||
<h4 class="ui top attached header">{{$.locale.Tr "org.teams.invite_team_member.list"}}</h4>
|
||||
|
@@ -25,33 +25,38 @@
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="ui bottom attached table segment repositories">
|
||||
{{range .Team.Repos}}
|
||||
<div class="item gt-df gt-ac gt-fw">
|
||||
{{if .IsPrivate}}
|
||||
{{svg "octicon-lock" 16 "gt-mr-3"}}
|
||||
{{else if .IsFork}}
|
||||
{{svg "octicon-repo-forked" 16 "gt-mr-3"}}
|
||||
{{else if .IsMirror}}
|
||||
{{svg "octicon-mirror" 16 "gt-mr-3"}}
|
||||
{{else}}
|
||||
{{svg "octicon-repo" 16 "gt-mr-3"}}
|
||||
{{end}}
|
||||
<a class="member gt-f1" href="{{$.Org.HomeLink}}/{{.Name | PathEscape}}">
|
||||
<strong>{{$.Org.Name}}/{{.Name}}</strong>
|
||||
</a>
|
||||
{{if $canAddRemove}}
|
||||
<form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/remove">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<button type="submit" class="ui red small button right" name="repoid" value="{{.ID}}">{{$.locale.Tr "remove"}}</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="item">
|
||||
<span class="text grey italic">{{$.locale.Tr "org.teams.repos.none"}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="ui attached segment">
|
||||
<div class="flex-list">
|
||||
{{range .Team.Repos}}
|
||||
<div class="flex-item flex-item-center">
|
||||
<div class="flex-item-leading">
|
||||
{{$avatar := (repoAvatar . 32)}}
|
||||
{{if $avatar}}
|
||||
{{$avatar}}
|
||||
{{else}}
|
||||
{{template "repo/icon" .}}
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<a class="flex-item-title text primary" href="{{$.Org.HomeLink}}/{{.Name | PathEscape}}">
|
||||
{{$.Org.Name}}/{{.Name}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex-item-trailing">
|
||||
{{if $canAddRemove}}
|
||||
<form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/remove">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<button type="submit" class="ui red small button right" name="repoid" value="{{.ID}}">{{$.locale.Tr "remove"}}</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="flex-item">
|
||||
<span class="text grey italic">{{$.locale.Tr "org.teams.repos.none"}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user