summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-06-14 13:21:48 -0400
committerGitHub <noreply@github.com>2023-06-14 13:21:48 -0400
commit5191ab64453e9e8a52f9e51ee65911b82fa516ec (patch)
tree97df064943db4924bc46f15dd12f2f3c8e055b3a /templates
parentbfd3eb9dbcdb7aee5ca640a0321ef93516a21a9c (diff)
downloadgitea-5191ab64453e9e8a52f9e51ee65911b82fa516ec.tar.gz
gitea-5191ab64453e9e8a52f9e51ee65911b82fa516ec.zip
Use flex to align SVG and text (#25163) (#25260)
Backport #25163 by @wxiaoguang The code can be as simple as: ```html <div class="flex-text-block">{{svg "octicon-alert"}} {{svg "octicon-x"}} text (block)</div> <div><div class="flex-text-inline">{{svg "octicon-alert"}} {{svg "octicon-x"}} text</div> (inline)</div> <div><button class="ui red button">{{svg "octicon-alert" 24}} {{svg "octicon-x" 24}} text</button></div> ``` ![image](https://github.com/go-gitea/gitea/assets/2114189/1d3c10f1-0bc7-4c26-b236-bad537d5c465) Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/devtest/gitea-ui.tmpl100
-rw-r--r--templates/repo/commits_list_small.tmpl4
-rw-r--r--templates/repo/diff/compare.tmpl4
-rw-r--r--templates/repo/issue/branch_selector_field.tmpl2
-rw-r--r--templates/repo/issue/view_content/pull.tmpl98
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl4
-rw-r--r--templates/repo/issue/view_content/update_branch_by_merge.tmpl9
-rw-r--r--templates/repo/issue/view_title.tmpl2
-rw-r--r--templates/repo/release_tag_header.tmpl2
-rw-r--r--templates/repo/wiki/view.tmpl2
10 files changed, 161 insertions, 66 deletions
diff --git a/templates/devtest/gitea-ui.tmpl b/templates/devtest/gitea-ui.tmpl
index 824b7d0db6..b3971921d3 100644
--- a/templates/devtest/gitea-ui.tmpl
+++ b/templates/devtest/gitea-ui.tmpl
@@ -118,6 +118,106 @@
</div>
<div>
+ <h1>SVG alignment</h1>
+
+ <h2>Text with SVG</h2>
+ <div class="flex-text-block">{{svg "octicon-alert"}} {{svg "octicon-x"}} text (block)</div>
+ <div><div class="flex-text-inline">{{svg "octicon-alert"}} {{svg "octicon-x"}} text</div> (inline)</div>
+ <div class="flex-items-block">
+ <div class="item">{{svg "octicon-alert"}} flex every line</div>
+ <div class="item">{{svg "octicon-alert"}} flex every item</div>
+ </div>
+
+ <h2>Button with SVG</h2>
+ <div>
+ <button class="ui red button">{{svg "octicon-alert" 24}} {{svg "octicon-x" 24}} text</button>
+ <div class="ui labeled button">
+ <button class="ui basic button">labeled button</button>
+ <a class="ui basic label">123</a>
+ </div>
+ </div>
+
+ <h2>Input with SVG</h2>
+ <div>
+ <div class="ui icon search input">
+ <i class="icon">{{svg "octicon-search"}}</i>
+ <input type="text" placeholder="place holder">
+ </div>
+ </div>
+
+ <h2>Dropdown with SVG</h2>
+ <div>
+ <div class="ui dropdown" style="border: 1px red dashed" data-tooltip-content="border for demo purpose only">
+ <span class="text">simple</span>
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="menu">
+ <div class="item">item</div>
+ </div>
+ </div>
+ <div class="ui button dropdown">
+ <span class="text">button dropdown</span>
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="menu">
+ <div class="item">item</div>
+ </div>
+ </div>
+ <div class="ui search selection dropdown">
+ <span class="text">search ...</span>
+ <input name="value" class="search">
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ {{svg "octicon-x" 14 "remove icon"}}
+ <div class="menu">
+ <div class="item">item</div>
+ </div>
+ </div>
+ <div class="ui multiple selection dropdown">
+ <input class="hidden" value="1">
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ {{svg "octicon-x" 14 "remove icon"}}
+ <div class="default text">empty multiple dropdown</div>
+ <div class="menu">
+ <div class="item">item</div>
+ </div>
+ </div>
+ <div class="ui multiple clearable search selection dropdown">
+ <input type="hidden" value="1">
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ {{svg "octicon-x" 14 "remove icon"}}
+ <div class="default text">clearable search dropdown</div>
+ <div class="menu">
+ <div class="item" data-value="1">item</div>
+ </div>
+ </div>
+ <div class="ui buttons">
+ <button class="ui button">Button with Dropdown</button>
+ <div class="ui dropdown button icon">
+ {{svg "octicon-triangle-down"}}
+ <div class="menu">
+ <div class="item">item</div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <div class="ui dropdown mini button">
+ <span class="text">small dropdown</span>
+ {{svg "octicon-triangle-down" 12 "dropdown icon"}}
+ <div class="menu">
+ <div class="item">item</div>
+ </div>
+ </div>
+ <div class="ui dropdown large button">
+ <span class="text">large dropdown</span>
+ {{svg "octicon-triangle-down" 18 "dropdown icon"}}
+ <div class="menu">
+ <div class="item">item</div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div>
<h1>ComboMarkdownEditor</h1>
<div>ps: no JS code attached, so just a layout</div>
{{template "shared/combomarkdowneditor" .}}
diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl
index 900d853601..6bbc19529f 100644
--- a/templates/repo/commits_list_small.tmpl
+++ b/templates/repo/commits_list_small.tmpl
@@ -6,9 +6,7 @@
<div class="singular-commit" id="{{$tag}}">
<span class="badge badge-commit">{{svg "octicon-git-commit"}}</span>
{{if .User}}
- <a href="{{.User.HomeLink}}">
- {{avatar $.root.Context .User}}
- </a>
+ <a class="avatar" href="{{.User.HomeLink}}">{{avatar $.root.Context .User}}</a>
{{else}}
{{avatarByEmail $.root.Context .Author.Email .Author.Name}}
{{end}}
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index 01a1cfd54e..4efe81682c 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -44,7 +44,7 @@
</div>
<div class="menu">
<div class="ui icon search input">
- <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i>
+ <i class="icon">{{svg "octicon-filter" 16}}</i>
<input name="search" placeholder="{{.locale.Tr "repo.filter_branch_and_tag"}}...">
</div>
<div class="header">
@@ -113,7 +113,7 @@
</div>
<div class="menu">
<div class="ui icon search input">
- <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i>
+ <i class="icon">{{svg "octicon-filter" 16}}</i>
<input name="search" placeholder="{{.locale.Tr "repo.filter_branch_and_tag"}}...">
</div>
<div class="header">
diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl
index 51eb5e26a0..2577a0feb0 100644
--- a/templates/repo/issue/branch_selector_field.tmpl
+++ b/templates/repo/issue/branch_selector_field.tmpl
@@ -12,7 +12,7 @@
</div>
<div class="menu">
<div class="ui icon search input">
- <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i>
+ <i class="icon">{{svg "octicon-filter" 16}}</i>
<input name="search" placeholder="{{.locale.Tr "repo.filter_branch_and_tag"}}...">
</div>
<div class="header">
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index e2ec691ee3..fd395c0eb6 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -22,13 +22,13 @@
<div class="content">
{{template "repo/pulls/status" .}}
{{$showGeneralMergeForm := false}}
- <div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}">
+ <div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}} flex-items-block">
{{if .Issue.PullRequest.HasMerged}}
{{if .IsPullBranchDeletable}}
<div class="item item-section text gt-f1">
<div class="item-section-left">
<h3 class="gt-mb-3">
- {{$.locale.Tr "repo.pulls.merged_success"}}
+ {{$.locale.Tr "repo.pulls.merged_success"}}
</h3>
<div class="merge-section-info">
{{$.locale.Tr "repo.pulls.merged_info_text" (printf "<code>%s</code>" (.HeadTarget | Escape)) | Str2html}}
@@ -58,93 +58,91 @@
{{end}}
</div>
{{else if .IsPullFilesConflicted}}
- <div class="item text">
+ <div class="item">
{{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.files_conflicted"}}
- <ul>
- {{range .ConflictedFiles}}
- <li>{{.}}</li>
- {{end}}
- </ul>
</div>
+ <ul>
+ {{range .ConflictedFiles}}
+ <li>{{.}}</li>
+ {{end}}
+ </ul>
{{else if .IsPullRequestBroken}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.data_broken"}}
</div>
{{else if .IsPullWorkInProgress}}
- <div class="item toggle-wip gt-df gt-ac gt-sb" data-title="{{.Issue.Title}}" data-wip-prefix="{{(.WorkInProgressPrefix|Escape)}}" data-update-url="{{.Issue.Link}}/title">
- <div>
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ <div class="item toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefix="{{(.WorkInProgressPrefix|Escape)}}" data-update-url="{{.Issue.Link}}/title">
+ <div class="item-section-left flex-text-inline gt-f1">
+ {{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.cannot_merge_work_in_progress"}}
</div>
- <div>
- {{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}}
- <button class="ui compact button">
- {{$.locale.Tr "repo.pulls.remove_prefix" (.WorkInProgressPrefix|Escape) | Safe}}
- </button>
- {{end}}
- </div>
+ {{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}}
+ <button class="ui compact button">
+ {{$.locale.Tr "repo.pulls.remove_prefix" (.WorkInProgressPrefix|Escape) | Safe}}
+ </button>
+ {{end}}
</div>
{{template "repo/issue/view_content/update_branch_by_merge" $}}
{{else if .Issue.PullRequest.IsChecking}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-sync"}}</i>
+ {{svg "octicon-sync"}}
{{$.locale.Tr "repo.pulls.is_checking"}}
</div>
{{else if .Issue.PullRequest.IsAncestor}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
+ {{svg "octicon-alert"}}
{{$.locale.Tr "repo.pulls.is_ancestor"}}
</div>
{{else if or .Issue.PullRequest.CanAutoMerge .Issue.PullRequest.IsEmpty}}
{{if .IsBlockedByApprovals}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
- {{$.locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}}
+ {{svg "octicon-x"}}
+ {{$.locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}}
</div>
{{else if .IsBlockedByRejection}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.blocked_by_rejection"}}
</div>
{{else if .IsBlockedByOfficialReviewRequests}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.blocked_by_official_review_requests"}}
</div>
{{else if .IsBlockedByOutdatedBranch}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
- {{$.locale.Tr "repo.pulls.blocked_by_outdated_branch"}}
+ {{svg "octicon-x"}}
+ {{$.locale.Tr "repo.pulls.blocked_by_outdated_branch"}}
</div>
{{else if .IsBlockedByChangedProtectedFiles}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe}}
- <ul>
- {{range .ChangedProtectedFiles}}
- <li>{{.}}</li>
- {{end}}
- </ul>
</div>
+ <ul>
+ {{range .ChangedProtectedFiles}}
+ <li>{{.}}</li>
+ {{end}}
+ </ul>
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsError .RequiredStatusCheckState.IsFailure)}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.required_status_check_failed"}}
</div>
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.required_status_check_missing"}}
</div>
{{else if and .AllowMerge .RequireSigned (not .WillSign)}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.Tr "repo.pulls.require_signed_wont_sign"}}
</div>
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-unlock"}}</i>
+ {{svg "octicon-unlock"}}
{{$.locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}}
</div>
{{end}}
@@ -158,23 +156,23 @@
{{if $canMergeNow}}
{{if $notAllOverridableChecksOk}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-dot-fill"}}</i>
+ {{svg "octicon-dot-fill"}}
{{$.locale.Tr "repo.pulls.required_status_check_administrator"}}
</div>
{{else}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-check"}}</i>
+ {{svg "octicon-check"}}
{{$.locale.Tr "repo.pulls.can_auto_merge_desc"}}
</div>
{{end}}
{{if .WillSign}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-lock" 16 "text green"}}</i>
+ {{svg "octicon-lock" 16 "text green"}}
{{$.locale.Tr "repo.signing.will_sign" .SigningKey}}
</div>
{{else if .IsSigned}}
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-unlock"}}</i>
+ {{svg "octicon-unlock"}}
{{$.locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}}
</div>
{{end}}
@@ -184,7 +182,7 @@
<div class="ui divider"></div>
<div class="item">
- <i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
+ {{svg "octicon-alert"}}
{{$.locale.Tr "repo.pulls.is_empty"}}
</div>
{{end}}
@@ -315,19 +313,19 @@
</div>
{{else if .IsBlockedByOutdatedBranch}}
<div class="item text red">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
- {{$.locale.Tr "repo.pulls.blocked_by_outdated_branch"}}
+ {{svg "octicon-x"}}
+ {{$.locale.Tr "repo.pulls.blocked_by_outdated_branch"}}
</div>
{{else if .IsBlockedByChangedProtectedFiles}}
<div class="item text red">
- <i class="icon icon-octicon">{{svg "octicon-x"}}</i>
+ {{svg "octicon-x"}}
{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe}}
- <ul>
- {{range .ChangedProtectedFiles}}
- <li>{{.}}</li>
- {{end}}
- </ul>
</div>
+ <ul>
+ {{range .ChangedProtectedFiles}}
+ <li>{{.}}</li>
+ {{end}}
+ </ul>
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
<div class="item text red">
{{svg "octicon-x"}}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 23e2c18547..901f714e32 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -273,7 +273,7 @@
<form method="POST" action="{{.Issue.Link}}/watch">
<input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}">
{{$.CsrfTokenHtml}}
- <button class="fluid ui button gt-df gt-jc">
+ <button class="fluid ui button">
{{if $.IssueWatch.IsWatching}}
{{svg "octicon-mute" 16 "gt-mr-3"}}
{{.locale.Tr "repo.issues.unsubscribe"}}
@@ -558,7 +558,7 @@
{{if or .PinEnabled .Issue.IsPinned}}
<form class="gt-mt-2" method="POST" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{.locale.Tr "repo.issues.max_pinned"}}"{{end}}>
{{$.CsrfTokenHtml}}
- <button class="fluid ui button gt-df gt-jc {{if not $.NewPinAllowed}}disabled{{end}}">
+ <button class="fluid ui button {{if not $.NewPinAllowed}}disabled{{end}}">
{{if not .Issue.IsPinned}}
{{svg "octicon-pin" 16 "gt-mr-3"}}
{{.locale.Tr "pin"}}
diff --git a/templates/repo/issue/view_content/update_branch_by_merge.tmpl b/templates/repo/issue/view_content/update_branch_by_merge.tmpl
index 84df244d8d..d539ece888 100644
--- a/templates/repo/issue/view_content/update_branch_by_merge.tmpl
+++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl
@@ -1,8 +1,8 @@
{{if and (gt $.Issue.PullRequest.CommitsBehind 0) (not $.Issue.IsClosed) (not $.Issue.PullRequest.IsChecking) (not $.IsPullFilesConflicted) (not $.IsPullRequestBroken)}}
<div class="ui divider"></div>
<div class="item item-section">
- <div class="item-section-left">
- <i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
+ <div class="item-section-left flex-text-inline">
+ {{svg "octicon-alert"}}
{{$.locale.Tr "repo.pulls.outdated_with_base_branch"}}
</div>
<div class="item-section-right">
@@ -14,9 +14,8 @@
{{$.locale.Tr "repo.pulls.update_branch"}}
</span>
</button>
-
- <div class="ui dropdown icon button no-text">
- {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="ui dropdown icon button">
+ {{svg "octicon-triangle-down"}}
<div class="menu">
<a class="item active selected" data-do="{{$.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</a>
<a class="item" data-do="{{$.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</a>
diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl
index 6a302d7401..e928b7bd25 100644
--- a/templates/repo/issue/view_title.tmpl
+++ b/templates/repo/issue/view_title.tmpl
@@ -84,7 +84,7 @@
</div>
<div class="menu">
<div class="ui icon search input">
- <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i>
+ <i class="icon">{{svg "octicon-filter" 16}}</i>
<input name="search" placeholder="{{.locale.Tr "repo.pulls.filter_branch"}}...">
</div>
<div class="scrolling menu" id="branch-select">
diff --git a/templates/repo/release_tag_header.tmpl b/templates/repo/release_tag_header.tmpl
index d8f60a2c6c..0af9ba8635 100644
--- a/templates/repo/release_tag_header.tmpl
+++ b/templates/repo/release_tag_header.tmpl
@@ -3,7 +3,7 @@
{{if $canReadReleases}}
<div class="gt-df">
- <div class="gt-f1">
+ <div class="gt-f1 gt-df gt-ac">
<h2 class="ui compact small menu header small-menu-items">
<a class="{{if .PageIsReleaseList}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.Tr "repo.release.releases"}}</a>
{{if $canReadCode}}
diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl
index b892bff947..370109caa4 100644
--- a/templates/repo/wiki/view.tmpl
+++ b/templates/repo/wiki/view.tmpl
@@ -15,7 +15,7 @@
</div>
<div class="menu">
<div class="ui icon search input">
- <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i>
+ <i class="icon">{{svg "octicon-filter" 16}}</i>
<input name="search" placeholder="{{.locale.Tr "repo.wiki.filter_page"}}...">
</div>
<div class="scrolling menu">