1
1
mirror of https://github.com/go-gitea/gitea synced 2024-06-30 07:05:50 +00:00
gitea/templates/repo/settings/tags.tmpl
Hester Gong f1a4330306
Modify width of ui container, fine tune css for settings pages and org header (#24315)
Close #24302 
Part of #24229, Follows #24246
This PR focused on CSS style fine-tune, main changes:

1. Give `.ui.ui.ui.container` a width of `1280px` with a max-width of
`calc(100vw - 64px)`, so the main contents looks better on large
devices.

2. Share styles for table elements in all levels settings pages to fix
overflow of runners table on mobile and for consistency (The headers on
mobile can be further improved, but haven't found a proper way yet).

3. Use [stackable
grid](https://fomantic-ui.com/collections/grid.html#stackable) and
[device column width](https://fomantic-ui.com/examples/responsive.html)
for responsiveness for some pages (repo/org collaborators settings
pages, org teams related page)

4. Fixed #24302 by sharing label related CSS in reporg.css

5. Fine tune repo tags settings page

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-04-26 11:59:08 -04:00

127 lines
4.8 KiB
Handlebars

{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings edit")}}
<div class="repo-setting-content">
{{if .Repository.IsArchived}}
<div class="ui warning message">
{{.locale.Tr "repo.settings.archive.tagsettings_unavailable"}}
</div>
{{else}}
<h4 class="ui top attached header">
{{.locale.Tr "repo.settings.tags.protection"}}
</h4>
<div class="ui attached segment">
<div class="ui grid">
<div class="sixteen wide column">
<div class="ui segment">
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="field">
<label>{{.locale.Tr "repo.settings.tags.protection.pattern"}}</label>
<div id="search-tag-box" class="ui search">
<div class="ui input">
<input class="prompt" name="name_pattern" autocomplete="off" value="{{.name_pattern}}" placeholder="v*" autofocus required>
</div>
<div class="help">{{.locale.Tr "repo.settings.tags.protection.pattern.description" | Safe}}</div>
</div>
</div>
<div class="whitelist field">
<label>{{.locale.Tr "repo.settings.tags.protection.allowed.users"}}</label>
<div class="ui multiple search selection dropdown">
<input type="hidden" name="allowlist_users" value="{{.allowlist_users}}">
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_users"}}</div>
<div class="menu">
{{range .Users}}
<div class="item" data-value="{{.ID}}">
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
</div>
{{end}}
</div>
</div>
</div>
{{if .Owner.IsOrganization}}
<div class="whitelist field">
<label>{{.locale.Tr "repo.settings.tags.protection.allowed.teams"}}</label>
<div class="ui multiple search selection dropdown">
<input type="hidden" name="allowlist_teams" value="{{.allowlist_teams}}">
<div class="default text">{{.locale.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
<div class="menu">
{{range .Teams}}
<div class="item" data-value="{{.ID}}">
{{svg "octicon-people"}}
{{.Name}}
</div>
{{end}}
</div>
</div>
</div>
{{end}}
<div class="field">
{{if .PageIsEditProtectedTag}}
<button class="ui green button">
{{$.locale.Tr "save"}}
</button>
<a class="ui primary button" href="{{$.RepoLink}}/settings/tags">
{{$.locale.Tr "cancel"}}
</a>
{{else}}
<button class="ui green button">
{{$.locale.Tr "repo.settings.tags.protection.create"}}
</button>
{{end}}
</div>
</form>
</div>
</div>
<div class="sixteen wide column">
<table class="ui single line table">
<thead>
<th>{{.locale.Tr "repo.settings.tags.protection.pattern"}}</th>
<th>{{.locale.Tr "repo.settings.tags.protection.allowed"}}</th>
<th></th>
</thead>
<tbody>
{{range .ProtectedTags}}
<tr>
<td><pre>{{.NamePattern}}</pre></td>
<td>
{{if or .AllowlistUserIDs (and $.Owner.IsOrganization .AllowlistTeamIDs)}}
{{$userIDs := .AllowlistUserIDs}}
{{range $.Users}}
{{if SliceUtils.Contains $userIDs .ID}}
<a class="ui basic label" href="{{.HomeLink}}">{{avatar $.Context . 26}} {{.GetDisplayName}}</a>
{{end}}
{{end}}
{{if $.Owner.IsOrganization}}
{{$teamIDs := .AllowlistTeamIDs}}
{{range $.Teams}}
{{if SliceUtils.Contains $teamIDs .ID}}
<a class="ui basic label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a>
{{end}}
{{end}}
{{end}}
{{else}}
{{$.locale.Tr "repo.settings.tags.protection.allowed.noone"}}
{{end}}
</td>
<td class="right aligned">
<a class="ui tiny primary button" href="{{$.RepoLink}}/settings/tags/{{.ID}}">{{$.locale.Tr "edit"}}</a>
<form class="gt-dib" action="{{$.RepoLink}}/settings/tags/delete" method="post">
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{.ID}}">
<button class="ui tiny red button">{{$.locale.Tr "remove"}}</button>
</form>
</td>
</tr>
{{else}}
<tr class="center aligned"><td colspan="3">{{.locale.Tr "repo.settings.tags.protection.none"}}</td></tr>
{{end}}
</tbody>
</table>
</div>
</div>
</div>
{{end}}
</div>
{{template "repo/settings/layout_footer" .}}