Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: show issue assignee on project board #15232

Merged
merged 9 commits into from
Mar 8, 2022
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,8 @@ projects.board.deletion_desc = "Deleting a project board moves all related issue
projects.board.color = "Color"
projects.open = Open
projects.close = Close
projects.board.assigned_to = Assigned to
projects.board.opened_by = opened by

issues.desc = Organize bug reports, tasks and milestones.
issues.filter_assignees = Filter Assignee
Expand Down
28 changes: 21 additions & 7 deletions templates/repo/projects/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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="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)}}
<div class="ui dropdown jump item tooltip">
<div class="not-mobile px-3" tabindex="-1">
Expand Down Expand Up @@ -212,9 +217,12 @@
{{end}}
</span>
</div>
<div class="meta">
#{{.Index}} {{$.i18n.Tr "repo.projects.board.opened_by"}} <a target="_blank" href="{{.Poster.HTMLURL}}">{{.Poster.Name}}</a>
</div>
{{- if .MilestoneID }}
<div class="meta my-2">
<a class="milestone" href="{{$.RepoLink}}/milestone/{{ .MilestoneID}}">
<a class="milestone" target="_blank" href="{{$.RepoLink}}/milestone/{{ .MilestoneID}}">
{{svg "octicon-milestone" 16 "mr-2 vm"}}
<span class="vm">{{ .Milestone.Name }}</span>
</a>
Expand All @@ -229,13 +237,19 @@
</div>
{{- end }}
</div>
{{if .Labels}}
<div class="extra content labels-list p-0 pt-2">
{{ range .Labels }}
<a class="ui label" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}};" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>

{{ if or .Labels .Assignees }}
<div class="extra content labels-list p-0 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>
{{ 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>
{{end}}
</div>
{{ end }}
</div>
<!-- stop issue card -->

Expand Down
8 changes: 8 additions & 0 deletions web_src/js/features/repo-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ import $ from 'jquery';

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}) {
const columnCards = to.getElementsByClassName('board-card');
updateIssueCount(from);
updateIssueCount(to);

const columnSorting = {
issues: [...columnCards].map((card, i) => ({
Expand Down
1 change: 1 addition & 0 deletions web_src/less/features/projects.less
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
.board-column > .cards {
flex: 1;
display: flex;
align-content: baseline;
margin: 0 !important;
padding: 0 !important;
flex-wrap: nowrap !important;
Expand Down