Feature: show issue assignee on project board (#15232)

* Show assignees in project boards.
This commit is contained in:
Roger Luo 2022-03-09 00:42:28 +08:00 committed by GitHub
parent 1546580f9e
commit bbce905b6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 6 deletions

View file

@ -1181,6 +1181,7 @@ projects.board.deletion_desc = "Deleting a project board moves all related issue
projects.board.color = "Color" projects.board.color = "Color"
projects.open = Open projects.open = Open
projects.close = Close projects.close = Close
projects.board.assigned_to = Assigned to
issues.desc = Organize bug reports, tasks and milestones. issues.desc = Organize bug reports, tasks and milestones.
issues.filter_assignees = Filter Assignee issues.filter_assignees = Filter Assignee

View file

@ -82,7 +82,12 @@
<div class="ui segment board-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}"> <div class="ui segment board-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}">
<div class="board-column-header df ac sb"> <div class="board-column-header df ac sb">
<div class="ui large label board-label py-2">{{.Title}}</div> <div class="ui large label board-label py-2">
<div class="ui small circular grey label board-card-cnt">
{{len .Issues}}
</div>
{{.Title}}
</div>
{{if and $.CanWriteProjects (not $.Repository.IsArchived) (ne .ID 0)}} {{if and $.CanWriteProjects (not $.Repository.IsArchived) (ne .ID 0)}}
<div class="ui dropdown jump item tooltip"> <div class="ui dropdown jump item tooltip">
<div class="not-mobile px-3" tabindex="-1"> <div class="not-mobile px-3" tabindex="-1">
@ -229,11 +234,17 @@
</div> </div>
{{- end }} {{- end }}
</div> </div>
{{if .Labels}}
{{ if or .Labels .Assignees }}
<div class="extra content labels-list p-0 pt-2"> <div class="extra content labels-list p-0 pt-2">
{{ range .Labels }} {{ range .Labels }}
<a class="ui label" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}};" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a> <a class="ui label" target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}};" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
{{ end }} {{ end }}
<div class="right floated">
{{ range .Assignees }}
<a class="tooltip" target="_blank" href="{{.HTMLURL}}" data-content="{{$.i18n.Tr "repo.projects.board.assigned_to"}} {{.Name}}">{{avatar . 28 "mini mr-3"}}</a>
{{ end }}
</div>
</div> </div>
{{ end }} {{ end }}
</div> </div>

View file

@ -2,8 +2,16 @@ import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
function updateIssueCount(cards) {
const parent = cards.parentElement;
const cnt = parent.getElementsByClassName('board-card').length;
parent.getElementsByClassName('board-card-cnt')[0].innerText = cnt;
}
function moveIssue({item, from, to, oldIndex}) { function moveIssue({item, from, to, oldIndex}) {
const columnCards = to.getElementsByClassName('board-card'); const columnCards = to.getElementsByClassName('board-card');
updateIssueCount(from);
updateIssueCount(to);
const columnSorting = { const columnSorting = {
issues: [...columnCards].map((card, i) => ({ issues: [...columnCards].map((card, i) => ({

View file

@ -48,6 +48,7 @@
.board-column > .cards { .board-column > .cards {
flex: 1; flex: 1;
display: flex; display: flex;
align-content: baseline;
margin: 0 !important; margin: 0 !important;
padding: 0 !important; padding: 0 !important;
flex-wrap: nowrap !important; flex-wrap: nowrap !important;