1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-29 13:48:36 +00:00

Replace text-align classes with tailwind (#33905)

Small refactor to remove these CSS classes in favor of tailwind.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2025-03-16 13:08:16 +01:00
committed by GitHub
parent 01c8f092a0
commit 1ea5216f4a
40 changed files with 83 additions and 136 deletions

View File

@@ -30,7 +30,7 @@
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
</td>
{{/* FIXME: here and below, the tw-overflow-visible is not quite right but it is still needed the moment: to show the important buttons when the width is narrow */}}
<td class="right aligned middle aligned tw-overflow-visible">
<td class="tw-text-right tw-overflow-visible">
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
<button class="btn interact-bg show-create-branch-modal tw-p-2"
data-modal="#create-branch-modal"
@@ -121,7 +121,7 @@
</div>
{{end}}
</td>
<td class="two wide right aligned">
<td class="two wide tw-text-right">
{{if not .LatestPullRequest}}
{{if .IsIncluded}}
<span class="ui orange large label" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.included_desc"}}">
@@ -150,7 +150,7 @@
{{end}}
</td>
{{/* FIXME: here and above, the tw-overflow-visible is not quite right */}}
<td class="three wide right aligned tw-overflow-visible">
<td class="three wide tw-text-right tw-overflow-visible">
{{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}}
<button class="btn interact-bg tw-p-2 show-modal show-create-branch-modal"
data-branch-from="{{.DBBranch.Name}}"

View File

@@ -83,7 +83,7 @@
<input id="new_branch_name" name="new_branch_name" required>
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui primary button">{{ctx.Locale.Tr "repo.branch.confirm_create_branch"}}</button>
</div>
@@ -108,7 +108,7 @@
<input id="new_branch_name" name="new_branch_name" required>
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui primary button">{{ctx.Locale.Tr "repo.tag.confirm_create_tag"}}</button>
</div>

View File

@@ -5,7 +5,7 @@
<th class="three wide">{{ctx.Locale.Tr "repo.commits.author"}}</th>
<th class="two wide sha">{{StringUtils.ToUpper $.Repository.ObjectFormatName}}</th>
<th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th>
<th class="two wide right aligned">{{ctx.Locale.Tr "repo.commits.date"}}</th>
<th class="two wide tw-text-right">{{ctx.Locale.Tr "repo.commits.date"}}</th>
<th class="one wide"></th>
</tr>
</thead>
@@ -61,11 +61,11 @@
{{end}}
</td>
{{if .Committer}}
<td class="text right aligned">{{DateUtils.TimeSince .Committer.When}}</td>
<td class="tw-text-right">{{DateUtils.TimeSince .Committer.When}}</td>
{{else}}
<td class="text right aligned">{{DateUtils.TimeSince .Author.When}}</td>
<td class="tw-text-right">{{DateUtils.TimeSince .Author.When}}</td>
{{end}}
<td class="text right aligned tw-py-0">
<td class="tw-text-right tw-py-0">
<button class="btn interact-bg tw-p-2 copy-commit-id" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
{{/* at the moment, wiki doesn't support these "view" links like "view at history point" */}}
{{if not $.PageIsWiki}}

View File

@@ -235,7 +235,7 @@
{{template "repo/upload" .}}
</div>
{{end}}
<div class="text right edit buttons">
<div class="tw-text-right edit buttons">
<button class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button>
<button class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button>
</div>

View File

@@ -10,11 +10,11 @@
{{range .IssueTemplates}}
<div class="ui attached segment">
<div class="ui two column grid">
<div class="column left aligned">
<div class="column">
<strong>{{.Name}}</strong>
<br>{{.About}}
</div>
<div class="column right aligned">
<div class="column tw-text-right">
<a href="{{$.RepoLink}}/issues/new?template={{.FileName}}{{if $.milestone}}&milestone={{$.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui primary button">{{ctx.Locale.Tr "repo.issues.choose.get_started"}}</a>
</div>
</div>
@@ -23,11 +23,11 @@
{{range .IssueConfig.ContactLinks}}
<div class="ui attached segment">
<div class="ui two column grid">
<div class="column left aligned">
<div class="column">
<strong>{{.Name}}</strong>
<br>{{.About}}
</div>
<div class="column right aligned">
<div class="column tw-text-right">
<a href="{{.URL}}" class="ui primary button">{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues.choose.open_external_link"}}</a>
</div>
</div>
@@ -36,11 +36,11 @@
{{if .IssueConfig.BlankIssuesEnabled}}
<div class="ui attached segment">
<div class="ui two column grid">
<div class="column left aligned">
<div class="column">
<strong>{{ctx.Locale.Tr "repo.issues.choose.blank"}}</strong>
<br/>{{ctx.Locale.Tr "repo.issues.choose.blank_about"}}
</div>
<div class="column right aligned">
<div class="column tw-text-right">
<a href="{{.RepoLink}}/issues/new?{{if .milestone}}&milestone={{.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui primary button">{{ctx.Locale.Tr "repo.issues.choose.get_started"}}</a>
</div>
</div>

View File

@@ -6,7 +6,7 @@
<div class="tw-flex">
<h1 class="tw-mb-2">{{.Milestone.Name}}</h1>
{{if not .Repository.IsArchived}}
<div class="text right tw-flex-1">
<div class="tw-text-right tw-flex-1">
{{if or .CanWriteIssues .CanWritePulls}}
{{if .Milestone.IsClosed}}
<a class="ui primary basic button link-action" href data-url="{{$.RepoLink}}/milestones/{{.MilestoneID}}/open">{{ctx.Locale.Tr "repo.milestones.open"}}

View File

@@ -33,7 +33,7 @@
{{else}}
{{template "repo/issue/comment_tab" .}}
{{end}}
<div class="text right">
<div class="tw-text-right">
<button class="ui primary button">
{{if .PageIsComparePull}}
{{ctx.Locale.Tr "repo.pulls.create"}}

View File

@@ -76,7 +76,7 @@
</div>
{{end}}
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">
{{if .Issue.IsLocked}}

View File

@@ -121,7 +121,7 @@
<label for="issue-sidebar-dismiss-review-message">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</label>
<input id="issue-sidebar-dismiss-review-message" name="message">
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button" type="submit">{{ctx.Locale.Tr "ok"}}</button>
</div>

View File

@@ -83,7 +83,7 @@
{{template "repo/issue/comment_tab" .}}
{{.CsrfTokenHtml}}
<div class="field footer">
<div class="text right">
<div class="tw-text-right">
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
{{if .Issue.IsClosed}}
<button id="status-button" class="ui primary basic button" data-status="{{ctx.Locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.reopen_comment_issue"}}" name="status" value="reopen">
@@ -157,7 +157,7 @@
{{end}}
<div class="field">
<div class="text right edit">
<div class="tw-text-right edit">
<button type="button" class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button>
<button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button>
</div>

