From 14c97c05019d416d634ad486c03674a2b9af92ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=99=BA=E8=B6=85?= <1012112796@qq.com> Date: Sat, 4 Apr 2020 13:39:48 +0800 Subject: [PATCH] Add titles and improve messages on sidebar menus (#10872) * ui: add more message on sidebar menus * add title on the menus * show some message instead of hide choose bar when have nothing to choose * add simply filter for each menus * do same changes in mew_form.tmpl * remove some unusefull comments in mew_form.tmpl Signed-off-by: a1012112796 <1012112796@qq.com> * do review suggestions * add filter message on sidebar filter * change IsIssueWriter to HasIssuesOrPullsWritePermission Co-authored-by: Lunny Xiao Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> --- options/locale/locale_en-US.ini | 7 + routers/repo/compare.go | 2 + routers/repo/issue.go | 4 +- routers/repo/pull.go | 2 +- templates/repo/issue/new_form.tmpl | 120 ++++++++++-------- templates/repo/issue/view_content.tmpl | 6 +- .../repo/issue/view_content/context_menu.tmpl | 2 +- .../repo/issue/view_content/sidebar.tmpl | 95 +++++++++----- templates/repo/issue/view_title.tmpl | 2 +- 9 files changed, 147 insertions(+), 93 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ed6d74d35..cb34e695e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -824,17 +824,24 @@ ext_issues = Ext. Issues ext_issues.desc = Link to an external issue tracker. issues.desc = Organize bug reports, tasks and milestones. +issues.filter_assignees = Filter Assignee +issues.filter_milestones = Filter Milestone +issues.filter_labels = Filter Label issues.new = New Issue issues.new.title_empty = Title cannot be empty issues.new.labels = Labels +issues.new.add_labels_title = Apply labels issues.new.no_label = No Label issues.new.clear_labels = Clear labels +issues.new.no_items = No items issues.new.milestone = Milestone +issues.new.add_milestone_title = Set milestone issues.new.no_milestone = No Milestone issues.new.clear_milestone = Clear milestone issues.new.open_milestone = Open Milestones issues.new.closed_milestone = Closed Milestones issues.new.assignees = Assignees +issues.new.add_assignees_title = Assign users issues.new.clear_assignees = Clear assignees issues.new.no_assignees = No Assignees issues.no_ref = No Branch/Tag Specified diff --git a/routers/repo/compare.go b/routers/repo/compare.go index 87b66dc7f..198c75e65 100644 --- a/routers/repo/compare.go +++ b/routers/repo/compare.go @@ -432,6 +432,8 @@ func CompareDiff(ctx *context.Context) { setTemplateIfExists(ctx, pullRequestTemplateKey, pullRequestTemplateCandidates) renderAttachmentSettings(ctx) + ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(models.UnitTypePullRequests) + ctx.HTML(200, tplCompare) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 6dbf9cf5c..0697d11a6 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -487,6 +487,8 @@ func NewIssue(ctx *context.Context) { return } + ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(models.UnitTypeIssues) + ctx.HTML(200, tplIssueNew) } @@ -1076,7 +1078,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["ReadOnly"] = true ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string) ctx.Data["IsIssuePoster"] = ctx.IsSigned && issue.IsPoster(ctx.User.ID) - ctx.Data["IsIssueWriter"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) + ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.User.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.HTML(200, tplIssueView) diff --git a/routers/repo/pull.go b/routers/repo/pull.go index c29cfb81b..55b8bbb42 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -652,7 +652,7 @@ func ViewPullFiles(ctx *context.Context) { } getBranchData(ctx, issue) ctx.Data["IsIssuePoster"] = ctx.IsSigned && issue.IsPoster(ctx.User.ID) - ctx.Data["IsIssueWriter"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) + ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) ctx.HTML(200, tplPullFiles) } diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index a53bbdc68..0f6cd1607 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -38,21 +38,35 @@ {{template "repo/issue/branch_selector_field" .}} -