From a32b1cdb61eecd29478cc148b4e79f508f181e34 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Thu, 6 Jul 2023 13:39:36 +0200 Subject: [PATCH 1/4] move issue filters to shared template --- routers/web/repo/milestone.go | 3 +- templates/repo/issue/filters.tmpl | 194 +++++++++++++++++++++ templates/repo/issue/list.tmpl | 191 +------------------- templates/repo/issue/milestone_issues.tmpl | 149 +--------------- web_src/css/repo.css | 1 + web_src/css/repo/issue-list.css | 1 - 6 files changed, 199 insertions(+), 340 deletions(-) create mode 100644 templates/repo/issue/filters.tmpl diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index 38ef6939676f9..a6f7f56af74c3 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -264,6 +264,7 @@ func DeleteMilestone(ctx *context.Context) { // MilestoneIssuesAndPulls lists all the issues and pull requests of the milestone func MilestoneIssuesAndPulls(ctx *context.Context) { milestoneID := ctx.ParamsInt64(":id") + projectID := ctx.FormInt64("project") milestone, err := issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, milestoneID) if err != nil { if issues_model.IsErrMilestoneNotExist(err) { @@ -289,7 +290,7 @@ func MilestoneIssuesAndPulls(ctx *context.Context) { ctx.Data["Title"] = milestone.Name ctx.Data["Milestone"] = milestone - issues(ctx, milestoneID, 0, util.OptionalBoolNone) + issues(ctx, milestoneID, projectID, util.OptionalBoolNone) ret, _ := issue.GetTemplatesFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo) ctx.Data["NewIssueChooseTemplate"] = len(ret) > 0 diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl new file mode 100644 index 0000000000000..4ac8813786cc9 --- /dev/null +++ b/templates/repo/issue/filters.tmpl @@ -0,0 +1,194 @@ +
+
+ {{if and ($.CanWriteIssuesOrPulls) (gt (len .Issues) 0)}} + + {{end}} + {{template "repo/issue/openclose" .}} +
+
+ +
+
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index c7d73c6667405..da8567e60efef 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -81,197 +81,8 @@ {{end}} {{end}} -
-
- {{if and ($.CanWriteIssuesOrPulls) (gt (len .Issues) 0)}} - - {{end}} - {{template "repo/issue/openclose" .}} -
-
- -
-
+ {{template "repo/issue/filters" .}}
diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 5913f59fe82e2..dab6ef3de6529 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -50,155 +50,8 @@
-
-
- {{template "repo/issue/openclose" .}} -
-
- -
-
- -
-
- {{template "repo/issue/openclose" .}} -
-
- -
-
{{template "shared/issuelist" dict "." . "listType" "milestone"}}
diff --git a/web_src/css/repo.css b/web_src/css/repo.css index ebb4d37ad19f0..c58486485a522 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -169,6 +169,7 @@ /* the label-filter is the first dropdown, it shouldn't be shown leftward, otherwise it may go out the viewport (left side) */ .repository .filter.menu .ui.dropdown.label-filter .menu { + min-width: max-content; right: unset; left: 0; } diff --git a/web_src/css/repo/issue-list.css b/web_src/css/repo/issue-list.css index 8602bb9a974d7..510dfcfb47a0e 100644 --- a/web_src/css/repo/issue-list.css +++ b/web_src/css/repo/issue-list.css @@ -14,7 +14,6 @@ .issue-list-toolbar-right .filter.menu { flex-direction: row; flex-wrap: wrap; - gap: 8px; } @media (max-width: 767.98px) { From 9adfd597b39e094e7e038df9ac6789face8c6434 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Fri, 7 Jul 2023 12:18:52 +0200 Subject: [PATCH 2/4] remove milestone page check from url --- templates/repo/issue/filters.tmpl | 46 +++++++++++++++---------------- templates/repo/issue/list.tmpl | 6 ++-- web_src/css/repo/issue-list.css | 5 +--- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index 4ac8813786cc9..a27c353f21482 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -20,8 +20,8 @@ {{.locale.Tr "repo.issues.filter_label_exclude" | Safe}}
- {{.locale.Tr "repo.issues.filter_label_select_no_label"}} - {{.locale.Tr "repo.issues.filter_label_no_select"}} + {{.locale.Tr "repo.issues.filter_label_select_no_label"}} + {{.locale.Tr "repo.issues.filter_label_no_select"}} {{$previousExclusiveScope := "_no_scope"}} {{range .Labels}} {{$exclusiveScope := .ExclusiveScope}} @@ -29,7 +29,7 @@
{{end}} {{$previousExclusiveScope = $exclusiveScope}} - {{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}} + {{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}} {{end}} @@ -92,7 +92,7 @@ {{.locale.Tr "repo.issues.new.open_projects"}} {{range .OpenProjects}} - + {{svg .IconName 18 "gt-mr-3 gt-shrink-0"}}{{.Title}} {{end}} @@ -103,7 +103,7 @@ {{.locale.Tr "repo.issues.new.closed_projects"}} {{range .ClosedProjects}} - + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} @@ -115,7 +115,7 @@ - {{.locale.Tr "repo.issues.filter_assginee_no_assignee"}} - {{.locale.Tr "repo.issues.filter_assginee_no_select"}} + {{.locale.Tr "repo.issues.filter_assginee_no_assignee"}} + {{.locale.Tr "repo.issues.filter_assginee_no_select"}}
{{range .Assignees}} - + {{avatar $.Context . 20}}{{template "repo/search_name" .}} {{end}} @@ -160,14 +160,14 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} {{end}} @@ -179,14 +179,14 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index da8567e60efef..8eb85a3298860 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -93,12 +93,12 @@ {{if not .Repository.IsArchived}} {{if .IsShowClosed}} - + {{else}} - + {{end}} {{if $.IsRepoAdmin}} - diff --git a/web_src/css/repo/issue-list.css b/web_src/css/repo/issue-list.css index 510dfcfb47a0e..7769a16f5f781 100644 --- a/web_src/css/repo/issue-list.css +++ b/web_src/css/repo/issue-list.css @@ -1,6 +1,6 @@ .issue-list-toolbar { display: flex; - flex-wrap: wrap; + flex-wrap: wrap-reverse; justify-content: space-between; align-items: flex-start; gap: 1rem; @@ -17,9 +17,6 @@ } @media (max-width: 767.98px) { - .issue-list-toolbar { - flex-direction: column-reverse; - } .issue-list-toolbar-right .dropdown .menu { left: auto !important; right: auto !important; From 306b3cef16895224707be02101293c0aa5012775 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Fri, 7 Jul 2023 15:06:49 +0200 Subject: [PATCH 3/4] Update filters.tmpl --- templates/repo/issue/filters.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index a27c353f21482..95cbc469fdfd2 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -163,7 +163,7 @@ {{.locale.Tr "repo.issues.filter_type.all_issues"}} {{.locale.Tr "repo.issues.filter_type.assigned_to_you"}} {{.locale.Tr "repo.issues.filter_type.created_by_you"}} - {{if or .PageIsPullList .Milestone}} + {{if or .PageIsPullList}} {{.locale.Tr "repo.issues.filter_type.review_requested"}} {{.locale.Tr "repo.issues.filter_type.reviewed_by_you"}} {{end}} From 2d0b8af4a483a666bf7bb4686ead29f8b537bf06 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Fri, 7 Jul 2023 15:08:37 +0200 Subject: [PATCH 4/4] Update templates/repo/issue/filters.tmpl Co-authored-by: 6543 <6543@obermui.de> --- templates/repo/issue/filters.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index 95cbc469fdfd2..edc483d7529df 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -163,7 +163,7 @@ {{.locale.Tr "repo.issues.filter_type.all_issues"}} {{.locale.Tr "repo.issues.filter_type.assigned_to_you"}} {{.locale.Tr "repo.issues.filter_type.created_by_you"}} - {{if or .PageIsPullList}} + {{if .PageIsPullList}} {{.locale.Tr "repo.issues.filter_type.review_requested"}} {{.locale.Tr "repo.issues.filter_type.reviewed_by_you"}} {{end}}