View File

@@ -20,7 +20,7 @@
<label><strong>{{ctx.Locale.Tr "repo.issues.reference_issue.body"}}</strong></label>
<textarea name="content"></textarea>
</div>
<div class="text right">
<div class="tw-text-right">
<button class="ui primary button">{{ctx.Locale.Tr "repo.issues.create"}}</button>
</div>
</form>

View File

@@ -7,19 +7,19 @@
{{template "base/alert" .}}
<div class="home">
<div class="ui stackable middle very relaxed page grid">
<div id="repo_migrating" class="sixteen wide center aligned centered column" data-migrating-repo-link="{{.Link}}">
<div id="repo_migrating" class="sixteen wide tw-text-center centered column" data-migrating-repo-link="{{.Link}}">
<div>
<img src="{{AssetUrlPrefix}}/img/loading.png">
</div>
</div>
<div id="repo_migrating_failed_image" class="sixteen wide center aligned centered column tw-hidden">
<div id="repo_migrating_failed_image" class="sixteen wide tw-text-center centered column tw-hidden">
<div>
<img src="{{AssetUrlPrefix}}/img/failed.png">
</div>
</div>
</div>
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<div class="sixteen wide tw-text-center centered column">
<div id="repo_migrating_progress">
<p>{{ctx.Locale.Tr "repo.migrate.migrating" .CloneAddr}}</p>
<p id="repo_migrating_progress_message"></p>
@@ -77,7 +77,7 @@
<input id="repo_name_to_delete" name="repo_name" required>
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button>
</div>

View File

@@ -82,7 +82,7 @@
{{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}}
{{if eq .Activity.Code.CommitCountInAllBranches 0}}
<div class="ui center aligned segment">
<div class="ui tw-text-center segment">
<h4 class="ui header">{{ctx.Locale.Tr "repo.activity.no_git_activity"}}</h4>
</div>
{{end}}

View File

