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

master
Unknwon 2017-03-24 14:00:01 -04:00
parent c441f8080e
commit 79ba0314e9
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
6 changed files with 17 additions and 6 deletions

View File

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

View File

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

View File

@ -103,6 +103,15 @@ func (m *Milestone) APIFormat() *api.Milestone {
return apiMilestone 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. // NewMilestone creates new milestone of repository.
func NewMilestone(m *Milestone) (err error) { func NewMilestone(m *Milestone) (err error) {
sess := x.NewSession() sess := x.NewSession()

View File

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

View File

@ -1 +1 @@
0.10.28.0323 0.10.29.0324

View File

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