Browse Source

milestone: only show issue-related count under issue list (#4316)

pull/4343/head
Unknwon 8 years ago
parent
commit
79ba0314e9
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      .editorconfig
  2. 2
      gogs.go
  3. 9
      models/milestone.go
  4. 2
      routers/repo/http.go
  5. 2
      templates/.VERSION
  6. 6
      templates/repo/issue/milestones.tmpl

2
.editorconfig

@ -21,5 +21,5 @@ indent_style = space
indent_size = 2
[*.js]
indent_style = space
indent_style = tab
indent_size = 4

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.10.28.0323"
const APP_VER = "0.10.29.0324"
func init() {
setting.AppVer = APP_VER

9
models/milestone.go

@ -103,6 +103,15 @@ func (m *Milestone) APIFormat() *api.Milestone {
return apiMilestone
}
func (m *Milestone) CountIssues(isClosed, includePulls bool) int64 {
sess := x.Where("milestone_id = ?", m.ID).And("is_closed = ?", isClosed)
if !includePulls {
sess.And("is_pull = ?", false)
}
count, _ := sess.Count(new(Issue))
return count
}
// NewMilestone creates new milestone of repository.
func NewMilestone(m *Milestone) (err error) {
sess := x.NewSession()

2
routers/repo/http.go

@ -243,7 +243,7 @@ func serviceRPC(h serviceHandler, service string) {
err error
)
// Handle GZIP.
// Handle GZIP
if h.r.Header.Get("Content-Encoding") == "gzip" {
reqBody, err = gzip.NewReader(reqBody)
if err != nil {

2
templates/.VERSION

@ -1 +1 @@
0.10.28.0323
0.10.29.0324

6
templates/repo/issue/milestones.tmpl

@ -45,8 +45,10 @@
{{end}}
{{end}}
<span class="issue-stats">
<i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.open_tab" .NumOpenIssues}}
<i class="octicon octicon-issue-closed"></i> {{$.i18n.Tr "repo.issues.close_tab" .NumClosedIssues}}
{{ $openCount := .CountIssues false false}}
{{ $closedCount := .CountIssues true false}}
<i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.open_tab" $openCount}}
<i class="octicon octicon-issue-closed"></i> {{$.i18n.Tr "repo.issues.close_tab" $closedCount}}
</span>
</div>
{{if $.IsRepositoryWriter}}

Loading…
Cancel
Save