From 5336dc80c0968947af76a9522985683033d7df68 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sun, 29 Mar 2020 11:10:26 +0800 Subject: [PATCH 1/2] 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> --- options/locale/locale_en-US.ini | 4 + routers/repo/compare.go | 2 + routers/repo/issue.go | 2 + templates/repo/issue/new_form.tmpl | 118 ++++++++++-------- .../repo/issue/view_content/sidebar.tmpl | 77 ++++++++---- 5 files changed, 127 insertions(+), 76 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ed6d74d35a6cd..3208414beb2b0 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -827,14 +827,18 @@ issues.desc = Organize bug reports, tasks and milestones. 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 87b66dc7fb539..5ec5c53fd76d4 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["IsIssueWriter"] = ctx.Repo.CanWrite(models.UnitTypePullRequests) + ctx.HTML(200, tplCompare) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 6dbf9cf5c8639..fa25e26852879 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -487,6 +487,8 @@ func NewIssue(ctx *context.Context) { return } + ctx.Data["IsIssueWriter"] = ctx.Repo.CanWrite(models.UnitTypeIssues) + ctx.HTML(200, tplIssueNew) } diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index a53bbdc685aba..2a606e5218b54 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" .}} -
{{$.i18n.Tr "repo.issues.due_date_form_edit"}} - {{$.i18n.Tr "repo.issues.due_date_form_remove"}} @@ -280,7 +280,7 @@
{{.i18n.Tr "repo.issues.due_date_not_set"}}
{{end}} - {{if and .IsIssueWriter (not .Repository.IsArchived)}} + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}