mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	Simplify helper CSS classes and avoid abuse (#26728)
Removed CSS helper classes (some of them are not useful while some of them are abused often) * `gt-db`: in most cases it could be replaced by `gt-df` and the flex layout should be encouraged. Other cases: either it does need the `gt-df` (eg: by using `div` directly) or it is an abuse (eg: the warning message in a form) * `gt-di`: it doesn't seem useful, or it could be replaced by `gt-dib` in most cases. * `gt-dif`: not useful, it could be replaced by `flex-text-inline` or `gt-df` * `gt-js`: never used * All `<i class="icon gt-df gt-ac gt-jc">` could be written as `<i class="icon">` ## Some UI samples ### Admin Notice  ### Admin Stacktrace  ### Org Home  ### Org Team Repo  ### Release List  ### User Setting Application Token Scope  Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
		| @@ -17,7 +17,7 @@ | ||||
| 			<tbody> | ||||
| 				{{range .Notices}} | ||||
| 					<tr> | ||||
| 						<td><div class="ui checkbox gt-db" data-id="{{.ID}}"><input type="checkbox"></div></td> | ||||
| 						<td><div class="ui checkbox gt-df" data-id="{{.ID}}"><input type="checkbox"></div></td> | ||||
| 						<td>{{.ID}}</td> | ||||
| 						<td>{{$.locale.Tr .TrStr}}</td> | ||||
| 						<td class="view-detail auto-ellipsis" style="width: 80%;"><span class="notice-description">{{.Description}}</span></td> | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
| 				<div class="item"> | ||||
| 					<details> | ||||
| 						<summary> | ||||
| 							<div class="gt-dif content"> | ||||
| 							<div class="flex-text-inline"> | ||||
| 								<div class="header gt-ml-3"> | ||||
| 									<span class="icon gt-mr-3">{{svg "octicon-code" 16}}</span>{{.Description}}{{if gt .Count 1}} * {{.Count}}{{end}} | ||||
| 								</div> | ||||
|   | ||||
| @@ -57,7 +57,7 @@ | ||||
| 				{{if .NumMembers}} | ||||
| 					<h4 class="ui top attached header gt-df"> | ||||
| 						<strong class="gt-f1">{{.locale.Tr "org.members"}}</strong> | ||||
| 						<a class="text grey gt-dif gt-ac" href="{{.OrgLink}}/members"><span>{{.NumMembers}}</span> {{svg "octicon-chevron-right"}}</a> | ||||
| 						<a class="text grey gt-df gt-ac" href="{{.OrgLink}}/members"><span>{{.NumMembers}}</span> {{svg "octicon-chevron-right"}}</a> | ||||
| 					</h4> | ||||
| 					<div class="ui attached segment members"> | ||||
| 						{{$isMember := .IsOrganizationMember}} | ||||
| @@ -71,7 +71,7 @@ | ||||
| 				{{if .IsOrganizationMember}} | ||||
| 					<div class="ui top attached header gt-df"> | ||||
| 						<strong class="gt-f1">{{.locale.Tr "org.teams"}}</strong> | ||||
| 						<a class="text grey gt-dif gt-ac" href="{{.OrgLink}}/teams"><span>{{.Org.NumTeams}}</span> {{svg "octicon-chevron-right"}}</a> | ||||
| 						<a class="text grey gt-df gt-ac" href="{{.OrgLink}}/teams"><span>{{.Org.NumTeams}}</span> {{svg "octicon-chevron-right"}}</a> | ||||
| 					</div> | ||||
| 					<div class="ui attached table segment teams"> | ||||
| 						{{range .Teams}} | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| 				{{$canAddRemove := and $.IsOrganizationOwner (not $.Team.IncludesAllRepositories)}} | ||||
| 				{{if $canAddRemove}} | ||||
| 					<div class="ui attached segment gt-df gt-fw gt-gap-3"> | ||||
| 						<form class="ui form ignore-dirty gt-f1 gt-dif" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/add" method="post"> | ||||
| 						<form class="ui form ignore-dirty gt-f1 gt-df" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/add" method="post"> | ||||
| 							{{.CsrfTokenHtml}} | ||||
| 							<div id="search-repo-box" data-uid="{{.Org.ID}}" class="ui search"> | ||||
| 								<div class="ui input"> | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
| 							<div class="ui small action input{{if .CodeIndexerUnavailable}} disabled left icon{{end}}"{{if .CodeIndexerUnavailable}} data-tooltip-content="{{.locale.Tr "repo.search.code_search_unavailable"}}"{{end}}> | ||||
| 								<input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable}} disabled{{end}} placeholder="{{.locale.Tr "repo.search.search_repo"}}"> | ||||
| 								{{if .CodeIndexerUnavailable}} | ||||
| 									<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-alert"}}</i> | ||||
| 									<i class="icon">{{svg "octicon-alert"}}</i> | ||||
| 								{{end}} | ||||
| 								<button class="ui small icon button"{{if .CodeIndexerUnavailable}} disabled{{end}} type="submit"> | ||||
| 									{{svg "octicon-search"}} | ||||
|   | ||||
| @@ -15,7 +15,7 @@ | ||||
| 				</span> | ||||
| 				<div class="menu"> | ||||
| 					<div class="ui icon search input"> | ||||
| 						<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 						<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 						<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_label"}}"> | ||||
| 					</div> | ||||
| 					<span class="info">{{.locale.Tr "repo.issues.filter_label_exclude" | Safe}}</span> | ||||
| @@ -43,7 +43,7 @@ | ||||
| 				</span> | ||||
| 				<div class="menu"> | ||||
| 					<div class="ui icon search input"> | ||||
| 						<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 						<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 						<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_milestone"}}"> | ||||
| 					</div> | ||||
| 					<div class="divider"></div> | ||||
| @@ -81,7 +81,7 @@ | ||||
| 				</span> | ||||
| 				<div class="menu"> | ||||
| 					<div class="ui icon search input"> | ||||
| 						<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 						<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 						<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_project"}}"> | ||||
| 					</div> | ||||
| 					<a class="{{if not .ProjectID}}active selected {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_project_all"}}</a> | ||||
| @@ -123,7 +123,7 @@ | ||||
| 				</span> | ||||
| 				<div class="menu"> | ||||
| 					<div class="ui icon search input"> | ||||
| 						<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 						<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 						<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_poster"}}"> | ||||
| 					</div> | ||||
| 					<a class="item" data-value="0">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a> | ||||
| @@ -138,7 +138,7 @@ | ||||
| 				</span> | ||||
| 				<div class="menu"> | ||||
| 					<div class="ui icon search input"> | ||||
| 						<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 						<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 						<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_assignee"}}"> | ||||
| 					</div> | ||||
| 					<a class="{{if not .AssigneeID}}active selected {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a> | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
| 	<div class="filter menu" {{if .Issue}}data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels"{{else}}data-id="#label_ids"{{end}}> | ||||
| 		{{if or .Labels .OrgLabels}} | ||||
| 			<div class="ui icon search input"> | ||||
| 				<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 				<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 				<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_labels"}}"> | ||||
| 			</div> | ||||
| 		{{end}} | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| {{if or .OpenMilestones .ClosedMilestones}} | ||||
| 	<div class="ui icon search input"> | ||||
| 		<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 		<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 		<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_milestones"}}"> | ||||
| 	</div> | ||||
| 	<div class="divider"></div> | ||||
|   | ||||
| @@ -95,7 +95,7 @@ | ||||
| 			<div class="menu"> | ||||
| 				{{if or .OpenProjects .ClosedProjects}} | ||||
| 				<div class="ui icon search input"> | ||||
| 					<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 					<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 					<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_projects"}}"> | ||||
| 				</div> | ||||
| 				{{end}} | ||||
| @@ -152,7 +152,7 @@ | ||||
| 				</span> | ||||
| 				<div class="filter menu" data-id="#assignee_ids"> | ||||
| 					<div class="ui icon search input"> | ||||
| 						<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 						<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 						<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_assignees"}}"> | ||||
| 					</div> | ||||
| 					<div class="no-select item">{{.locale.Tr "repo.issues.new.clear_assignees"}}</div> | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <div class="divider"></div> | ||||
| <div class="instruct-toggle"> {{$.locale.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div> | ||||
| <div class="instruct-content gt-mt-3 gt-hidden"> | ||||
| 	<div><h3 class="gt-di">{{$.locale.Tr "step1"}} </h3>{{$.locale.Tr "repo.pulls.merge_instruction_step1_desc"}}</div> | ||||
| 	<div><h3 class="gt-dib">{{$.locale.Tr "step1"}}</h3> {{$.locale.Tr "repo.pulls.merge_instruction_step1_desc"}}</div> | ||||
| 	<div class="ui secondary segment"> | ||||
| 		{{if eq $.Issue.PullRequest.Flow 0}} | ||||
| 		<div>git checkout -b {{if ne $.Issue.PullRequest.HeadRepo.ID $.Issue.PullRequest.BaseRepo.ID}}{{$.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{$.Issue.PullRequest.HeadBranch}} {{$.Issue.PullRequest.BaseBranch}}</div> | ||||
| @@ -10,7 +10,7 @@ | ||||
| 		<div>git fetch origin {{$.Issue.PullRequest.GetGitRefName}}:{{$.Issue.PullRequest.HeadBranch}}</div> | ||||
| 		{{end}} | ||||
| 	</div> | ||||
| 	<div><h3 class="gt-di">{{$.locale.Tr "step2"}} </h3>{{$.locale.Tr "repo.pulls.merge_instruction_step2_desc"}}</div> | ||||
| 	<div><h3 class="gt-dib">{{$.locale.Tr "step2"}}</h3> {{$.locale.Tr "repo.pulls.merge_instruction_step2_desc"}}</div> | ||||
| 	<div class="ui secondary segment"> | ||||
| 		<div>git checkout {{$.Issue.PullRequest.BaseBranch}}</div> | ||||
| 		<div>git merge --no-ff {{if ne $.Issue.PullRequest.HeadRepo.ID $.Issue.PullRequest.BaseRepo.ID}}{{$.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{$.Issue.PullRequest.HeadBranch}}</div> | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
| 			<div class="filter menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/request_review"> | ||||
| 				{{if .Reviewers}} | ||||
| 					<div class="ui icon search input"> | ||||
| 						<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 						<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 						<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_reviewers"}}"> | ||||
| 					</div> | ||||
| 				{{end}} | ||||
| @@ -162,7 +162,7 @@ | ||||
| 			<div class="menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/projects"> | ||||
| 				{{if or .OpenProjects .ClosedProjects}} | ||||
| 				<div class="ui icon search input"> | ||||
| 					<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 					<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 					<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_projects"}}"> | ||||
| 				</div> | ||||
| 				{{end}} | ||||
| @@ -215,7 +215,7 @@ | ||||
| 		</a> | ||||
| 		<div class="filter menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee"> | ||||
| 			<div class="ui icon search input"> | ||||
| 				<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> | ||||
| 				<i class="icon">{{svg "octicon-search" 16}}</i> | ||||
| 				<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_assignees"}}"> | ||||
| 			</div> | ||||
| 			<div class="no-select item">{{.locale.Tr "repo.issues.new.clear_assignees"}}</div> | ||||
|   | ||||
| @@ -8,10 +8,10 @@ | ||||
| 			{{range $idx, $release := .Releases}} | ||||
| 				<li class="ui grid"> | ||||
| 					<div class="ui four wide column meta"> | ||||
| 							<a class="gt-db muted" href="{{if not .Sha1}}#{{else}}{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}{{end}}" rel="nofollow">{{svg "octicon-tag" 16 "gt-mr-2"}}{{.TagName}}</a> | ||||
| 							<a class="muted" href="{{if not .Sha1}}#{{else}}{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}{{end}}" rel="nofollow">{{svg "octicon-tag" 16 "gt-mr-2"}}{{.TagName}}</a> | ||||
| 							{{if .Sha1}} | ||||
| 								<a class="gt-mono muted gt-db gt-mt-4 gt-pt-1" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "gt-mr-2"}}{{ShortSha .Sha1}}</a> | ||||
| 								{{template "repo/branch_dropdown" dict "root" $ "release" . "ContainerClasses" "gt-mt-4"}} | ||||
| 								<a class="muted gt-mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "gt-mr-2"}}{{ShortSha .Sha1}}</a> | ||||
| 								{{template "repo/branch_dropdown" dict "root" $ "release" .}} | ||||
| 							{{end}} | ||||
| 					</div> | ||||
| 					<div class="ui twelve wide column detail"> | ||||
|   | ||||
| @@ -116,7 +116,7 @@ | ||||
| 						<tbody> | ||||
| 							<tr> | ||||
| 								<td colspan="4"> | ||||
| 									<span class="text red gt-db gt-py-4 gt-border-secondary-bottom">{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{$.locale.Tr "error.occurred"}}</span> | ||||
| 									<div class="text red gt-py-4 gt-border-secondary-bottom">{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{$.locale.Tr "error.occurred"}}</div> | ||||
| 								</td> | ||||
| 							</tr> | ||||
| 						</tbody> | ||||
|   | ||||
| @@ -86,13 +86,13 @@ | ||||
| 						></scoped-access-token-selector> | ||||
| 					</div> | ||||
| 				</details> | ||||
| 				<div id="scoped-access-warning" class="ui warning message center gt-db gt-hidden"> | ||||
| 					{{.locale.Tr "settings.at_least_one_permission"}} | ||||
| 				</div> | ||||
| 				<button id="scoped-access-submit" class="ui green button"> | ||||
| 					{{.locale.Tr "settings.generate_token"}} | ||||
| 				</button> | ||||
| 			</form> | ||||
| 			</form>{{/* Fomantic ".ui.form .warning.message" is hidden by default, so put the warning message out of the form*/}} | ||||
| 			<div id="scoped-access-warning" class="ui warning message center gt-hidden"> | ||||
| 				{{.locale.Tr "settings.at_least_one_permission"}} | ||||
| 			</div> | ||||
| 		</div> | ||||
|  | ||||
| 		{{if .EnableOAuth2}} | ||||
|   | ||||
| @@ -2,14 +2,10 @@ | ||||
| Gitea's tailwind-style CSS helper classes have `gt-` prefix. | ||||
| Gitea's private styles use `g-` prefix. | ||||
| */ | ||||
| .gt-db { display: block !important; } | ||||
| .gt-df { display: flex !important; } | ||||
| .gt-di { display: inline !important; } | ||||
| .gt-dif { display: inline-flex !important; } | ||||
| .gt-dib { display: inline-block !important; } | ||||
| .gt-ac { align-items: center !important; } | ||||
| .gt-jc { justify-content: center !important; } | ||||
| .gt-js { justify-content: flex-start !important; } | ||||
| .gt-je { justify-content: flex-end !important; } | ||||
| .gt-sb { justify-content: space-between !important; } | ||||
| .gt-fc { flex-direction: column !important; } | ||||
|   | ||||
| @@ -23,8 +23,11 @@ | ||||
|  | ||||
| .repository.releases #release-list > li .meta { | ||||
|   margin-top: 4px; | ||||
|   text-align: right; | ||||
|   position: relative; | ||||
|   text-align: right; | ||||
|   display: flex; | ||||
|   flex-direction: column; | ||||
|   gap: 1em; | ||||
| } | ||||
|  | ||||
| .repository.releases #release-list > li .detail { | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
|       <div class="ui attached segment repos-search"> | ||||
|         <div class="ui fluid right action left icon input" :class="{loading: isLoading}"> | ||||
|           <input type="search" spellcheck="false" maxlength="255" @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" @keydown="reposFilterKeyControl" :placeholder="textSearchRepos"> | ||||
|           <i class="icon gt-df gt-ac gt-jc"><svg-icon name="octicon-search" :size="16"/></i> | ||||
|           <i class="icon"><svg-icon name="octicon-search" :size="16"/></i> | ||||
|           <div class="ui dropdown icon button" :title="textFilter"> | ||||
|             <svg-icon name="octicon-filter" :size="16"/> | ||||
|             <div class="menu"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user