diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-10 16:44:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-10 16:44:02 +0800 |
commit | 4e3348135723dfc03dcc91b196b5da6f20b8a4ea (patch) | |
tree | 8734e1d537d93243dd6ba478b9f2890cc8ac0d89 /templates | |
parent | bb6c670cff1a081d9f5f8bdb3dc91abe5d9e35b9 (diff) | |
download | gitea-4e3348135723dfc03dcc91b196b5da6f20b8a4ea.tar.gz gitea-4e3348135723dfc03dcc91b196b5da6f20b8a4ea.zip |
Make label templates have consistent behavior and priority (#23749)
Fix https://github.com/go-gitea/gitea/issues/23715
Other related PRs:
* #23717
* #23716
* #23719
This PR is different from others, it tries to resolve the problem fundamentally (and brings more benefits)
Although it looks like some more lines are added, actually many new lines are for tests.
----
Before, the code was just "guessing" the file type and try to parse them.
<details>
![image](https://user-images.githubusercontent.com/2114189/228002245-57d58e27-1078-4da9-bf42-5bc0b264c6ce.png)
</details>
This PR:
* Always remember the original option file names, and always use correct parser for them.
* Another benefit is that we can sort the Label Templates now (before there was a map, its key order is undefined)
![image](https://user-images.githubusercontent.com/2114189/228002432-931b9f18-3908-484b-a36b-04760c9ad132.png)
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/create.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_load_template.tmpl | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 721caec23f..85b02f394d 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -117,8 +117,8 @@ <div class="default text">{{.locale.Tr "repo.issue_labels_helper"}}</div> <div class="menu"> <div class="item" data-value="">{{.locale.Tr "repo.issue_labels_helper"}}</div> - {{range $template, $labels := .LabelTemplates}} - <div class="item" data-value="{{$template}}">{{$template}}<br><i>({{$labels}})</i></div> + {{range .LabelTemplateFiles}} + <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div> {{end}} </div> </div> diff --git a/templates/repo/issue/labels/label_load_template.tmpl b/templates/repo/issue/labels/label_load_template.tmpl index 21caf2b472..d883953bf6 100644 --- a/templates/repo/issue/labels/label_load_template.tmpl +++ b/templates/repo/issue/labels/label_load_template.tmpl @@ -10,8 +10,8 @@ <input type="hidden" name="template_name" value="Default"> <div class="default text">{{.locale.Tr "repo.issues.label_templates.helper"}}</div> <div class="menu"> - {{range $template, $labels := .LabelTemplates}} - <div class="item" data-value="{{$template}}">{{$template}}<br><i>({{$labels}})</i></div> + {{range .LabelTemplateFiles}} + <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div> {{end}} </div> {{svg "octicon-triangle-down" 18 "dropdown icon"}} |