From c890e8259ca66442397ca3dda5f6b4c601db52af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Niclas=20Oelschl=C3=A4ger?= Date: Sun, 25 Feb 2024 01:30:47 +0100 Subject: [PATCH 1/9] feature: filter branch in select default-branch view --- templates/repo/settings/branches.tmpl | 18 +++++++----------- web_src/css/helpers.css | 1 + .../js/components/RepoBranchTagSelector.vue | 12 +++++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl index fbdc12defb01f..6aeaf58a8ab04 100644 --- a/templates/repo/settings/branches.tmpl +++ b/templates/repo/settings/branches.tmpl @@ -12,20 +12,16 @@

{{ctx.Locale.Tr "repo.settings.default_branch_desc"}}

-
+ {{.CsrfTokenHtml}} + {{if not .Repository.IsEmpty}} - + {{template "repo/branch_dropdown" dict "root" . + "ContainerClasses" "gt-w-24rem gt-mr-4" + "branchForm" "js-default-branch" + "noTag" true + }} {{end}}
diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index da94ebb4862ed..81fff4c760fde 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -78,6 +78,7 @@ Gitea's private styles use `g-` prefix. .gt-w-auto { width: auto !important; } .gt-w-screen { width: 100vw !important; } .gt-w-full { width: 100% !important; } +.gt-w-24rem { width: 24rem !important; } .gt-float-left { float: left !important; } .gt-float-right { float: right !important; } diff --git a/web_src/js/components/RepoBranchTagSelector.vue b/web_src/js/components/RepoBranchTagSelector.vue index bc7d979d9987d..cb9881c6f5a83 100644 --- a/web_src/js/components/RepoBranchTagSelector.vue +++ b/web_src/js/components/RepoBranchTagSelector.vue @@ -91,9 +91,11 @@ const sfc = { if (item.tag) { this.isViewTag = true; $(`#${this.branchForm} input[name="refType"]`).val('tag'); + $(`#${this.branchForm} input[name="tag"]`).val(item.name); } else { this.isViewBranch = true; $(`#${this.branchForm} input[name="refType"]`).val('branch'); + $(`#${this.branchForm} input[name="branch"]`).val(item.name); } if (this.submitForm) { $(`#${this.branchForm}`).trigger('submit'); @@ -244,14 +246,14 @@ export function initRepoBranchTagSelector(selector) { export default sfc; // activate IDE's Vue plugin