From 79a5d079ba4d5323e3e1d1cde7618a5554855105 Mon Sep 17 00:00:00 2001 From: Excellencedev Date: Sat, 20 Dec 2025 04:30:49 +0100 Subject: [PATCH] Completely redesign UI --- routers/web/org/setting/actions.go | 14 +- routers/web/repo/setting/actions.go | 12 +- templates/org/settings/actions_general.tmpl | 409 ++++++++--------- templates/org/settings/navbar.tmpl | 5 +- templates/repo/settings/actions_general.tmpl | 447 ++++++++----------- 5 files changed, 387 insertions(+), 500 deletions(-) diff --git a/routers/web/org/setting/actions.go b/routers/web/org/setting/actions.go index fba4e2905c..e06a06b390 100644 --- a/routers/web/org/setting/actions.go +++ b/routers/web/org/setting/actions.go @@ -21,7 +21,7 @@ const ( func ActionsGeneral(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("actions.actions") ctx.Data["PageIsOrgSettings"] = true - ctx.Data["PageIsOrgSettingsActions"] = true + ctx.Data["PageIsOrgSettingsActionsGeneral"] = true // Load Org Actions Config actionsCfg, err := actions_model.GetOrgActionsConfig(ctx, ctx.Org.Organization.AsUser().ID) @@ -85,15 +85,17 @@ func ActionsGeneralPost(ctx *context.Context) { actionsCfg.DefaultTokenPermissions = nil } - // Update Maximum Permissions + // Update Maximum Permissions (radio buttons: none/read/write) parseMaxPerm := func(name string) perm.AccessMode { - if ctx.FormBool("max_" + name + "_write") { + value := ctx.FormString("max_" + name) + switch value { + case "write": return perm.AccessModeWrite - } - if ctx.FormBool("max_" + name + "_read") { + case "read": return perm.AccessModeRead + default: + return perm.AccessModeNone } - return perm.AccessModeNone } actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{ diff --git a/routers/web/repo/setting/actions.go b/routers/web/repo/setting/actions.go index 673af0a0bd..a4f0c9488e 100644 --- a/routers/web/repo/setting/actions.go +++ b/routers/web/repo/setting/actions.go @@ -178,15 +178,17 @@ func UpdateTokenPermissions(ctx *context.Context) { actionsCfg.DefaultTokenPermissions = nil } - // Update Maximum Permissions + // Update Maximum Permissions (radio buttons: none/read/write) parseMaxPerm := func(name string) perm.AccessMode { - if ctx.FormBool("max_" + name + "_write") { + value := ctx.FormString("max_" + name) + switch value { + case "write": return perm.AccessModeWrite - } - if ctx.FormBool("max_" + name + "_read") { + case "read": return perm.AccessModeRead + default: + return perm.AccessModeNone } - return perm.AccessModeNone } actionsCfg.MaxTokenPermissions = &repo_model.ActionsTokenPermissions{ diff --git a/templates/org/settings/actions_general.tmpl b/templates/org/settings/actions_general.tmpl index e56925bcff..ccd42d3361 100644 --- a/templates/org/settings/actions_general.tmpl +++ b/templates/org/settings/actions_general.tmpl @@ -1,234 +1,199 @@ {{template "org/settings/layout_head" .}}

- {{.locale.Tr "actions.actions"}} + {{ctx.Locale.Tr "actions.actions"}} - {{ctx.Locale.Tr "settings.general"}}

-
-
-
- {{.CsrfTokenHtml}} -
- -
-
-
- - -

{{.locale.Tr "actions.general.token_permissions.permissive.description"}}

-
-
-
-
- - -

{{.locale.Tr "actions.general.token_permissions.restricted.description"}}

-
-
-
-
- - -

{{.locale.Tr "actions.general.token_permissions.custom.description"}}

-
-
-
-
+ + {{.CsrfTokenHtml}} - - -

{{.locale.Tr "actions.general.token_permissions.cross_repo"}}

-
-
- - -
-
- -
- -
-
+ +
+
+ + +
+

{{ctx.Locale.Tr "general.token_permissions.cross_repo_desc"}}

-
+
-
{{ctx.Locale.Tr "general.token_permissions.maximum"}}
-

{{ctx.Locale.Tr "general.token_permissions.maximum.description"}}

-
- -
-
- -
- - -
-
- - -
-
-
- -
-
- -
- - -
-
- - -
-
-
- -
-
- -
- - -
-
- - -
-
-
- -
-
- -
- - -
-
- - -
-
-
- -
-
- -
- - -
-
- - -
-
-
- -
-
- -
- - -
-
- - -
-
-
-
+ +
+ {{ctx.Locale.Tr "general.token_permissions.maximum"}} + * +
+

{{ctx.Locale.Tr "general.token_permissions.maximum.description"}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ctx.Locale.Tr "units.unit"}}{{ctx.Locale.Tr "general.token_permissions.access_none"}} ?{{ctx.Locale.Tr "general.token_permissions.access_read"}} ?{{ctx.Locale.Tr "general.token_permissions.access_write"}} ?
+ {{ctx.Locale.Tr "general.token_permissions.contents"}} +

Access source code, files, commits and branches.

+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ {{ctx.Locale.Tr "general.token_permissions.issues"}} +

Organize bug reports, tasks and milestones.

+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ {{ctx.Locale.Tr "general.token_permissions.pull_requests"}} +

Enable pull requests and code reviews.

+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ {{ctx.Locale.Tr "general.token_permissions.wiki"}} +

Write and share documentation with collaborators.

+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ {{ctx.Locale.Tr "general.token_permissions.packages"}} +

Manage repository packages.

+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ {{ctx.Locale.Tr "general.token_permissions.actions_scope"}} +

Manage actions.

+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ +
+ +
+ +
+
{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl index 58475de7e7..4c06b2cb1b 100644 --- a/templates/org/settings/navbar.tmpl +++ b/templates/org/settings/navbar.tmpl @@ -26,9 +26,12 @@ {{end}} {{if .EnableActions}} -
+
{{ctx.Locale.Tr "actions.actions"}}