diff options
author | silverwind <me@silverwind.io> | 2020-11-17 06:02:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 07:02:41 +0200 |
commit | b83825253ed803221b3f78162a638d392534cd47 (patch) | |
tree | d61323ffc400e88276d7ece2a41c0538be56ff7b /templates/repo/issue | |
parent | 0a6ce3eaf19649e2254f9c1ca72288d6c01edbf2 (diff) | |
download | gitea-b83825253ed803221b3f78162a638d392534cd47.tar.gz gitea-b83825253ed803221b3f78162a638d392534cd47.zip |
Fix label display on new issues (#13590)
* Fix label display on new issues
PR #13570 broke label rendering for new issues and pulls because
missed the fact that the code was relying on the DOM elements being
toggled by JavaScript.
On top of that, the label rendering for new issues and pull was using
an outdated template which I consolidated in a new shared template.
* remove wrapper element and style tweaks
* style tweaks
* use shared template for whole label list
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'templates/repo/issue')
-rw-r--r-- | templates/repo/issue/labels/label.tmpl | 9 | ||||
-rw-r--r-- | templates/repo/issue/labels/labels_sidebar.tmpl | 9 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 14 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 20 |
4 files changed, 20 insertions, 32 deletions
diff --git a/templates/repo/issue/labels/label.tmpl b/templates/repo/issue/labels/label.tmpl new file mode 100644 index 0000000000..d76dc6af73 --- /dev/null +++ b/templates/repo/issue/labels/label.tmpl @@ -0,0 +1,9 @@ +<a + class="ui label item {{if not .label.IsChecked}}hide{{end}}" + id="label_{{.label.ID}}" + href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}" + style="color: {{.label.ForegroundColor}}; background-color: {{.label.Color}}" + title="{{.label.Description | RenderEmojiPlain}}" +> + {{.label.Name | RenderEmoji}} +</a> diff --git a/templates/repo/issue/labels/labels_sidebar.tmpl b/templates/repo/issue/labels/labels_sidebar.tmpl new file mode 100644 index 0000000000..bf6f98c888 --- /dev/null +++ b/templates/repo/issue/labels/labels_sidebar.tmpl @@ -0,0 +1,9 @@ +<div class="ui labels list"> + <span class="no-select item {{if .ctx.HasSelectedLabel}}hide{{end}}">{{.ctx.i18n.Tr "repo.issues.new.no_label"}}</span> + {{range .ctx.Labels}} + {{template "repo/issue/labels/label" dict "root" $ "label" .}} + {{end}} + {{range .ctx.OrgLabels}} + {{template "repo/issue/labels/label" dict "root" $ "label" .}} + {{end}} +</div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index e585fc7359..73a3851e17 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -70,19 +70,7 @@ {{end}} </div> </div> - <div class="ui labels list"> - <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span> - {{range .Labels}} - {{if .IsChecked}} - <a class="item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name | RenderEmoji}}</span></a> - {{end}} - {{end}} - {{range .OrgLabels}} - {{if .IsChecked}} - <a class="item" id="label_{{.ID}}" href="/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name | RenderEmoji}}</span></a> - {{end}} - {{end}} - </div> + {{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}} <div class="ui divider"></div> diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 21c7a9d365..55a625ec5f 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -125,25 +125,7 @@ {{end}} </div> </div> - <div class="ui labels list"> - {{if not .HasSelectedLabel}} - <span class="no-select item">{{.i18n.Tr "repo.issues.new.no_label"}}</span> - {{end}} - {{range .Labels}} - {{if .IsChecked}} - <div class="item"> - <a class="ui label" id="label_{{.ID}}" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a> - </div> - {{end}} - {{end}} - {{range .OrgLabels}} - {{if .IsChecked}} - <div class="item"> - <a class="ui label" id="label_{{.ID}}" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a> - </div> - {{end}} - {{end}} - </div> + {{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}} <div class="ui divider"></div> |