@@ -56,7 +56,7 @@
</div>
</div>
{{else}}
<div class="flex-item center aligned">
<div class="flex-item tw-text-center">
{{ctx.Locale.Tr "repo.settings.no_protected_branch"}}
</div>
{{end}}

View File

@@ -18,7 +18,7 @@
</td>
<td>{{FileSize .Size}}</td>
<td>{{DateUtils.TimeSince .CreatedUnix}}</td>
<td class="right aligned">
<td class="tw-text-right">
<a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a>
<button class="ui basic show-modal icon button red" data-modal="#delete-{{.Oid}}">
<span class="btn-octicon btn-octicon-danger" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.delete_this_file"}}">{{svg "octicon-trash"}}</span>

View File

@@ -36,7 +36,7 @@
</a>
</td>
<td>{{DateUtils.TimeSince .Created}}</td>
<td class="right aligned">
<td class="tw-text-right">
<form action="{{$.LFSFilesLink}}/locks/{{$lock.ID}}/unlock" method="post">
{{$.CsrfTokenHtml}}
<button class="ui primary button"><span class="btn-octicon">{{svg "octicon-lock"}}</span>{{ctx.Locale.Tr "repo.settings.lfs_force_unlock"}}</button>

View File

@@ -117,7 +117,7 @@
<td>{{.PullMirror.RemoteAddress}}</td>
<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
<td>{{DateUtils.FullTime .PullMirror.UpdatedUnix}}</td>
<td class="right aligned">
<td class="tw-text-right">
<form method="post" class="tw-inline-block">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="mirror-sync">
@@ -214,7 +214,7 @@
{{if .LastError}}<span class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</span>{{end}}
</span>
</td>
<td class="right aligned">
<td class="tw-text-right">
<button
class="ui tiny button show-modal"
data-modal="#push-mirror-edit-modal"
@@ -936,7 +936,7 @@
<input name="repo_name" required maxlength="100">
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_confirm"}}</button>
</div>
@@ -967,7 +967,7 @@
<input name="repo_name" required>
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_fork_confirm"}}</button>
</div>
@@ -1004,7 +1004,7 @@
<input id="new_owner_name" name="new_owner_name" required>
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_perform"}}</button>
</div>
@@ -1038,7 +1038,7 @@
<input id="repo_name_to_delete" name="repo_name" required>
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button>
</div>
@@ -1098,7 +1098,7 @@
<input name="repo_name" required>
</div>
<div class="text right actions">
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_delete"}}</button>
</div>

View File

@@ -104,7 +104,7 @@
{{ctx.Locale.Tr "repo.settings.tags.protection.allowed.noone"}}
{{end}}
</td>
<td class="right aligned">
<td class="tw-text-right">
<a class="ui tiny primary button" href="{{$.RepoLink}}/settings/tags/{{.ID}}">{{ctx.Locale.Tr "edit"}}</a>
<form class="tw-inline-block" action="{{$.RepoLink}}/settings/tags/delete" method="post">
{{$.CsrfTokenHtml}}
@@ -114,7 +114,7 @@
</td>
</tr>
{{else}}
<tr class="center aligned"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr>
<tr class="tw-text-center"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr>
{{end}}
</tbody>
</table>

View File

@@ -35,7 +35,7 @@
<input name="message" aria-label="{{ctx.Locale.Tr "repo.wiki.default_commit_message"}}" placeholder="{{ctx.Locale.Tr "repo.wiki.default_commit_message"}}">
</div>
<div class="divider"></div>
<div class="text right">
<div class="tw-text-right">
<a class="ui basic cancel button" href="{{.Link}}">{{ctx.Locale.Tr "cancel"}}</a>
<button class="ui primary button">{{ctx.Locale.Tr "repo.wiki.save_page"}}</button>
</div>

View File

@@ -21,7 +21,7 @@
<a class="wiki-git-entry" href="{{$.RepoLink}}/wiki/{{.GitEntryName | PathEscape}}" data-tooltip-content="{{ctx.Locale.Tr "repo.wiki.original_git_entry_tooltip"}}">{{svg "octicon-chevron-right"}}</a>
</td>
{{$timeSince := DateUtils.TimeSince .UpdatedUnix}}
<td class="text right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td>
<td class="tw-text-right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td>
</tr>
{{end}}
</tbody>

View File

@@ -14,7 +14,7 @@
</div>
</div>
</div>
<div class="ui eight wide column text right">
<div class="ui eight wide column tw-text-right">
{{template "repo/clone_panel" .}}
</div>
</div>