mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-24 08:36:09 +01:00
fix ui issues
This commit is contained in:
parent
3fb03fbe51
commit
dcf43af234
@ -3741,7 +3741,7 @@
|
||||
"actions.general.token_permissions.access_none": "None",
|
||||
"actions.general.token_permissions.access_read": "Read",
|
||||
"actions.general.token_permissions.access_write": "Write",
|
||||
"actions.general.token_permissions.contents": "Contents",
|
||||
"actions.general.token_permissions.contents": "Code",
|
||||
"actions.general.token_permissions.contents.description": "Repository contents, commits, branches, downloads, releases, and merges.",
|
||||
"actions.general.token_permissions.issues": "Issues",
|
||||
"actions.general.token_permissions.issues.description": "Issues and related comments, assignees, labels, and milestones.",
|
||||
@ -3773,6 +3773,8 @@
|
||||
"actions.general.token_permissions.add_repo": "Add Repository",
|
||||
"actions.general.token_permissions.follow_org": "Follow organization-level configuration",
|
||||
"actions.general.token_permissions.follow_org_desc": "Use the Actions settings configured at the organization level instead of repository-specific settings.",
|
||||
"settings.confirm_password": "Confirm Password",
|
||||
"settings.disabled": "Disabled",
|
||||
"all_repositories": "All Repositories",
|
||||
"specific_repositories": "Specific Repositories"
|
||||
}
|
||||
|
||||
@ -83,24 +83,31 @@ func ActionsGeneralPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// Update Maximum Permissions (radio buttons: none/read/write)
|
||||
parseMaxPerm := func(name string) perm.AccessMode {
|
||||
value := ctx.FormString("max_" + name)
|
||||
switch value {
|
||||
case "write":
|
||||
return perm.AccessModeWrite
|
||||
case "read":
|
||||
return perm.AccessModeRead
|
||||
default:
|
||||
return perm.AccessModeNone
|
||||
if actionsCfg.TokenPermissionMode == repo_model.ActionsTokenPermissionModeCustom {
|
||||
parseMaxPerm := func(name string) perm.AccessMode {
|
||||
value := ctx.FormString("max_" + name)
|
||||
switch value {
|
||||
case "write":
|
||||
return perm.AccessModeWrite
|
||||
case "read":
|
||||
return perm.AccessModeRead
|
||||
default:
|
||||
return perm.AccessModeNone
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{
|
||||
Code: parseMaxPerm("contents"),
|
||||
Issues: parseMaxPerm("issues"),
|
||||
Packages: parseMaxPerm("packages"),
|
||||
PullRequests: parseMaxPerm("pull_requests"),
|
||||
Wiki: parseMaxPerm("wiki"),
|
||||
actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{
|
||||
Code: parseMaxPerm("contents"),
|
||||
Issues: parseMaxPerm("issues"),
|
||||
Packages: parseMaxPerm("packages"),
|
||||
PullRequests: parseMaxPerm("pull_requests"),
|
||||
Wiki: parseMaxPerm("wiki"),
|
||||
Actions: parseMaxPerm("actions"),
|
||||
Releases: parseMaxPerm("releases"),
|
||||
Projects: parseMaxPerm("projects"),
|
||||
}
|
||||
} else {
|
||||
actionsCfg.MaxTokenPermissions = nil
|
||||
}
|
||||
|
||||
// Update Cross-Repo Access Mode
|
||||
|
||||
@ -39,28 +39,45 @@
|
||||
<h5 class="ui header">
|
||||
{{ctx.Locale.Tr "actions.general.token_permissions.allowed_repos"}}
|
||||
</h5>
|
||||
<div class="ui middle aligned divided list">
|
||||
{{range .AllowedRepos}}
|
||||
<div class="item">
|
||||
<div class="right floated content">
|
||||
<button class="ui red tiny button" formmethod="post" formaction="{{$.Link}}/allowed_repos/remove?repo_id={{.ID}}">{{ctx.Locale.Tr "remove"}}</button>
|
||||
<div class="ui attached segment">
|
||||
<div class="flex-list">
|
||||
{{range .AllowedRepos}}
|
||||
<div class="flex-item tw-items-center">
|
||||
<div class="flex-item-leading">
|
||||
{{template "repo/icon" .}}
|
||||
</div>
|
||||
<div class="flex-item-main">
|
||||
<a class="flex-item-title text primary" href="{{.Link}}">
|
||||
{{.FullName}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex-item-trailing">
|
||||
<form method="post" action="{{$.Link}}/allowed_repos/remove?repo_id={{.ID}}">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<button type="submit" class="ui red small button">{{ctx.Locale.Tr "remove"}}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<a href="{{.Link}}">{{.Name}}</a>
|
||||
{{else}}
|
||||
<div class="flex-item">
|
||||
<span class="text grey tw-italic">{{ctx.Locale.Tr "org.repos.none"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="item text empty">{{ctx.Locale.Tr "org.repos.none"}}</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 class="ui header">
|
||||
{{ctx.Locale.Tr "actions.general.token_permissions.add_repo"}}
|
||||
</h5>
|
||||
<div class="ui action input">
|
||||
<input name="repo_name" placeholder="{{ctx.Locale.Tr "search.search_repo"}}">
|
||||
<button class="ui green button" formmethod="post" formaction="{{$.Link}}/allowed_repos/add">{{ctx.Locale.Tr "add"}}</button>
|
||||
</div>
|
||||
<form class="ui form tw-flex" action="{{$.Link}}/allowed_repos/add" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div data-global-init="initSearchRepoBox" data-uid="{{.Org.AsUser.ID}}" class="ui search tw-flex-1">
|
||||
<div class="ui input">
|
||||
<input class="prompt" name="repo_name" placeholder="{{ctx.Locale.Tr "search.search_repo"}}" autocomplete="off" required>
|
||||
</div>
|
||||
</div>
|
||||
<button class="ui green button tw-ml-2">{{ctx.Locale.Tr "add"}}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
@ -257,6 +274,56 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Releases -->
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ctx.Locale.Tr "actions.general.token_permissions.releases"}}</strong>
|
||||
<p class="text small grey">{{ctx.Locale.Tr "actions.general.token_permissions.releases.description"}}</p>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_releases" value="none" {{if not ($.MaxTokenPermissions.HasRead "releases")}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_releases" value="read" {{if and ($.MaxTokenPermissions.HasRead "releases") (not ($.MaxTokenPermissions.HasWrite "releases"))}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_releases" value="write" {{if $.MaxTokenPermissions.HasWrite "releases"}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Projects -->
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ctx.Locale.Tr "actions.general.token_permissions.projects"}}</strong>
|
||||
<p class="text small grey">{{ctx.Locale.Tr "actions.general.token_permissions.projects.description"}}</p>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_projects" value="none" {{if not ($.MaxTokenPermissions.HasRead "projects")}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_projects" value="read" {{if and ($.MaxTokenPermissions.HasRead "projects") (not ($.MaxTokenPermissions.HasWrite "projects"))}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="max_projects" value="write" {{if $.MaxTokenPermissions.HasWrite "projects"}}checked{{end}}>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user