diff options
author | Brecht Van Lommel <brecht@blender.org> | 2023-02-18 20:17:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-18 21:17:39 +0200 |
commit | 6221a6fd5450692ae27e5602b41fc9ebd9150736 (patch) | |
tree | 143232d24acdc5269458e2746125d6a49884fb37 /templates | |
parent | feed1ff38f88115f27ea2357a97c21e5277aac88 (diff) | |
download | gitea-6221a6fd5450692ae27e5602b41fc9ebd9150736.tar.gz gitea-6221a6fd5450692ae27e5602b41fc9ebd9150736.zip |
Scoped labels (#22585)
Add a new "exclusive" option per label. This makes it so that when the
label is named `scope/name`, no other label with the same `scope/`
prefix can be set on an issue.
The scope is determined by the last occurence of `/`, so for example
`scope/alpha/name` and `scope/beta/name` are considered to be in
different scopes and can coexist.
Exclusive scopes are not enforced by any database rules, however they
are enforced when editing labels at the models level, automatically
removing any existing labels in the same scope when either attaching a
new label or replacing all labels.
In menus use a circle instead of checkbox to indicate they function as
radio buttons per scope. Issue filtering by label ensures that only a
single scoped label is selected at a time. Clicking with alt key can be
used to remove a scoped label, both when editing individual issues and
batch editing.
Label rendering refactor for consistency and code simplification:
* Labels now consistently have the same shape, emojis and tooltips
everywhere. This includes the label list and label assignment menus.
* In label list, show description below label same as label menus.
* Don't use exactly black/white text colors to look a bit nicer.
* Simplify text color computation. There is no point computing luminance
in linear color space, as this is a perceptual problem and sRGB is
closer to perceptually linear.
* Increase height of label assignment menus to show more labels. Showing
only 3-4 labels at a time leads to a lot of scrolling.
* Render all labels with a new RenderLabel template helper function.
Label creation and editing in multiline modal menu:
* Change label creation to open a modal menu like label editing.
* Change menu layout to place name, description and colors on separate
lines.
* Don't color cancel button red in label editing modal menu.
* Align text to the left in model menu for better readability and
consistent with settings layout elsewhere.
Custom exclusive scoped label rendering:
* Display scoped label prefix and suffix with slightly darker and
lighter background color respectively, and a slanted edge between them
similar to the `/` symbol.
* In menus exclusive labels are grouped with a divider line.
---------
Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/projects/view.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/labels/edit_delete_label.tmpl | 42 | ||||
-rw-r--r-- | templates/repo/issue/labels/label.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_list.tmpl | 34 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_new.tmpl | 56 | ||||
-rw-r--r-- | templates/repo/issue/list.tmpl | 16 | ||||
-rw-r--r-- | templates/repo/issue/milestone_issues.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 16 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 16 | ||||
-rw-r--r-- | templates/repo/projects/view.tmpl | 2 | ||||
-rw-r--r-- | templates/shared/issuelist.tmpl | 2 | ||||
-rw-r--r-- | templates/swagger/v1_json.tmpl | 18 |
12 files changed, 145 insertions, 69 deletions
diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl index 112e6be7ce..b25cf2526e 100644 --- a/templates/projects/view.tmpl +++ b/templates/projects/view.tmpl @@ -234,7 +234,7 @@ {{if or .Labels .Assignees}} <div class="extra content labels-list gt-p-0 gt-pt-2"> {{range .Labels}} - <a class="ui label" target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}};" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a> + <a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel .}}</a> {{end}} <div class="right floated"> {{range .Assignees}} diff --git a/templates/repo/issue/labels/edit_delete_label.tmpl b/templates/repo/issue/labels/edit_delete_label.tmpl index a0479dde1b..450061e835 100644 --- a/templates/repo/issue/labels/edit_delete_label.tmpl +++ b/templates/repo/issue/labels/edit_delete_label.tmpl @@ -26,31 +26,45 @@ <form class="ui edit-label form ignore-dirty" action="{{$.Link}}/edit" method="post"> {{.CsrfTokenHtml}} <input id="label-modal-id" name="id" type="hidden"> - <div class="ui grid"> - <div class="three wide column"> - <div class="ui small input"> - <input class="new-label-input emoji-input" name="title" placeholder="{{.locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> - </div> + <div class="required field"> + <label for="name">{{.locale.Tr "repo.issues.label_title"}}</label> + <div class="ui small input"> + <input class="label-name-input emoji-input" name="title" placeholder="{{.locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> </div> - <div class="five wide column"> - <div class="ui small fluid input"> - <input class="new-label-desc-input" name="description" placeholder="{{.locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> - </div> + </div> + <div class="field label-exclusive-input-field"> + <div class="ui checkbox"> + <input class="label-exclusive-input" name="exclusive" type="checkbox"> + <label>{{.locale.Tr "repo.issues.label_exclusive"}}</label> </div> + <br/> + <small class="desc">{{.locale.Tr "repo.issues.label_exclusive_desc" | Safe}}</small> + <div class="desc gt-ml-2 gt-mt-3 gt-hidden label-exclusive-warning"> + {{svg "octicon-alert"}} {{.locale.Tr "repo.issues.label_exclusive_warning" | Safe}} + </div> + </div> + <div class="field"> + <label for="description">{{.locale.Tr "repo.issues.label_description"}}</label> + <div class="ui small fluid input"> + <input class="label-desc-input" name="description" placeholder="{{.locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> + </div> + <div class="field color-field"> + <label for="color">{{$.locale.Tr "repo.issues.label_color"}}</label> <div class="color picker column"> <input class="color-picker" name="color" value="#70c24a" required maxlength="7"> - </div> - <div class="column precolors"> - {{template "repo/issue/label_precolors"}} + <div class="column precolors"> + {{template "repo/issue/label_precolors"}} + </div> </div> </div> </form> </div> <div class="actions"> - <div class="ui negative button"> + <div class="ui secondary small basic cancel button"> {{.locale.Tr "cancel"}} </div> - <div class="ui positive button"> + <div class="ui primary small approve button"> {{.locale.Tr "save"}} </div> </div> diff --git a/templates/repo/issue/labels/label.tmpl b/templates/repo/issue/labels/label.tmpl index 0afe5cb6e7..87d8f0c41c 100644 --- a/templates/repo/issue/labels/label.tmpl +++ b/templates/repo/issue/labels/label.tmpl @@ -1,9 +1,7 @@ <a - class="ui label item {{if not .label.IsChecked}}hide{{end}}" + class="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}}"{{/* FIXME: use .root.Issue.Link or create .root.Link */}} - style="color: {{.label.ForegroundColor}}; background-color: {{.label.Color}}" - title="{{.label.Description | RenderEmojiPlain}}" > - {{.label.Name | RenderEmoji}} + {{RenderLabel .label}} </a> diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl index 464c9fe208..e8f00fa256 100644 --- a/templates/repo/issue/labels/label_list.tmpl +++ b/templates/repo/issue/labels/label_list.tmpl @@ -30,28 +30,24 @@ {{range .Labels}} <li class="item"> <div class="ui grid middle aligned"> - <div class="four wide column"> - <div class="ui label" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{svg "octicon-tag"}} {{.Name | RenderEmoji}}</div> - </div> - <div class="six wide column"> - <div class="ui"> - {{.Description | RenderEmoji}} - </div> + <div class="nine wide column"> + {{RenderLabel .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}} </div> - <div class="three wide column"> + <div class="four wide column"> {{if $.PageIsOrgSettingsLabels}} - <a class="ui right open-issues" href="{{AppSubUrl}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> + <a class="ui left open-issues" href="{{AppSubUrl}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> {{else}} - <a class="ui right open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> + <a class="ui left open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> {{end}} </div> <div class="three wide column"> {{if and (not $.PageIsOrgSettingsLabels ) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}} <a class="ui right delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a> - <a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a> + <a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a> {{else if $.PageIsOrgSettingsLabels}} <a class="ui right delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{$.locale.Tr "repo.issues.label_delete"}}</a> - <a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a> + <a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{$.locale.Tr "repo.issues.label_edit"}}</a> {{end}} </div> </div> @@ -73,16 +69,12 @@ {{range .OrgLabels}} <li class="item"> <div class="ui grid middle aligned"> - <div class="three wide column"> - <div class="ui label" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{svg "octicon-tag"}} {{.Name | RenderEmoji}}</div> + <div class="nine wide column"> + {{RenderLabel .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}} </div> - <div class="seven wide column"> - <div class="ui"> - {{.Description | RenderEmoji}} - </div> - </div> - <div class="three wide column"> - <a class="ui right open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a> + <div class="four wide column"> + <a class="ui left open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{$.locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a> </div> <div class="three wide column"> </div> diff --git a/templates/repo/issue/labels/label_new.tmpl b/templates/repo/issue/labels/label_new.tmpl index 035a4db800..62f7155b74 100644 --- a/templates/repo/issue/labels/label_new.tmpl +++ b/templates/repo/issue/labels/label_new.tmpl @@ -1,27 +1,47 @@ -<div class="ui new-label segment hide"> - <form class="ui form" action="{{$.Link}}/new" method="post"> - {{.CsrfTokenHtml}} - <div class="ui grid"> - <div class="three wide column"> +<div class="ui small new-label modal"> + <div class="header"> + {{.locale.Tr "repo.issues.new_label"}} + </div> + <div class="content"> + <form class="ui new-label form ignore-dirty" action="{{$.Link}}/new" method="post"> + {{.CsrfTokenHtml}} + <div class="required field"> + <label for="name">{{.locale.Tr "repo.issues.label_title"}}</label> <div class="ui small input"> - <input class="new-label-input emoji-input" name="title" placeholder="{{.locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> + <input class="label-name-input emoji-input" name="title" placeholder="{{.locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> </div> </div> - <div class="three wide column"> - <div class="ui small fluid input"> - <input class="new-label-desc-input" name="description" placeholder="{{.locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + <div class="field label-exclusive-input-field"> + <div class="ui checkbox"> + <input class="label-exclusive-input" name="exclusive" type="checkbox"> + <label>{{.locale.Tr "repo.issues.label_exclusive"}}</label> </div> + <br/> + <small class="desc">{{.locale.Tr "repo.issues.label_exclusive_desc" | Safe}}</small> </div> - <div class="color picker column"> - <input class="color-picker" name="color" value="#70c24a" required maxlength="7"> - </div> - <div class="column precolors"> - {{template "repo/issue/label_precolors"}} + <div class="field"> + <label for="description">{{.locale.Tr "repo.issues.label_description"}}</label> + <div class="ui small fluid input"> + <input class="label-desc-input" name="description" placeholder="{{.locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> </div> - <div class="buttons"> - <div class="ui secondary small basic cancel button">{{.locale.Tr "repo.milestones.cancel"}}</div> - <button class="ui primary small button">{{.locale.Tr "repo.issues.create_label"}}</button> + <div class="field color-field"> + <label for="color">{{$.locale.Tr "repo.issues.label_color"}}</label> + <div class="color picker column"> + <input class="color-picker" name="color" value="#70c24a" required maxlength="7"> + <div class="column precolors"> + {{template "repo/issue/label_precolors"}} + </div> + </div> </div> + </form> + </div> + <div class="actions"> + <div class="ui secondary small basic cancel button"> + {{.locale.Tr "cancel"}} + </div> + <div class="ui primary small approve button"> + {{.locale.Tr "repo.issues.create_label"}} </div> - </form> + </div> </div> diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 4b55e7bec8..0e4969a706 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -50,8 +50,14 @@ </div> <span class="info">{{.locale.Tr "repo.issues.filter_label_exclude" | Safe}}</span> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_label_no_select"}}</a> + {{$previousExclusiveScope := "_no_scope"}} {{range .Labels}} - <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{svg "octicon-check"}}{{end}}<span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}</a> + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="ui divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel .}}</a> {{end}} </div> </div> @@ -217,9 +223,15 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} </span> <div class="menu"> + {{$previousExclusiveScope := "_no_scope"}} {{range .Labels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="ui divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} <div class="item issue-action" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels"> - {{if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}}<span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}} + {{if contain $.SelLabelIDs .ID}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel .}} </div> {{end}} </div> diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 8d6a97a713..57012bddb6 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -58,7 +58,7 @@ <span class="info">{{.locale.Tr "repo.issues.filter_label_exclude" | Safe}}</span> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_label_no_select"}}</a> {{range .Labels}} - <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}}<span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}</a> + <a class="item label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" data-label-id="{{.ID}}">{{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}} {{RenderLabel .}}</a> {{end}} </div> </div> @@ -161,7 +161,7 @@ <div class="menu"> {{range .Labels}} <div class="item issue-action" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels"> - {{if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}}<span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}} + {{if contain $.SelLabelIDs .ID}}{{svg "octicon-check"}}{{end}} {{RenderLabel .}} </div> {{end}} </div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 8fbd9d256a..2a6fcaa995 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -53,14 +53,26 @@ {{end}} <div class="no-select item">{{.locale.Tr "repo.issues.new.clear_labels"}}</div> {{if or .Labels .OrgLabels}} + {{$previousExclusiveScope := "_no_scope"}} {{range .Labels}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="ui divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> {{end}} <div class="ui divider"></div> + {{$previousExclusiveScope := "_no_scope"}} {{range .OrgLabels}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="ui divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> {{end}} {{else}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 9ba46f3715..8cd34ede6e 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -123,13 +123,25 @@ {{end}} <div class="no-select item">{{.locale.Tr "repo.issues.new.clear_labels"}}</div> {{if or .Labels .OrgLabels}} + {{$previousExclusiveScope := "_no_scope"}} {{range .Labels}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="ui divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> {{end}} <div class="ui divider"></div> + {{$previousExclusiveScope := "_no_scope"}} {{range .OrgLabels}} - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="ui divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel .}} {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a> {{end}} {{else}} diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl index de0911e6cd..a4ada87353 100644 --- a/templates/repo/projects/view.tmpl +++ b/templates/repo/projects/view.tmpl @@ -245,7 +245,7 @@ {{if or .Labels .Assignees}} <div class="extra content labels-list gt-p-0 gt-pt-2"> {{range .Labels}} - <a class="ui label" target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}};" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a> + <a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel .}}</a> {{end}} <div class="right floated"> {{range .Assignees}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index a246b70093..a43047c79d 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -42,7 +42,7 @@ {{end}} <span class="labels-list gt-ml-2"> {{range .Labels}} - <a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a> + <a href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{RenderLabel .}}</a> {{end}} </span> </div> diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 00fc3b60c4..2a675766ab 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -15348,6 +15348,11 @@ "type": "string", "x-go-name": "Description" }, + "exclusive": { + "type": "boolean", + "x-go-name": "Exclusive", + "example": false + }, "name": { "type": "string", "x-go-name": "Name" @@ -16283,12 +16288,18 @@ "properties": { "color": { "type": "string", - "x-go-name": "Color" + "x-go-name": "Color", + "example": "#00aabb" }, "description": { "type": "string", "x-go-name": "Description" }, + "exclusive": { + "type": "boolean", + "x-go-name": "Exclusive", + "example": false + }, "name": { "type": "string", "x-go-name": "Name" @@ -17615,6 +17626,11 @@ "type": "string", "x-go-name": "Description" }, + "exclusive": { + "type": "boolean", + "x-go-name": "Exclusive", + "example": false + }, "id": { "type": "integer", "format": "int64", |