mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-05 03:28:56 +00:00
Finish change issue’s milestone
This commit is contained in:
parent
e880a2fa48
commit
16bddd593a
4 changed files with 70 additions and 30 deletions
|
@ -543,6 +543,7 @@ func ChangeMilestoneAssign(oldMid, mid int64, isIssueClosed bool) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if mid > 0 {
|
||||
m, err := GetMilestoneById(mid)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -556,6 +557,7 @@ func ChangeMilestoneAssign(oldMid, mid int64, isIssueClosed bool) (err error) {
|
|||
sess.Rollback()
|
||||
return err
|
||||
}
|
||||
}
|
||||
return sess.Commit()
|
||||
}
|
||||
|
||||
|
|
|
@ -53,17 +53,21 @@ func Issues(ctx *middleware.Context) {
|
|||
filterMode = models.FM_MENTION
|
||||
}
|
||||
|
||||
var mid int64
|
||||
midx, _ := base.StrTo(ctx.Query("milestone")).Int64()
|
||||
if midx > 0 {
|
||||
mile, err := models.GetMilestoneByIndex(ctx.Repo.Repository.Id, midx)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.Issues(GetMilestoneByIndex): %v", err)
|
||||
return
|
||||
}
|
||||
mid = mile.Id
|
||||
}
|
||||
|
||||
page, _ := base.StrTo(ctx.Query("page")).Int()
|
||||
|
||||
// Get issues.
|
||||
issues, err := models.GetIssues(assigneeId, ctx.Repo.Repository.Id, posterId, mile.Id, page,
|
||||
issues, err := models.GetIssues(assigneeId, ctx.Repo.Repository.Id, posterId, mid, page,
|
||||
isShowClosed, ctx.Query("labels"), ctx.Query("sortType"))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.Issues(GetIssues): %v", err)
|
||||
|
@ -120,6 +124,19 @@ func CreateIssue(ctx *middleware.Context, params martini.Params) {
|
|||
ctx.Data["IsRepoToolbarIssues"] = true
|
||||
ctx.Data["IsRepoToolbarIssuesList"] = false
|
||||
|
||||
var err error
|
||||
// Get all milestones.
|
||||
ctx.Data["OpenMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, false)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.ViewIssue(GetMilestones.1): %v", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["ClosedMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, true)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.ViewIssue(GetMilestones.2): %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
us, err := models.GetCollaborators(strings.TrimPrefix(ctx.Repo.RepoLink, "/"))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.CreateIssue(GetCollaborators)", err)
|
||||
|
@ -134,6 +151,19 @@ func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.C
|
|||
ctx.Data["IsRepoToolbarIssues"] = true
|
||||
ctx.Data["IsRepoToolbarIssuesList"] = false
|
||||
|
||||
var err error
|
||||
// Get all milestones.
|
||||
ctx.Data["OpenMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, false)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.ViewIssue(GetMilestones.1): %v", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["ClosedMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, true)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.ViewIssue(GetMilestones.2): %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
us, err := models.GetCollaborators(strings.TrimPrefix(ctx.Repo.RepoLink, "/"))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.CreateIssue(GetCollaborators)", err)
|
||||
|
|
|
@ -48,25 +48,33 @@
|
|||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="milestone-open">
|
||||
{{if not .OpenMilestones}}
|
||||
<p class="milestone-item">Nothing to show</p>
|
||||
{{else}}
|
||||
<ul class="list-unstyled">
|
||||
<li class="milestone-item" data-id="1">
|
||||
<p><strong>Milestone name</strong></p>
|
||||
<p>due to 3 days later</p>
|
||||
</li>
|
||||
<li class="milestone-item" data-id="1">
|
||||
<p><strong>Milestone name</strong></p>
|
||||
<p>due to 3 days later</p>
|
||||
{{range .OpenMilestones}}
|
||||
<li class="milestone-item" data-id="{{.Id}}">
|
||||
<p><strong>{{.Name}}</strong></p>
|
||||
<!-- <p>due to 3 days later</p> -->
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="milestone-close">
|
||||
{{if not .ClosedMilestones}}
|
||||
<p class="milestone-item">Nothing to show</p>
|
||||
{{else}}
|
||||
<ul class="list-unstyled">
|
||||
<li class="milestone-item" data-id="1">
|
||||
<p><strong>Milestone name</strong></p>
|
||||
<p>closed 3 days ago</p>
|
||||
{{range .ClosedMilestones}}
|
||||
<li class="milestone-item" data-id="{{.Id}}">
|
||||
<p><strong>{{.Name}}</strong></p>
|
||||
<p>Closed {{TimeSince .ClosedDate}}</p>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
</div>
|
||||
|
||||
<div class="issue-bar col-md-2">
|
||||
<div class="milestone" data-milestone="0" data-ajax="{{.Issue.Index}}/milestone">
|
||||
<div class="milestone" data-milestone="{{.Milestone.Id}}" data-ajax="{{.Issue.Index}}/milestone">
|
||||
<div class="pull-right action">
|
||||
<button class="btn btn-default btn-sm" data-toggle="dropdown">
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
|
@ -138,7 +138,7 @@
|
|||
{{range .ClosedMilestones}}
|
||||
<li class="milestone-item" data-id="{{.Id}}">
|
||||
<p><strong>{{.Name}}</strong></p>
|
||||
<p>{{TimeSince .ClosedDate}}</p>
|
||||
<p>Closed {{TimeSince .ClosedDate}}</p>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue