From d3ce829a3843241392a39ebabfb56b46870ca8df Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 16 Nov 2020 22:52:11 +0100 Subject: [PATCH 01/15] Issue and Pulls lists rework Reorganized and restyled the issue and pull request lists. --- templates/repo/issue/list.tmpl | 193 +++++++++++++---------- web_src/less/_base.less | 10 ++ web_src/less/_repository.less | 81 +++++++--- web_src/less/themes/theme-arc-green.less | 17 +- 4 files changed, 181 insertions(+), 120 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 78223ce56a186..899cff8cc8a68 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -204,97 +204,128 @@
{{ $approvalCounts := .ApprovalCounts}} {{range .Issues}} -
  • - {{if $.CanWriteIssuesOrPulls}} -
    - -
    - {{end}} -
    #{{.Index}}
    - {{RenderEmoji .Title}} - - {{if .IsPull }} - {{if (index $.CommitStatus .PullRequest.ID)}} - {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} - {{end}} - {{end}} - - {{range .Labels}} - {{.Name | RenderEmoji}} - {{end}} - - {{if .NumComments}} - {{svg "octicon-comment"}} {{.NumComments}} - {{end}} - - {{if .TotalTrackedTime}} - {{svg "octicon-clock"}} {{.TotalTrackedTime | Sec2Time}} - {{end}} - -

    - {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} - {{if .OriginalAuthor }} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}} - {{else if gt .Poster.ID 0}} - {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}} - {{else}} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} - {{end}} - - {{if .Milestone}} - - {{svg "octicon-milestone"}} {{.Milestone.Name}} - - {{end}} - {{if .Ref}} - - {{svg "octicon-git-branch"}} {{index $.IssueRefEndNames .ID}} - - {{end}} - {{$tasks := .GetTasks}} - {{if gt $tasks 0}} - {{$tasksDone := .GetTasksDone}} - - {{svg "octicon-checklist"}} {{$tasksDone}} / {{$tasks}} - +

  • +
    + {{if $.CanWriteIssuesOrPulls}} +
    + + +
    {{end}} - {{if ne .DeadlineUnix 0}} - - {{svg "octicon-calendar"}}{{.DeadlineUnix.FormatShort}} +
    + {{if .IsPull}} + {{if .PullRequest.HasMerged}} + {{svg "octicon-git-merge" 16 "text purple"}} + {{else}} + {{if .IsClosed}} + {{svg "octicon-git-pull-request" 16 "text red"}} + {{else}} + {{svg "octicon-git-pull-request" 16 "text green"}} + {{end}} + {{end}} + {{else}} + {{if .IsClosed}} + {{svg "octicon-issue-opened" 16 "text red"}} + {{else}} + {{svg "octicon-issue-closed" 16 "text green"}} + {{end}} + {{end}} +
    +
    +
    +
    + {{RenderEmoji .Title}} + {{if .IsPull }} + {{if (index $.CommitStatus .PullRequest.ID)}} + {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} + {{end}} + {{end}} + {{range .Labels}} + {{.Name | RenderEmoji}} + {{end}} +
    +
    + + #{{.Index}} - {{end}} - {{range .Assignees}} - - - - {{end}} - {{if .IsPull}} - {{$approveOfficial := call $approvalCounts .ID "approve"}} - {{$rejectOfficial := call $approvalCounts .ID "reject"}} - {{$waitingOfficial := call $approvalCounts .ID "waiting"}} - {{if gt $approveOfficial 0}} - {{svg "octicon-check"}} - {{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}} - + {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} + {{if .OriginalAuthor }} + {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}} + {{else if gt .Poster.ID 0}} + {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}} + {{else}} + {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} {{end}} - {{if gt $rejectOfficial 0}} - {{svg "octicon-diff"}} - {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}} + {{if .Milestone}} + + {{svg "octicon-milestone"}} {{.Milestone.Name}} + + {{end}} + {{if .Ref}} + + {{svg "octicon-git-branch"}} {{index $.IssueRefEndNames .ID}} + + {{end}} + {{$tasks := .GetTasks}} + {{if gt $tasks 0}} + {{$tasksDone := .GetTasksDone}} + + {{svg "octicon-checklist"}} {{$tasksDone}} / {{$tasks}} {{end}} - - {{if gt $waitingOfficial 0}} - {{svg "octicon-eye"}} - {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}} + {{if ne .DeadlineUnix 0}} + + {{svg "octicon-calendar"}}{{.DeadlineUnix.FormatShort}} {{end}} + {{if .IsPull}} + {{$approveOfficial := call $approvalCounts .ID "approve"}} + {{$rejectOfficial := call $approvalCounts .ID "reject"}} + {{$waitingOfficial := call $approvalCounts .ID "waiting"}} + {{if gt $approveOfficial 0}} + {{svg "octicon-check"}} + {{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}} + + {{end}} + + {{if gt $rejectOfficial 0}} + {{svg "octicon-diff"}} + {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}} + + {{end}} + + {{if gt $waitingOfficial 0}} + {{svg "octicon-eye"}} + {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}} + + {{end}} - {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} - {{svg "octicon-x"}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} + {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} + {{svg "octicon-x"}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} + {{end}} {{end}} - {{end}} -

    +
    +
    +
    +
    + {{if .TotalTrackedTime}} + {{svg "octicon-clock" 16 "mr-2"}}{{.TotalTrackedTime | Sec2Time}} + {{end}} +
    +
    + {{range .Assignees}} + + + + {{end}} +
    +
    + {{if .NumComments}} + {{svg "octicon-comment" 16 "mr-2"}}{{.NumComments}} + {{end}} +
    +
  • {{end}} diff --git a/web_src/less/_base.less b/web_src/less/_base.less index b313e216376d5..8065e953a643e 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -76,6 +76,7 @@ /* target-based colors */ --color-body: #ffffff; --color-text: #212121; + --color-text-hover: #000000; --color-box-header: #f7f7f7; --color-box-body: #ffffff; --color-timeline: #ececec; @@ -141,6 +142,15 @@ strong { font-weight: 500; } +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: 600; +} + body { background-color: var(--color-body); overflow-y: auto; diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index dc0c718c1a9b9..a8f267f6f55fb 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2586,42 +2586,78 @@ display: none; } -.ui.checkbox.issue-checkbox { - vertical-align: middle; -} - .ui.menu .item > img:not(.ui) { width: auto; } .issue.list { list-style: none; + margin-top: 1rem; > .item { - padding-top: 15px; - padding-bottom: 10px; - border-bottom: 1px dashed #aaaaaa; + .issue-checkbox { + margin-top: 1px; + } + + .issue-item-icon svg { + margin-right: .75rem; + } + + .issue-item-icons-right > * + * { + margin-left: .5rem; + } + + .issue-item-main { + width: 100%; + } + + .issue-item-top-row { + max-width: 80%; + overflow-wrap: break-word; + color: var(--color-text); + font-size: 16px; + font-weight: 600; + } + + .issue-item-bottom-row { + font-size: 13px; + } .title { - color: #444444; - font-size: 15px; - font-weight: 500; - margin: 0 6px; + display: block; + min-width: 0; + color: var(--color-text); + font-size: 16px; + font-weight: 600; &:hover { - color: #000000; + color: var(--color-text-hover); } } - .comment { - padding-right: 10px; - color: #666666; + .issue-item-icon-right { + min-width: 2rem; + } + + .assignee { + position: relative; + top: -3px; + } + + .assignee img { + width: 20px; + height: 20px; } .desc { - padding-top: 5px; color: #999999; + .time-since, + a { + margin-left: .25rem; + margin-right: .25rem; + } + .waiting, .approvals, .rejects { @@ -2662,7 +2698,7 @@ color: #999999 !important; &:hover { - color: #000000 !important; + color: var(--color-text-hover) !important; } } @@ -2671,7 +2707,7 @@ color: #999999 !important; &:hover { - color: #000000 !important; + color: var(--color-text-hover) !important; } span { @@ -2679,16 +2715,15 @@ } } - .assignee { - margin-top: -5px; - margin-right: 5px; - } - .overdue { color: var(--color-red); } } } + + > .item + .item { + border-top: 1px solid var(--color-secondary); + } } .page.buttons { diff --git a/web_src/less/themes/theme-arc-green.less b/web_src/less/themes/theme-arc-green.less index ad3d49194288d..ad5b6fe5a6be3 100644 --- a/web_src/less/themes/theme-arc-green.less +++ b/web_src/less/themes/theme-arc-green.less @@ -73,6 +73,7 @@ --color-box-header: #454a57; --color-box-body: #353945; --color-text: #b6bac5; + --color-text-hover: #d6dae5; --color-timeline: #4a505c; --color-input-text: #dcdcdc; --color-input-background: #2e323e; @@ -680,18 +681,6 @@ a.ui.basic.label:hover { background-color: #383c4a; } -.issue.list > .item .title { - color: #87ab63; -} - -.issue.list > .item .title:hover { - color: #a0cc75; -} - -.issue.list > .item { - border-bottom: 1px dashed #475767; -} - .ui.green.label, .ui.green.labels .label, .ui.basic.green.label { @@ -708,10 +697,6 @@ a.ui.basic.green.label:hover { color: #fff !important; } -.issue.list > .item .comment { - color: var(--color-secondary-dark-6); -} - .ui.basic.red.active.button, .ui.basic.red.buttons .active.button { box-shadow: 0 0 0 1px #b75252 inset !important; From c60029ce35a16265c294cd6cde1aeda161d1f942 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 16 Nov 2020 23:40:38 +0100 Subject: [PATCH 02/15] color and layout tweaks --- templates/repo/issue/list.tmpl | 17 ++++++++--------- web_src/less/_base.less | 1 - web_src/less/_repository.less | 19 +++++++++++++------ web_src/less/themes/theme-arc-green.less | 1 - 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 899cff8cc8a68..d45fc2d9b8295 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -256,27 +256,26 @@ {{else}} {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} {{end}} - {{if .Milestone}} - {{svg "octicon-milestone"}} {{.Milestone.Name}} + {{svg "octicon-milestone" 14}} {{.Milestone.Name}} {{end}} {{if .Ref}} - {{svg "octicon-git-branch"}} {{index $.IssueRefEndNames .ID}} + {{svg "octicon-git-branch" 14}} {{index $.IssueRefEndNames .ID}} {{end}} {{$tasks := .GetTasks}} {{if gt $tasks 0}} {{$tasksDone := .GetTasksDone}} - {{svg "octicon-checklist"}} {{$tasksDone}} / {{$tasks}} + {{svg "octicon-checklist" 14}} {{$tasksDone}} / {{$tasks}} {{end}} {{if ne .DeadlineUnix 0}} - {{svg "octicon-calendar"}}{{.DeadlineUnix.FormatShort}} + {{svg "octicon-calendar" 14}}{{.DeadlineUnix.FormatShort}} {{end}} {{if .IsPull}} @@ -284,25 +283,25 @@ {{$rejectOfficial := call $approvalCounts .ID "reject"}} {{$waitingOfficial := call $approvalCounts .ID "waiting"}} {{if gt $approveOfficial 0}} - {{svg "octicon-check"}} + {{svg "octicon-check" 14}} {{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}} {{end}} {{if gt $rejectOfficial 0}} - {{svg "octicon-diff"}} + {{svg "octicon-diff" 14}} {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}} {{end}} {{if gt $waitingOfficial 0}} - {{svg "octicon-eye"}} + {{svg "octicon-eye" 14}} {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}} {{end}} {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} - {{svg "octicon-x"}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} + {{svg "octicon-x" 14}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} {{end}} {{end}}
    diff --git a/web_src/less/_base.less b/web_src/less/_base.less index 8065e953a643e..6add12ae05353 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -76,7 +76,6 @@ /* target-based colors */ --color-body: #ffffff; --color-text: #212121; - --color-text-hover: #000000; --color-box-header: #f7f7f7; --color-box-body: #ffffff; --color-timeline: #ececec; diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index a8f267f6f55fb..da44d52b29b33 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2631,7 +2631,7 @@ font-weight: 600; &:hover { - color: var(--color-text-hover); + color: var(--color-primary); } } @@ -2641,17 +2641,26 @@ .assignee { position: relative; - top: -3px; + top: -2px; } .assignee img { width: 20px; height: 20px; + margin-right: 2px; } .desc { color: #999999; + a { + color: inherit; + } + + a:hover { + color: var(--color-primary); + } + .time-since, a { margin-left: .25rem; @@ -2695,19 +2704,17 @@ a.milestone { margin-left: 5px; - color: #999999 !important; &:hover { - color: var(--color-text-hover) !important; + color: var(--color-primary) !important; } } a.ref { margin-left: 8px; - color: #999999 !important; &:hover { - color: var(--color-text-hover) !important; + color: var(--color-primary) !important; } span { diff --git a/web_src/less/themes/theme-arc-green.less b/web_src/less/themes/theme-arc-green.less index ad5b6fe5a6be3..395eb91dca388 100644 --- a/web_src/less/themes/theme-arc-green.less +++ b/web_src/less/themes/theme-arc-green.less @@ -73,7 +73,6 @@ --color-box-header: #454a57; --color-box-body: #353945; --color-text: #b6bac5; - --color-text-hover: #d6dae5; --color-timeline: #4a505c; --color-input-text: #dcdcdc; --color-input-background: #2e323e; From 9a6757ca138f533455dd0361dc240f0621cf72ed Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 17 Nov 2020 19:45:53 +0100 Subject: [PATCH 03/15] use new issue list on dashboard as well --- templates/repo/issue/list.tmpl | 132 +-------------------- templates/shared/issuelist.tmpl | 133 +++++++++++++++++++++ templates/user/dashboard/issues.tmpl | 106 +---------------- web_src/less/_base.less | 17 +-- web_src/less/_repository.less | 143 ----------------------- web_src/less/helpers.less | 1 + web_src/less/index.less | 1 + web_src/less/shared/issuelist.less | 142 ++++++++++++++++++++++ web_src/less/themes/theme-arc-green.less | 9 +- 9 files changed, 291 insertions(+), 393 deletions(-) create mode 100644 templates/shared/issuelist.tmpl create mode 100644 web_src/less/shared/issuelist.less diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index d45fc2d9b8295..933f50fdfa980 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -200,136 +200,8 @@ - -
    - {{ $approvalCounts := .ApprovalCounts}} - {{range .Issues}} -
  • -
    - {{if $.CanWriteIssuesOrPulls}} -
    - - -
    - {{end}} -
    - {{if .IsPull}} - {{if .PullRequest.HasMerged}} - {{svg "octicon-git-merge" 16 "text purple"}} - {{else}} - {{if .IsClosed}} - {{svg "octicon-git-pull-request" 16 "text red"}} - {{else}} - {{svg "octicon-git-pull-request" 16 "text green"}} - {{end}} - {{end}} - {{else}} - {{if .IsClosed}} - {{svg "octicon-issue-opened" 16 "text red"}} - {{else}} - {{svg "octicon-issue-closed" 16 "text green"}} - {{end}} - {{end}} -
    -
    -
    -
    - {{RenderEmoji .Title}} - {{if .IsPull }} - {{if (index $.CommitStatus .PullRequest.ID)}} - {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} - {{end}} - {{end}} - {{range .Labels}} - {{.Name | RenderEmoji}} - {{end}} -
    -
    - - #{{.Index}} - - {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} - {{if .OriginalAuthor }} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}} - {{else if gt .Poster.ID 0}} - {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}} - {{else}} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} - {{end}} - {{if .Milestone}} - - {{svg "octicon-milestone" 14}} {{.Milestone.Name}} - - {{end}} - {{if .Ref}} - - {{svg "octicon-git-branch" 14}} {{index $.IssueRefEndNames .ID}} - - {{end}} - {{$tasks := .GetTasks}} - {{if gt $tasks 0}} - {{$tasksDone := .GetTasksDone}} - - {{svg "octicon-checklist" 14}} {{$tasksDone}} / {{$tasks}} - - {{end}} - {{if ne .DeadlineUnix 0}} - - {{svg "octicon-calendar" 14}}{{.DeadlineUnix.FormatShort}} - - {{end}} - {{if .IsPull}} - {{$approveOfficial := call $approvalCounts .ID "approve"}} - {{$rejectOfficial := call $approvalCounts .ID "reject"}} - {{$waitingOfficial := call $approvalCounts .ID "waiting"}} - {{if gt $approveOfficial 0}} - {{svg "octicon-check" 14}} - {{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}} - - {{end}} - - {{if gt $rejectOfficial 0}} - {{svg "octicon-diff" 14}} - {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}} - - {{end}} - - {{if gt $waitingOfficial 0}} - {{svg "octicon-eye" 14}} - {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}} - - {{end}} - - {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} - {{svg "octicon-x" 14}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} - {{end}} - {{end}} -
    -
    -
    -
    - {{if .TotalTrackedTime}} - {{svg "octicon-clock" 16 "mr-2"}}{{.TotalTrackedTime | Sec2Time}} - {{end}} -
    -
    - {{range .Assignees}} - - - - {{end}} -
    -
    - {{if .NumComments}} - {{svg "octicon-comment" 16 "mr-2"}}{{.NumComments}} - {{end}} -
    -
    -
  • - {{end}} - - {{template "base/paginate" .}} -
    + {{template "shared/issuelist" .}} + {{template "base/paginate" .}} {{template "base/footer" .}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl new file mode 100644 index 0000000000000..1550ab7990855 --- /dev/null +++ b/templates/shared/issuelist.tmpl @@ -0,0 +1,133 @@ +
    + {{ $approvalCounts := .ApprovalCounts}} + {{range .Issues}} +
  • +
    + {{if $.CanWriteIssuesOrPulls}} +
    + + +
    + {{end}} +
    + {{if .IsPull}} + {{if .PullRequest.HasMerged}} + {{svg "octicon-git-merge" 16 "text purple"}} + {{else}} + {{if .IsClosed}} + {{svg "octicon-git-pull-request" 16 "text red"}} + {{else}} + {{svg "octicon-git-pull-request" 16 "text green"}} + {{end}} + {{end}} + {{else}} + {{if .IsClosed}} + {{svg "octicon-issue-opened" 16 "text red"}} + {{else}} + {{svg "octicon-issue-closed" 16 "text green"}} + {{end}} + {{end}} +
    +
    +
    +
    + {{RenderEmoji .Title}} + {{if .IsPull }} + {{if (index $.CommitStatus .PullRequest.ID)}} + {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} + {{end}} + {{end}} + {{range .Labels}} + {{.Name | RenderEmoji}} + {{end}} +
    +
    + + #{{.Index}} + + {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} + {{if .OriginalAuthor }} + {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}} + {{else if gt .Poster.ID 0}} + {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}} + {{else}} + {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} + {{end}} + {{if .Milestone}} + + {{svg "octicon-milestone" 14 "mr-2"}}{{.Milestone.Name}} + + {{end}} + {{if .Ref}} + + {{svg "octicon-git-branch" 14 "mr-2"}}{{index $.IssueRefEndNames .ID}} + + {{end}} + {{$tasks := .GetTasks}} + {{if gt $tasks 0}} + {{$tasksDone := .GetTasksDone}} + + {{svg "octicon-checklist" 14 "mr-2"}}{{$tasksDone}} / {{$tasks}} + + {{end}} + {{if ne .DeadlineUnix 0}} + + {{svg "octicon-calendar" 14 "mr-2"}}{{.DeadlineUnix.FormatShort}} + + {{end}} + {{if .IsPull}} + {{$approveOfficial := call $approvalCounts .ID "approve"}} + {{$rejectOfficial := call $approvalCounts .ID "reject"}} + {{$waitingOfficial := call $approvalCounts .ID "waiting"}} + {{if gt $approveOfficial 0}} + + {{svg "octicon-check" 14 "mr-2"}} + {{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}} + + {{end}} + {{if gt $rejectOfficial 0}} + + {{svg "octicon-diff" 14 "mr-2"}} + {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}} + + {{end}} + {{if gt $waitingOfficial 0}} + + {{svg "octicon-eye" 14}} + {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}} + + {{end}} + {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} + + {{svg "octicon-x" 14}} + {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} + + {{end}} + {{end}} +
    +
    +
    +
    + {{if .TotalTrackedTime}} + {{svg "octicon-clock" 16 "mr-2"}} + {{.TotalTrackedTime | Sec2Time}} + {{end}} +
    +
    + {{range .Assignees}} + + + + {{end}} +
    + +
    +
  • + {{end}} +
    diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index f035aed779845..5ef8147509373 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -97,110 +97,8 @@ - -
    - {{ $approvalCounts := .ApprovalCounts}} - {{range .Issues}} - - {{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }} - {{if .Repo}} -
  • -
    {{.Repo.FullName}}#{{.Index}}
    - {{RenderEmoji .Title}} - - {{if .IsPull}} - {{if (index $.CommitStatus .PullRequest.ID)}} - {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} - {{end}} - {{end}} - - {{with .Labels}} - {{/* If we have any labels, we should show them - with a 2.5 line height, this way they don't look - awful and they don't stack on top of each other, - especially on mobile views. */}} - - {{range .}} - {{.Name | RenderEmoji}} - {{end}} - - {{end}} - - {{if .NumComments}} - {{svg "octicon-comment"}} {{.NumComments}} - {{end}} - {{if .TotalTrackedTime}} - {{svg "octicon-clock"}} {{.TotalTrackedTime | Sec2Time}} - {{end}} - -

    - {{if .OriginalAuthor}} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}} - {{else if gt .Poster.ID 0}} - {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName|Escape) | Safe}} - {{else}} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName|Escape) | Safe}} - {{end}} - {{if .Milestone}} - - {{svg "octicon-milestone"}} {{.Milestone.Name}} - - {{end}} - {{if .Ref}} - - {{svg "octicon-git-branch"}} {{index $.IssueRefEndNames .ID}} - - {{end}} - {{range .Assignees}} - - - - {{end}} - {{$tasks := .GetTasks}} - {{if gt $tasks 0}} - {{$tasksDone := .GetTasksDone}} - - {{svg "octicon-checklist"}} {{$tasksDone}} / {{$tasks}} - - {{end}} - {{if ne .DeadlineUnix 0}} - - {{svg "octicon-calendar"}}{{.DeadlineUnix.FormatShort}} - - {{end}} - {{if .IsPull}} - {{$approveOfficial := call $approvalCounts .ID "approve"}} - {{$rejectOfficial := call $approvalCounts .ID "reject"}} - {{$waitingOfficial := call $approvalCounts .ID "waiting"}} - {{if gt $approveOfficial 0}} - {{svg "octicon-check"}} - {{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}} - - {{end}} - - {{if gt $rejectOfficial 0}} - {{svg "octicon-diff"}} - {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}} - - {{end}} - - {{if gt $waitingOfficial 0}} - {{svg "octicon-eye"}} - {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}} - - {{end}} - - {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} - {{svg "octicon-x"}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} - {{end}} - {{end}} -

    -
  • - {{end}} - {{end}} - - {{template "base/paginate" .}} -
    + {{template "shared/issuelist" .}} + {{template "base/paginate" .}} diff --git a/web_src/less/_base.less b/web_src/less/_base.less index 6add12ae05353..64e9b2e352103 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -76,6 +76,7 @@ /* target-based colors */ --color-body: #ffffff; --color-text: #212121; + --color-text-light: #444444; --color-box-header: #f7f7f7; --color-box-body: #ffffff; --color-timeline: #ececec; @@ -449,7 +450,7 @@ a:hover, color: var(--color-red) !important; a { - color: var(--color-red) !important; + color: inherit !important; &:hover { color: #e67777 !important; @@ -458,19 +459,19 @@ a:hover, } &.blue { - color: var(--color-primary-dark-1) !important; + color: var(--color-primary) !important; a { - color: var(--color-primary) !important; + color: inherit !important; &:hover { - color: var(--color-primary-dark-2) !important; + color: var(--color-primary-dark-1) !important; } } } &.black { - color: #444444; + color: var(--color-body); &:hover { color: #000000; @@ -478,13 +479,13 @@ a:hover, } &.grey { - color: var(--color-grey) !important; + color: var(--color-text-light) !important; a { - color: #444444 !important; + color: inherit !important; &:hover { - color: #000000 !important; + color: var(--color-primary) !important; } } } diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index da44d52b29b33..642d6b99f1d30 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2590,149 +2590,6 @@ width: auto; } -.issue.list { - list-style: none; - margin-top: 1rem; - - > .item { - .issue-checkbox { - margin-top: 1px; - } - - .issue-item-icon svg { - margin-right: .75rem; - } - - .issue-item-icons-right > * + * { - margin-left: .5rem; - } - - .issue-item-main { - width: 100%; - } - - .issue-item-top-row { - max-width: 80%; - overflow-wrap: break-word; - color: var(--color-text); - font-size: 16px; - font-weight: 600; - } - - .issue-item-bottom-row { - font-size: 13px; - } - - .title { - display: block; - min-width: 0; - color: var(--color-text); - font-size: 16px; - font-weight: 600; - - &:hover { - color: var(--color-primary); - } - } - - .issue-item-icon-right { - min-width: 2rem; - } - - .assignee { - position: relative; - top: -2px; - } - - .assignee img { - width: 20px; - height: 20px; - margin-right: 2px; - } - - .desc { - color: #999999; - - a { - color: inherit; - } - - a:hover { - color: var(--color-primary); - } - - .time-since, - a { - margin-left: .25rem; - margin-right: .25rem; - } - - .waiting, - .approvals, - .rejects { - padding-left: 5px; - } - - .checklist { - padding-left: 5px; - - .progress-bar { - margin-left: 2px; - width: 80px; - height: 6px; - display: inline-block; - background-color: #eeeeee; - overflow: hidden; - border-radius: 3px; - vertical-align: 2px !important; - - .progress { - background-color: #cccccc; - display: block; - height: 100%; - } - } - } - - .conflicting { - padding-left: 5px; - } - - .due-date { - padding-left: 5px; - } - - a.milestone { - margin-left: 5px; - - &:hover { - color: var(--color-primary) !important; - } - } - - a.ref { - margin-left: 8px; - - &:hover { - color: var(--color-primary) !important; - } - - span { - margin-right: -4px; - } - } - - .overdue { - color: var(--color-red); - } - } - } - - > .item + .item { - border-top: 1px solid var(--color-secondary); - } -} - .page.buttons { padding-top: 15px; } diff --git a/web_src/less/helpers.less b/web_src/less/helpers.less index d50aea0264194..60d50883c58ee 100644 --- a/web_src/less/helpers.less +++ b/web_src/less/helpers.less @@ -6,6 +6,7 @@ .sb { justify-content: space-between !important; } .fc { flex-direction: column !important; } .f1 { flex: 1 !important; } +.fw { flex-wrap: wrap !important; } .mono { font-family: var(--fonts-monospace) !important; diff --git a/web_src/less/index.less b/web_src/less/index.less index 1b0701ae81495..0d5ef887242e3 100644 --- a/web_src/less/index.less +++ b/web_src/less/index.less @@ -1,6 +1,7 @@ @import "~font-awesome/css/font-awesome.css"; @import "./variables.less"; +@import "./shared/issuelist.less"; @import "./features/gitgraph.less"; @import "./features/animations.less"; @import "./features/heatmap.less"; diff --git a/web_src/less/shared/issuelist.less b/web_src/less/shared/issuelist.less new file mode 100644 index 0000000000000..1abd29489f4ec --- /dev/null +++ b/web_src/less/shared/issuelist.less @@ -0,0 +1,142 @@ +.issue.list { + list-style: none; + margin-top: 1rem; + + > .item { + .issue-checkbox { + margin-top: 1px; + } + + .issue-item-icon svg { + margin-right: .75rem; + } + + .issue-item-icons-right > * + * { + margin-left: .5rem; + } + + .issue-item-main { + width: 100%; + } + + .issue-item-top-row { + max-width: 80%; + overflow-wrap: break-word; + color: var(--color-text); + font-size: 16px; + font-weight: 600; + } + + .issue-item-bottom-row { + font-size: 13px; + } + + .title { + display: block; + min-width: 0; + color: var(--color-text); + font-size: 16px; + font-weight: 600; + + &:hover { + color: var(--color-primary); + } + } + + .issue-item-icon-right { + min-width: 2rem; + } + + .assignee { + position: relative; + top: -2px; + } + + .assignee img { + width: 20px; + height: 20px; + margin-right: 2px; + } + + .desc { + color: #999999; + + a { + color: inherit; + } + + a:hover { + color: var(--color-primary); + } + + .time-since, + a { + margin-left: .25rem; + margin-right: .25rem; + } + + .waiting, + .approvals, + .rejects { + padding-left: 5px; + } + + .checklist { + padding-left: 5px; + + .progress-bar { + margin-left: 2px; + width: 80px; + height: 6px; + display: inline-block; + background-color: #eeeeee; + overflow: hidden; + border-radius: 3px; + vertical-align: 2px !important; + + .progress { + background-color: #cccccc; + display: block; + height: 100%; + } + } + } + + .conflicting { + padding-left: 5px; + } + + .due-date { + padding-left: 5px; + } + + a.milestone { + margin-left: 5px; + + &:hover { + color: var(--color-primary) !important; + } + } + + a.ref { + margin-left: 8px; + + &:hover { + color: var(--color-primary) !important; + } + + span { + margin-right: -4px; + } + } + + .overdue { + color: var(--color-red); + } + } + } + + > .item + .item { + border-top: 1px solid var(--color-secondary); + } +} diff --git a/web_src/less/themes/theme-arc-green.less b/web_src/less/themes/theme-arc-green.less index 395eb91dca388..e424bab7833ec 100644 --- a/web_src/less/themes/theme-arc-green.less +++ b/web_src/less/themes/theme-arc-green.less @@ -73,6 +73,7 @@ --color-box-header: #454a57; --color-box-body: #353945; --color-text: #b6bac5; + --color-text-light: #969aa5; --color-timeline: #4a505c; --color-input-text: #dcdcdc; --color-input-background: #2e323e; @@ -1018,10 +1019,6 @@ a.ui.basic.green.label:hover { text-shadow: -2px 0 #383c4a, 0 2px #383c4a, 2px 0 #383c4a, 0 -2px #383c4a; } -.ui .text.grey a { - color: #dbdbdb !important; -} - .repository.view.issue .comment-list .comment .content .header { color: #dbdbdb; background-color: var(--color-secondary); @@ -1044,10 +1041,6 @@ a.ui.basic.green.label:hover { background: #353945; } -.ui .text.grey a:hover { - color: #dbdbdb !important; -} - .ui.basic.green.active.button, .ui.basic.green.buttons .active.button { color: #87ab63 !important; From 2c94b0df9ea982b3231e08f172865ed5ff509ee7 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 17 Nov 2020 20:12:02 +0100 Subject: [PATCH 04/15] move pagination into template --- templates/repo/issue/list.tmpl | 1 - templates/shared/issuelist.tmpl | 1 + templates/user/dashboard/issues.tmpl | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 933f50fdfa980..c950ec5ad96b0 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -201,7 +201,6 @@ {{template "shared/issuelist" .}} - {{template "base/paginate" .}} {{template "base/footer" .}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 1550ab7990855..05f6216ae3cb3 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -131,3 +131,4 @@ {{end}} +{{template "base/paginate" .}} diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index 5ef8147509373..06b540fd198a7 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -98,7 +98,6 @@ {{template "shared/issuelist" .}} - {{template "base/paginate" .}} From 09e9f1fb8d3c8b8b5386aee63e799068eb790029 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 19 Nov 2020 00:46:14 +0100 Subject: [PATCH 05/15] misc tweaks --- templates/shared/issuelist.tmpl | 4 ++-- web_src/less/_repository.less | 22 +++++++++++++++++++--- web_src/less/shared/issuelist.less | 29 +++++++---------------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 05f6216ae3cb3..743999ea1d7f7 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -2,7 +2,7 @@ {{ $approvalCounts := .ApprovalCounts}} {{range .Issues}}
  • -
    +
    {{if $.CanWriteIssuesOrPulls}}
    @@ -31,7 +31,7 @@
    - {{RenderEmoji .Title}} + {{RenderEmoji .Title}} {{if .IsPull }} {{if (index $.CommitStatus .PullRequest.ID)}} {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 642d6b99f1d30..1dbd741eee62e 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2874,15 +2874,31 @@ flex-wrap: wrap; } -.labels.list .item { +.labels.list .item, +.timeline-item .label { padding: .3em .5em !important; margin-left: 0; margin-right: 0; margin-bottom: 3px; } -.labels.list .item + .item { - margin-left: 3px; +.issue-item-top-row .label { + margin-left: 0; + margin-right: 0; + margin-top: 1.5px; + margin-bottom: 1.5px; +} + +.labels.list .item, +.timeline-item .label, +.issue-item-top-row .label { + margin-right: 3px; + display: inline !important; +} + +.timeline-item .label:last-of-type, +.issue-item-top-row .label:last-of-type { + margin-right: 0; } tbody.commit-list { diff --git a/web_src/less/shared/issuelist.less b/web_src/less/shared/issuelist.less index 1abd29489f4ec..e48151834e218 100644 --- a/web_src/less/shared/issuelist.less +++ b/web_src/less/shared/issuelist.less @@ -2,6 +2,10 @@ list-style: none; margin-top: 1rem; + a:hover { + color: var(--color-primary) !important; + } + > .item { .issue-checkbox { margin-top: 1px; @@ -20,10 +24,10 @@ } .issue-item-top-row { - max-width: 80%; - overflow-wrap: break-word; + max-width: 100%; color: var(--color-text); font-size: 16px; + min-width: 0; font-weight: 600; } @@ -32,15 +36,8 @@ } .title { - display: block; - min-width: 0; color: var(--color-text); - font-size: 16px; - font-weight: 600; - - &:hover { - color: var(--color-primary); - } + word-break: break-word; } .issue-item-icon-right { @@ -65,10 +62,6 @@ color: inherit; } - a:hover { - color: var(--color-primary); - } - .time-since, a { margin-left: .25rem; @@ -112,19 +105,11 @@ a.milestone { margin-left: 5px; - - &:hover { - color: var(--color-primary) !important; - } } a.ref { margin-left: 8px; - &:hover { - color: var(--color-primary) !important; - } - span { margin-right: -4px; } From 926b6a7ecb1e562855990f8fb97c8c20accd637e Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 20:26:05 +0100 Subject: [PATCH 06/15] fix label hover --- web_src/less/shared/issuelist.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/less/shared/issuelist.less b/web_src/less/shared/issuelist.less index e48151834e218..dec99e135afd8 100644 --- a/web_src/less/shared/issuelist.less +++ b/web_src/less/shared/issuelist.less @@ -2,7 +2,7 @@ list-style: none; margin-top: 1rem; - a:hover { + a:not(.label):hover { color: var(--color-primary) !important; } From 273fd5d3efbd60c0b4b635546b7d3ecf774d486f Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 21:09:27 +0100 Subject: [PATCH 07/15] fix milestone list --- templates/repo/issue/milestone_issues.tmpl | 122 +-------------------- 1 file changed, 1 insertion(+), 121 deletions(-) diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index ad75411d8b5bf..03356707bcec3 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -177,127 +177,7 @@
    - -
    - {{ $approvalCounts := .ApprovalCounts}} - {{range .Issues}} - {{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }} -
  • - {{if or (and $.CanWriteIssues (not .IsPull)) (and $.CanWritePulls .IsPull)}} -
    - -
    - {{end}} - - {{if .IsClosed}} - {{if .IsPull}} - {{if .PullRequest.HasMerged}} -
    #{{.Index}}
    - {{svg "octicon-git-pull-request"}} - {{else}} -
    #{{.Index}}
    - {{svg "octicon-git-pull-request"}} - {{end}} - {{else}} -
    #{{.Index}}
    - {{svg "octicon-issue-closed"}} - {{end}} - {{else}} - {{if .IsRead}} -
    #{{.Index}}
    - {{else}} -
    #{{.Index}}
    - {{end}} - {{if .IsPull}} - {{svg "octicon-git-pull-request"}} - {{else}} - {{svg "octicon-issue-opened"}} - {{end}} - {{end}} - - {{.Title | RenderEmoji}} - - {{if .IsPull }} - {{if (index $.CommitStatus .PullRequest.ID)}} - {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} - {{end}} - {{end}} - - {{range .Labels}} - {{.Name | RenderEmoji}} - {{end}} - - {{if .NumComments}} - {{svg "octicon-comment"}} {{.NumComments}} - {{end}} - - {{if .TotalTrackedTime}} - {{svg "octicon-clock"}} {{.TotalTrackedTime | Sec2Time}} - {{end}} - -

    - {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} - {{if .OriginalAuthor }} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}} - {{else if gt .Poster.ID 0}} - {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}} - {{else}} - {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} - {{end}} - - {{if .Ref}} - - {{svg "octicon-git-branch"}} {{index $.IssueRefEndNames .ID}} - - {{end}} - {{$tasks := .GetTasks}} - {{if gt $tasks 0}} - {{$tasksDone := .GetTasksDone}} - - {{svg "octicon-checklist"}} {{$tasksDone}} / {{$tasks}} - - {{end}} - {{if ne .DeadlineUnix 0}} - {{svg "octicon-calendar"}} - {{.DeadlineUnix.FormatShort}} - {{end}} - {{range .Assignees}} - - - - {{end}} - {{if .IsPull}} - {{$approveOfficial := call $approvalCounts .ID "approve"}} - {{$rejectOfficial := call $approvalCounts .ID "reject"}} - {{$waitingOfficial := call $approvalCounts .ID "waiting"}} - {{if gt $approveOfficial 0}} - {{svg "octicon-check"}} - {{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}} - - {{end}} - - {{if gt $rejectOfficial 0}} - {{svg "octicon-diff"}} - {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}} - - {{end}} - - {{if gt $waitingOfficial 0}} - {{svg "octicon-eye"}} - {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}} - - {{end}} - - {{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}} - {{svg "octicon-x"}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}} - {{end}} - {{end}} -

    -
  • - {{end}} - - {{template "base/paginate" .}} - + {{template "shared/issuelist" .}} {{template "base/footer" .}} From 664e57b87dafc68682b2e9745035f5c6e183b2cd Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 22:57:03 +0100 Subject: [PATCH 08/15] fix discrepancies between issue and milestone list, add new 'merge' helper --- modules/templates/helper.go | 31 ++++++++++------------ modules/util/util.go | 24 +++++++++++++++++ templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/milestone_issues.tmpl | 2 +- templates/shared/issuelist.tmpl | 4 +-- templates/user/dashboard/issues.tmpl | 2 +- 6 files changed, 43 insertions(+), 22 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index e1c5d5d86b79f..a2a5b8895be0b 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -256,32 +256,29 @@ func NewFuncMap() []template.FuncMap { "DefaultTheme": func() string { return setting.UI.DefaultTheme }, + // pass key-value pairs to a partial template which receives them as a dict "dict": func(values ...interface{}) (map[string]interface{}, error) { if len(values) == 0 { return nil, errors.New("invalid dict call") } dict := make(map[string]interface{}) + return util.MergeInto(dict, 0, values...) + }, + /* like dict but merge pairs into the first dict and return that */ + "merge": func(values ...interface{}) (map[string]interface{}, error) { + if len(values) == 0 { + return nil, errors.New("invalid merge call") + } - for i := 0; i < len(values); i++ { - switch key := values[i].(type) { - case string: - i++ - if i == len(values) { - return nil, errors.New("specify the key for non array values") - } - dict[key] = values[i] - case map[string]interface{}: - m := values[i].(map[string]interface{}) - for i, v := range m { - dict[i] = v - } - default: - return nil, errors.New("dict values must be maps") - } + dict := make(map[string]interface{}) + for key, value := range values[1].(map[string]interface{}) { + dict[key] = value } - return dict, nil + + return util.MergeInto(dict, 2, values...) }, + "percentage": func(n int, values ...int) float32 { var sum = 0 for i := 0; i < len(values); i++ { diff --git a/modules/util/util.go b/modules/util/util.go index 6d02b5f52fa73..df96d36325ae8 100644 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -6,6 +6,7 @@ package util import ( "bytes" + "errors" "strings" ) @@ -100,3 +101,26 @@ func NormalizeEOL(input []byte) []byte { } return tmp[:pos] } + +// MergeInto merges pairs of values into a "dict" +func MergeInto(dict map[string]interface{}, startIndex int, values ...interface{}) (map[string]interface{}, error) { + for i := 0; i < len(values); i++ { + switch key := values[i].(type) { + case string: + i++ + if i == len(values) { + return nil, errors.New("specify the key for non array values") + } + dict[key] = values[i] + case map[string]interface{}: + m := values[i].(map[string]interface{}) + for i, v := range m { + dict[i] = v + } + default: + return nil, errors.New("dict values must be maps") + } + } + + return dict, nil +} diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index c950ec5ad96b0..955b62fe32f19 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -200,7 +200,7 @@ - {{template "shared/issuelist" .}} + {{template "shared/issuelist" merge "" . "listType" "repo"}} {{template "base/footer" .}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 03356707bcec3..8fa6e134287b8 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -177,7 +177,7 @@ - {{template "shared/issuelist" .}} + {{template "shared/issuelist" merge "" . "listType" "milestone"}} {{template "base/footer" .}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 743999ea1d7f7..c89d58291e97a 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -38,7 +38,7 @@ {{end}} {{end}} {{range .Labels}} - {{.Name | RenderEmoji}} + {{.Name | RenderEmoji}} {{end}}
    @@ -53,7 +53,7 @@ {{else}} {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}} {{end}} - {{if .Milestone}} + {{if and .Milestone (ne $.listType "milestone")}} {{svg "octicon-milestone" 14 "mr-2"}}{{.Milestone.Name}} diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index 06b540fd198a7..ecf0ad22cb60a 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -97,7 +97,7 @@
    - {{template "shared/issuelist" .}} + {{template "shared/issuelist" merge "" . "listType" "dashboard"}} From 33d0485c35f61a4d7ff239e58eb5dfef18460866 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 23:00:26 +0100 Subject: [PATCH 09/15] fmt --- modules/templates/helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index a2a5b8895be0b..bb766b80eb455 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -273,7 +273,7 @@ func NewFuncMap() []template.FuncMap { dict := make(map[string]interface{}) for key, value := range values[1].(map[string]interface{}) { - dict[key] = value + dict[key] = value } return util.MergeInto(dict, 2, values...) From eda68ba1d0be0f3637ebb6e2702d2314c161e015 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 23:08:56 +0100 Subject: [PATCH 10/15] simplify merge helper --- modules/templates/helper.go | 4 ++-- templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/milestone_issues.tmpl | 2 +- templates/user/dashboard/issues.tmpl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index bb766b80eb455..ce50cab69d0ea 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -272,11 +272,11 @@ func NewFuncMap() []template.FuncMap { } dict := make(map[string]interface{}) - for key, value := range values[1].(map[string]interface{}) { + for key, value := range values[0].(map[string]interface{}) { dict[key] = value } - return util.MergeInto(dict, 2, values...) + return util.MergeInto(dict, 1, values...) }, "percentage": func(n int, values ...int) float32 { diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 955b62fe32f19..a9f0099ecf0c1 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -200,7 +200,7 @@ - {{template "shared/issuelist" merge "" . "listType" "repo"}} + {{template "shared/issuelist" merge . "listType" "repo"}} {{template "base/footer" .}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 8fa6e134287b8..5ae29c7ade9f8 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -177,7 +177,7 @@ - {{template "shared/issuelist" merge "" . "listType" "milestone"}} + {{template "shared/issuelist" merge . "listType" "milestone"}} {{template "base/footer" .}} diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index ecf0ad22cb60a..fcf76dc12e28f 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -97,7 +97,7 @@ - {{template "shared/issuelist" merge "" . "listType" "dashboard"}} + {{template "shared/issuelist" merge . "listType" "dashboard"}} From 8e49a8bd129643e96b2dbf93e8cca3b04905f355 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 23:09:50 +0100 Subject: [PATCH 11/15] remove whitespace --- modules/templates/helper.go | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index ce50cab69d0ea..0947948043c5a 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -278,7 +278,6 @@ func NewFuncMap() []template.FuncMap { return util.MergeInto(dict, 1, values...) }, - "percentage": func(n int, values ...int) float32 { var sum = 0 for i := 0; i < len(values); i++ { From 2300214405373d3040759d414d19b2442eb4ab46 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 23:14:08 +0100 Subject: [PATCH 12/15] fix startIndex --- modules/util/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/util/util.go b/modules/util/util.go index df96d36325ae8..686a4af173047 100644 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -104,7 +104,7 @@ func NormalizeEOL(input []byte) []byte { // MergeInto merges pairs of values into a "dict" func MergeInto(dict map[string]interface{}, startIndex int, values ...interface{}) (map[string]interface{}, error) { - for i := 0; i < len(values); i++ { + for i := startIndex; i < len(values); i++ { switch key := values[i].(type) { case string: i++ From 1c4b032b35e1a610ac294fa991147e1622acb091 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 23:18:42 +0100 Subject: [PATCH 13/15] further simplify dict merging --- modules/templates/helper.go | 8 ++++---- modules/util/util.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 0947948043c5a..2decf5782cb46 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -263,20 +263,20 @@ func NewFuncMap() []template.FuncMap { } dict := make(map[string]interface{}) - return util.MergeInto(dict, 0, values...) + return util.MergeInto(dict, values...) }, /* like dict but merge pairs into the first dict and return that */ - "merge": func(values ...interface{}) (map[string]interface{}, error) { + "merge": func(root map[string]interface{}, values ...interface{}) (map[string]interface{}, error) { if len(values) == 0 { return nil, errors.New("invalid merge call") } dict := make(map[string]interface{}) - for key, value := range values[0].(map[string]interface{}) { + for key, value := range root { dict[key] = value } - return util.MergeInto(dict, 1, values...) + return util.MergeInto(dict, values...) }, "percentage": func(n int, values ...int) float32 { var sum = 0 diff --git a/modules/util/util.go b/modules/util/util.go index 686a4af173047..9de1710ac7bad 100644 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -103,8 +103,8 @@ func NormalizeEOL(input []byte) []byte { } // MergeInto merges pairs of values into a "dict" -func MergeInto(dict map[string]interface{}, startIndex int, values ...interface{}) (map[string]interface{}, error) { - for i := startIndex; i < len(values); i++ { +func MergeInto(dict map[string]interface{}, values ...interface{}) (map[string]interface{}, error) { + for i := 0; i < len(values); i++ { switch key := values[i].(type) { case string: i++ From 8113cf831630622ab07987a7c8f3c20beef3d737 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 24 Nov 2020 23:29:49 +0100 Subject: [PATCH 14/15] rename helper to 'mergeinto' for clarity --- modules/templates/helper.go | 6 +++--- templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/milestone_issues.tmpl | 2 +- templates/user/dashboard/issues.tmpl | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 2decf5782cb46..4e5c96cd0fa7f 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -265,10 +265,10 @@ func NewFuncMap() []template.FuncMap { dict := make(map[string]interface{}) return util.MergeInto(dict, values...) }, - /* like dict but merge pairs into the first dict and return that */ - "merge": func(root map[string]interface{}, values ...interface{}) (map[string]interface{}, error) { + /* like dict but merge key-value pairs into the first dict and return it */ + "mergeinto": func(root map[string]interface{}, values ...interface{}) (map[string]interface{}, error) { if len(values) == 0 { - return nil, errors.New("invalid merge call") + return nil, errors.New("invalid mergeinto call") } dict := make(map[string]interface{}) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index a9f0099ecf0c1..49adcd08bfd8d 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -200,7 +200,7 @@ - {{template "shared/issuelist" merge . "listType" "repo"}} + {{template "shared/issuelist" mergeinto . "listType" "repo"}} {{template "base/footer" .}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 5ae29c7ade9f8..9958efc07dcbd 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -177,7 +177,7 @@ - {{template "shared/issuelist" merge . "listType" "milestone"}} + {{template "shared/issuelist" mergeinto . "listType" "milestone"}} {{template "base/footer" .}} diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index fcf76dc12e28f..93ec2ed005ba3 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -97,7 +97,7 @@ - {{template "shared/issuelist" merge . "listType" "dashboard"}} + {{template "shared/issuelist" mergeinto . "listType" "dashboard"}} From fd1523138bf95c5fc30f9de0be33f036957989c9 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 25 Nov 2020 00:46:26 +0100 Subject: [PATCH 15/15] allow bottom-row to wrap --- templates/shared/issuelist.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index c89d58291e97a..93935838628ea 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -41,7 +41,7 @@ {{.Name | RenderEmoji}} {{end}} -