From 4cde56906e83e0b182f0b6a34c5467e8df7516aa Mon Sep 17 00:00:00 2001 From: Otto Richter Date: Fri, 27 Dec 2024 14:21:46 +0100 Subject: [PATCH] New repo: Rework advanced and template sections - make sections collapsible - only offer object format selection when there is an actual choice --- options/locale/locale_en-US.ini | 4 + templates/repo/create.tmpl | 104 +++-------------------- templates/repo/create_advanced.tmpl | 45 ++++++++++ templates/repo/create_basic.tmpl | 4 +- templates/repo/create_from_template.tmpl | 49 +++++++++++ 5 files changed, 114 insertions(+), 92 deletions(-) create mode 100644 templates/repo/create_advanced.tmpl create mode 100644 templates/repo/create_from_template.tmpl diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 3b413b8f92..460f318292 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1053,6 +1053,10 @@ admin.failed_to_replace_flags = Failed to replace repository flags admin.flags_replaced = Repository flags replaced new_repo_helper = A repository contains all project files, including revision history. Already hosting one elsewhere? Migrate repository. +new_from_template = Use a template +new_from_template_description = You can select an existing repository template on this instance and apply its settings. +new_advanced = Advanced settings +new_advanced_expand = Click to expand owner = Owner owner_helper = Some organizations may not show up in the dropdown due to a maximum repository count limit. repo_name = Repository name diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 79ed22d78e..8212033242 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -20,75 +20,22 @@ {{template "repo/create_basic" .}} -
- - -
- -
-
- -
- - -
-
- - -
-
-
- -
- - -
-
- - -
-
-
- -
- - -
-
- - -
-
-
- -
- - -
-
-
+
+ + {{ctx.Locale.Tr "repo.new_from_template"}} + {{ctx.Locale.Tr "repo.new_from_template_description"}} + + {{template "repo/create_from_template" .}} +
-
- - -
+
+ {{ctx.Locale.Tr "repo.new_advanced"}} +
{{ctx.Locale.Tr "repo.new_advanced_expand"}} + {{template "repo/create_advanced" .}} +
+
-
@@ -137,31 +84,6 @@
-
- - - {{ctx.Locale.Tr "repo.default_branch_helper"}} -
-
- - - {{ctx.Locale.Tr "repo.object_format_helper"}} -
-
- -
- - -
-

diff --git a/templates/repo/create_advanced.tmpl b/templates/repo/create_advanced.tmpl new file mode 100644 index 0000000000..c0274701f8 --- /dev/null +++ b/templates/repo/create_advanced.tmpl @@ -0,0 +1,45 @@ + + +{{$supportedFormatsLength := len .SupportedObjectFormats}} +{{/* Only offer object format selection if there is an actual choice */}} +{{if ge $supportedFormatsLength 2}} + +{{else}} + +{{end}} + + + + diff --git a/templates/repo/create_basic.tmpl b/templates/repo/create_basic.tmpl index 78a4e8b957..0396629fef 100644 --- a/templates/repo/create_basic.tmpl +++ b/templates/repo/create_basic.tmpl @@ -1,5 +1,7 @@ -