aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Luo2022-03-09 00:42:28 +0800
committerGitHub2022-03-09 00:42:28 +0800
commitbbce905b6acb3f91489ed902bcf9cdeb019d3a58 (patch)
treea4052ea2072e4c3c268b38526e280a49ff196f22
parent1546580f9e6bcb5fcd057e0cb10b1884efee3763 (diff)
Feature: show issue assignee on project board (#15232)
* Show assignees in project boards.
-rw-r--r--options/locale/locale_en-US.ini1
-rw-r--r--templates/repo/projects/view.tmpl23
-rw-r--r--web_src/js/features/repo-projects.js8
-rw-r--r--web_src/less/features/projects.less1
4 files changed, 27 insertions, 6 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 6a7f9bb47..90309c9df 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1181,6 +1181,7 @@ 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
issues.desc = Organize bug reports, tasks and milestones.
issues.filter_assignees = Filter Assignee
diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl
index 6db102553..e96b92fb7 100644
--- a/templates/repo/projects/view.tmpl
+++ b/templates/repo/projects/view.tmpl
@@ -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">
@@ -229,13 +234,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 -->
diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js
index 3147626b5..a948eba80 100644
--- a/web_src/js/features/repo-projects.js
+++ b/web_src/js/features/repo-projects.js
@@ -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) => ({
diff --git a/web_src/less/features/projects.less b/web_src/less/features/projects.less
index 99722b6cc..21514688b 100644
--- a/web_src/less/features/projects.less
+++ b/web_src/less/features/projects.less
@@ -48,6 +48,7 @@
.board-column > .cards {
flex: 1;
display: flex;
+ align-content: baseline;
margin: 0 !important;
padding: 0 !important;
flex-wrap: nowrap !important;