Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Aug 31, 2023
1 parent 87ed3ba commit cad517a
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 14 deletions.
10 changes: 9 additions & 1 deletion templates/devtest/flex-list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="page-content devtest">
<div class="ui container">
<h1>Flex List (standalone)</h1>
<div class="ui divider"></div>
<div class="divider"></div>
<div class="flex-list">
<div class="flex-item">
<div class="flex-item-leading">
Expand Down Expand Up @@ -102,6 +102,14 @@
<div class="flex-item">item 2</div>
</div>
</div>

<h1>If parent provides the padding/margin space:</h1>
<div class="gt-border-secondary gt-py-4">
<div class="flex-list flex-space-fitted">
<div class="flex-item">item 1 (no padding top)</div>
<div class="flex-item">item 2 (no padding bottom)</div>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}
6 changes: 4 additions & 2 deletions templates/package/shared/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
<div class="{{if .PackageDescriptors}}flex-list{{end}} gt-pt-4">
<div>
{{range .PackageDescriptors}}
<div class="flex-list">
<div class="flex-item">
<div class="flex-item-main">
<div class="flex-item-title">
Expand All @@ -34,6 +35,7 @@
</div>
</div>
</div>
</div>
{{else}}
{{if not .HasPackages}}
<div class="empty center">
Expand All @@ -46,7 +48,7 @@
<p>{{.locale.Tr "packages.empty.documentation" "https://docs.gitea.com/usage/packages/overview/" | Safe}}</p>
</div>
{{else}}
<p>{{.locale.Tr "packages.filter.no_result"}}</p>
<p class="gt-py-4">{{.locale.Tr "packages.filter.no_result"}}</p>
{{end}}
{{end}}
{{template "base/paginate" .}}
Expand Down
6 changes: 4 additions & 2 deletions templates/package/shared/versionlist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
<button class="ui primary button">{{.locale.Tr "explore.search"}}</button>
</div>
</form>
<div class="{{if .PackageDescriptors}}flex-list{{end}} gt-pt-4">
<div>
{{range .PackageDescriptors}}
<div class="flex-list">
<div class="flex-item">
<div class="flex-item-main">
<a class="flex-item-title" href="{{.FullWebLink}}">{{.Version.LowerVersion}}</a>
Expand All @@ -28,8 +29,9 @@
</div>
</div>
</div>
</div>
{{else}}
<p>{{.locale.Tr "packages.filter.no_result"}}</p>
<p class="gt-py-4">{{.locale.Tr "packages.filter.no_result"}}</p>
{{end}}
{{template "base/paginate" .}}
</div>
2 changes: 1 addition & 1 deletion templates/repo/actions/runs_list.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="flex-list gt-m-0">
<div class="flex-list">
{{if eq (len .Runs) 0}}
<div class="empty center">
{{svg "octicon-no-entry" 48}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/settings/deploy_keys.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
</h4>
<div class="ui attached segment">
<div class="{{if not .HasError}}gt-hidden{{end}} gt-mb-4" id="add-deploy-key-panel">
<div class="{{if not .HasError}}gt-hidden{{end}}" id="add-deploy-key-panel">
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="field">
Expand Down
2 changes: 1 addition & 1 deletion templates/shared/issuelist.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="issue-list" class="flex-list gt-pt-4">
<div id="issue-list" class="flex-list">
{{$approvalCounts := .ApprovalCounts}}
{{range .Issues}}
<div class="flex-item flex-item-baseline">
Expand Down
2 changes: 1 addition & 1 deletion templates/user/settings/keys_gpg.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
</h4>
<div class="ui attached segment">
<div class="{{if not .HasGPGError}}gt-hidden{{end}} gt-mb-4" id="add-gpg-key-panel">
<div class="{{if not .HasGPGError}}gt-hidden{{end}}" id="add-gpg-key-panel">
<form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="title" value="none">
Expand Down
2 changes: 1 addition & 1 deletion templates/user/settings/keys_ssh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
</h4>
<div class="ui attached segment">
<div class="{{if not .HasSSHError}}gt-hidden{{end}} gt-mb-4" id="add-ssh-key-panel">
<div class="{{if not .HasSSHError}}gt-hidden{{end}}" id="add-ssh-key-panel">
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="field {{if .Err_Title}}error{{end}}">
Expand Down
20 changes: 16 additions & 4 deletions web_src/css/shared/flex-list.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,23 @@
border-top: 1px solid var(--color-secondary);
}

/* remove padding on first and last child so it better fits into .ui.segment or
when preceded or followed by a .ui.divider */
.flex-list > .flex-item:first-child {
/* Fomantic UI segment has default "padding: 1em", so here it removes the padding-top and padding-bottom accordingly.
Developers could also use "flex-space-fitted" class to remove the first item's padding-top and the last item's padding-bottom */
.flex-list.flex-space-fitted > .flex-item:first-child,
.ui.segment > .flex-list:first-child > .flex-item:first-child {
padding-top: 0;
}
.flex-list > .flex-item:last-child {

.flex-list.flex-space-fitted > .flex-item:last-child,
.ui.segment > .flex-list:last-child > .flex-item:last-child {
padding-bottom: 0;
}

/* If there is a divider besides the flex-list, some padding/margin are not needs */
.divider + .flex-list > .flex-item:first-child {
padding-top: 0;
}

.flex-list + .divider {
margin-top: 0;
}

0 comments on commit cad517a

Please sign in to comment.