Skip to content

Commit c55bdca

Browse files
jolheisertechknowlogick
authored andcommitted
Add same changes from issues page to milestone->issues page (#6328)
1 parent 583968f commit c55bdca

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

routers/repo/milestone.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,13 @@ func MilestoneIssuesAndPulls(ctx *context.Context) {
260260

261261
issues(ctx, milestoneID, util.OptionalBoolNone)
262262

263+
perm, err := models.GetUserRepoPermission(ctx.Repo.Repository, ctx.User)
264+
if err != nil {
265+
ctx.ServerError("GetUserRepoPermission", err)
266+
return
267+
}
268+
ctx.Data["CanWriteIssues"] = perm.CanWriteIssuesOrPulls(false)
269+
ctx.Data["CanWritePulls"] = perm.CanWriteIssuesOrPulls(true)
270+
263271
ctx.HTML(200, tplMilestoneIssues)
264272
}

routers/routes/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ func RegisterRoutes(m *macaron.Macaron) {
635635
}, context.RepoMustNotBeArchived(), reqRepoIssuesOrPullsWriter, context.RepoRef())
636636
m.Group("/milestone", func() {
637637
m.Get("/:id", repo.MilestoneIssuesAndPulls)
638-
}, reqRepoIssuesOrPullsWriter, context.RepoRef())
638+
}, reqRepoIssuesOrPullsReader, context.RepoRef())
639639
m.Combo("/compare/*", context.RepoMustNotBeArchived(), reqRepoCodeReader, reqRepoPullsReader, repo.MustAllowPulls, repo.SetEditorconfigIfExists).
640640
Get(repo.SetDiffViewStyle, repo.CompareAndPullRequest).
641641
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)

templates/repo/issue/list.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<div class="menu">
4545
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
4646
{{range .Labels}}
47-
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if .IsSelected}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
47+
<a class="item has-emoji" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if .IsSelected}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
4848
{{end}}
4949
</div>
5050
</div>
@@ -146,7 +146,7 @@
146146
</span>
147147
<div class="menu">
148148
{{range .Labels}}
149-
<div class="item issue-action" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
149+
<div class="item issue-action has-emoji" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
150150
<span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
151151
</div>
152152
{{end}}

templates/repo/issue/milestone_issues.tmpl

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
</div>
1212
{{if not .Repository.IsArchived}}
1313
<div class="column right aligned">
14+
{{if or .CanWriteIssues .CanWritePulls}}
1415
<a class="ui grey button" href="{{.RepoLink}}/milestones/{{.MilestoneID}}/edit">{{.i18n.Tr "repo.milestones.edit"}}</a>
16+
{{end}}
1517
<a class="ui green button" href="{{.RepoLink}}/issues/new?milestone={{.MilestoneID}}">{{.i18n.Tr "repo.issues.new"}}</a>
1618
</div>
1719
{{end}}
@@ -58,7 +60,7 @@
5860
<div class="menu">
5961
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
6062
{{range .Labels}}
61-
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
63+
<a class="item has-emoji" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.ID}}&assignee={{$.AssigneeID}}"><span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
6264
{{end}}
6365
</div>
6466
</div>
@@ -111,11 +113,17 @@
111113
</div>
112114
</div>
113115
</div>
114-
<div id="issue-actions" class="ui stackable grid">
116+
<div id="issue-actions" class="ui stackable grid hide">
115117
<div class="six wide column">
116-
<div class="ui basic status buttons">
117-
<div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status">{{.i18n.Tr "repo.issues.action_open"}}</div>
118-
<div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{.i18n.Tr "repo.issues.action_close"}}</div>
118+
<div class="ui tiny basic status buttons">
119+
<a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&assignee={{.AssigneeID}}">
120+
<i class="octicon octicon-issue-opened"></i>
121+
{{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}}
122+
</a>
123+
<a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&assignee={{.AssigneeID}}">
124+
<i class="octicon octicon-issue-closed"></i>
125+
{{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}}
126+
</a>
119127
</div>
120128
</div>
121129

@@ -125,15 +133,21 @@
125133
this one correctly, but not the other one. */}}
126134
<div class="nine wide right aligned right floated column">
127135
<div class="ui secondary filter stackable menu">
136+
<!-- Action Button -->
137+
{{if .IsShowClosed}}
138+
<div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.i18n.Tr "repo.issues.action_open"}}</div>
139+
{{else}}
140+
<div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.i18n.Tr "repo.issues.action_close"}}</div>
141+
{{end}}
128142
<!-- Labels -->
129-
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item" style="margin-left: auto">
143+
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item">
130144
<span class="text">
131145
{{.i18n.Tr "repo.issues.action_label"}}
132146
<i class="dropdown icon"></i>
133147
</span>
134148
<div class="menu">
135149
{{range .Labels}}
136-
<div class="item issue-action" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
150+
<div class="item issue-action has-emoji" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
137151
<span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
138152
</div>
139153
{{end}}
@@ -165,17 +179,19 @@
165179
{{range .Issues}}
166180
{{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }}
167181
<li class="item">
182+
{{if or (and $.CanWriteIssues (not .IsPull)) (and $.CanWritePulls .IsPull)}}
168183
<div class="ui checkbox issue-checkbox">
169184
<input type="checkbox" data-issue-id={{.ID}}></input>
170185
</div>
186+
{{end}}
171187
<div class="ui {{if .IsRead}}black{{else}}green{{end}} label">#{{.Index}}</div>
172188
<a class="title has-emoji" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title}}</a>
173189

174190
{{if .Ref}}
175191
<a class="ui label" href="{{$.RepoLink}}/src/branch/{{.Ref}}">{{.Ref}}</a>
176192
{{end}}
177193
{{range .Labels}}
178-
<a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
194+
<a class="ui label has-emoji" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
179195
{{end}}
180196

181197
{{if .NumComments}}

0 commit comments

Comments
 (0)