From 9311a9858ae4dd10450370da8a93c37c1dad798b Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 4 Aug 2015 22:24:04 +0800 Subject: [PATCH] milestone: pagination --- cmd/web.go | 5 +- gogs.go | 2 +- models/issue.go | 87 +++++++++++++++++------------ models/repo.go | 2 +- public/css/gogs.min.css | 2 +- public/less/_repository.less | 8 +-- routers/repo/issue.go | 67 +++++++++++++--------- templates/.VERSION | 2 +- templates/repo/issue/create.tmpl | 2 +- templates/repo/issue/list.tmpl | 8 +-- templates/repo/issue/milestone.tmpl | 26 ++++++++- templates/repo/milestone2/list.tmpl | 58 ------------------- 12 files changed, 130 insertions(+), 139 deletions(-) delete mode 100644 templates/repo/milestone2/list.tmpl diff --git a/cmd/web.go b/cmd/web.go index c51ba3e890..7b67388c21 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -427,9 +427,9 @@ func runWeb(ctx *cli.Context) { m.Group("/milestones", func() { m.Get("/new", repo.NewMilestone) m.Post("/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost) - m.Get("/:index/edit", repo.UpdateMilestone) + m.Get("/:index/edit", repo.MilestoneActions) m.Post("/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost) - m.Get("/:index/:action", repo.UpdateMilestone) + m.Get("/:index/:action", repo.MilestoneActions) }, reqRepoAdmin) m.Post("/comment/:action", repo.Comment) @@ -452,7 +452,6 @@ func runWeb(ctx *cli.Context) { m.Get("/branches", repo.Branches) m.Get("/archive/*", repo.Download) m.Get("/pulls2/", repo.PullRequest2) - m.Get("/milestone2/", repo.Milestones2) m.Head("/hooks/trigger", repo.TriggerHook) m.Group("", func() { diff --git a/gogs.go b/gogs.go index 634336d10a..6c24e99868 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.6.3.0803 Beta" +const APP_VER = "0.6.3.0804 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/issue.go b/models/issue.go index 6aa9c04a1c..4c18efe877 100644 --- a/models/issue.go +++ b/models/issue.go @@ -14,6 +14,7 @@ import ( "time" "github.com/Unknwon/com" + "github.com/go-xorm/xorm" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" @@ -184,8 +185,8 @@ func GetIssueById(id int64) (*Issue, error) { return issue, nil } -// GetIssues returns a list of issues by given conditions. -func GetIssues(uid, assigneeID, repoID, posterID, milestoneID int64, page int, isClosed, isMention bool, labelIds, sortType string) ([]Issue, error) { +// Issues returns a list of issues by given conditions. +func Issues(uid, assigneeID, repoID, posterID, milestoneID int64, page int, isClosed, isMention bool, labelIds, sortType string) ([]*Issue, error) { sess := x.Limit(setting.IssuePagingNum, (page-1)*setting.IssuePagingNum) if repoID > 0 { @@ -237,7 +238,7 @@ func GetIssues(uid, assigneeID, repoID, posterID, milestoneID int64, page int, i sess.Join("INNER", "issue_user", queryStr) } - var issues []Issue + issues := make([]*Issue, 0, setting.IssuePagingNum) return issues, sess.Find(&issues) } @@ -627,7 +628,7 @@ func DeleteLabel(repoID, labelID int64) error { // Milestone represents a milestone of repository. type Milestone struct { ID int64 `xorm:"pk autoincr"` - RepoId int64 `xorm:"INDEX"` + RepoID int64 `xorm:"INDEX"` Index int64 Name string Content string `xorm:"TEXT"` @@ -642,6 +643,17 @@ type Milestone struct { ClosedDate time.Time } +func (m *Milestone) BeforeSet(colName string, val xorm.Cell) { + if colName == "deadline" { + t := (*val).(time.Time) + if t.Year() == 9999 { + return + } + + m.DeadlineString = t.Format("2006-01-02") + } +} + // CalOpenIssues calculates the open issues of milestone. func (m *Milestone) CalOpenIssues() { m.NumOpenIssues = m.NumIssues - m.NumClosedIssues @@ -661,15 +673,15 @@ func NewMilestone(m *Milestone) (err error) { } rawSql := "UPDATE `repository` SET num_milestones = num_milestones + 1 WHERE id = ?" - if _, err = sess.Exec(rawSql, m.RepoId); err != nil { + if _, err = sess.Exec(rawSql, m.RepoID); err != nil { sess.Rollback() return err } return sess.Commit() } -// GetMilestoneById returns the milestone by given ID. -func GetMilestoneById(id int64) (*Milestone, error) { +// MilestoneById returns the milestone by given ID. +func MilestoneById(id int64) (*Milestone, error) { m := &Milestone{ID: id} has, err := x.Get(m) if err != nil { @@ -682,7 +694,7 @@ func GetMilestoneById(id int64) (*Milestone, error) { // GetMilestoneByIndex returns the milestone of given repository and index. func GetMilestoneByIndex(repoId, idx int64) (*Milestone, error) { - m := &Milestone{RepoId: repoId, Index: idx} + m := &Milestone{RepoID: repoId, Index: idx} has, err := x.Get(m) if err != nil { return nil, err @@ -693,9 +705,14 @@ func GetMilestoneByIndex(repoId, idx int64) (*Milestone, error) { } // Milestones returns a list of milestones of given repository and status. -func Milestones(repoID int64, isClosed bool) ([]*Milestone, error) { - miles := make([]*Milestone, 0, 10) - return miles, x.Where("repo_id=? AND is_closed=?", repoID, isClosed).Find(&miles) +func Milestones(repoID int64, page int, isClosed bool) ([]*Milestone, error) { + miles := make([]*Milestone, 0, setting.IssuePagingNum) + sess := x.Where("repo_id=? AND is_closed=?", repoID, isClosed) + if page > 0 { + sess = sess.Limit(setting.IssuePagingNum, (page-1)*setting.IssuePagingNum) + } + return miles, sess.Find(&miles) + } // UpdateMilestone updates information of given milestone. @@ -704,46 +721,51 @@ func UpdateMilestone(m *Milestone) error { return err } +// CountClosedMilestones returns number of closed milestones in given repository. +func CountClosedMilestones(repoID int64) int64 { + closed, _ := x.Where("repo_id=? AND is_closed=?", repoID, true).Count(new(Milestone)) + return closed +} + +// MilestoneStats returns number of open and closed milestones of given repository. +func MilestoneStats(repoID int64) (open int64, closed int64) { + open, _ = x.Where("repo_id=? AND is_closed=?", repoID, false).Count(new(Milestone)) + return open, CountClosedMilestones(repoID) +} + // ChangeMilestoneStatus changes the milestone open/closed status. func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error) { - repo, err := GetRepositoryById(m.RepoId) + repo, err := GetRepositoryById(m.RepoID) if err != nil { return err } sess := x.NewSession() - defer sess.Close() + defer sessionRelease(sess) if err = sess.Begin(); err != nil { return err } m.IsClosed = isClosed - if _, err = sess.Id(m.ID).AllCols().Update(m); err != nil { - sess.Rollback() + if err = UpdateMilestone(m); err != nil { return err } - if isClosed { - repo.NumClosedMilestones++ - } else { - repo.NumClosedMilestones-- - } - if _, err = sess.Id(repo.Id).Update(repo); err != nil { - sess.Rollback() + repo.NumClosedMilestones = int(CountClosedMilestones(repo.Id)) + if _, err = sess.Id(repo.Id).AllCols().Update(repo); err != nil { return err } return sess.Commit() } -// ChangeMilestoneIssueStats updates the open/closed issues counter and progress for the -// milestone associated witht the given issue. +// ChangeMilestoneIssueStats updates the open/closed issues counter and progress +// for the milestone associated witht the given issue. func ChangeMilestoneIssueStats(issue *Issue) error { if issue.MilestoneId == 0 { return nil } - m, err := GetMilestoneById(issue.MilestoneId) - + m, err := MilestoneById(issue.MilestoneId) if err != nil { return err } @@ -770,7 +792,7 @@ func ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error) { } if oldMid > 0 { - m, err := GetMilestoneById(oldMid) + m, err := MilestoneById(oldMid) if err != nil { return err } @@ -798,7 +820,7 @@ func ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error) { } if mid > 0 { - m, err := GetMilestoneById(mid) + m, err := MilestoneById(mid) if err != nil { return err } @@ -842,7 +864,7 @@ func DeleteMilestone(m *Milestone) (err error) { } rawSql := "UPDATE `repository` SET num_milestones = num_milestones - 1 WHERE id = ?" - if _, err = sess.Exec(rawSql, m.RepoId); err != nil { + if _, err = sess.Exec(rawSql, m.RepoID); err != nil { sess.Rollback() return err } @@ -861,13 +883,6 @@ func DeleteMilestone(m *Milestone) (err error) { return sess.Commit() } -// MilestoneStats returns stats of open and closed milestone count of given repository. -func MilestoneStats(repoID int64) (open int64, closed int64) { - open, _ = x.Where("repo_id=? AND is_closed=?", repoID, false).Count(new(Milestone)) - closed, _ = x.Where("repo_id=? AND is_closed=?", repoID, true).Count(new(Milestone)) - return open, closed -} - // _________ __ // \_ ___ \ ____ _____ _____ ____ _____/ |_ // / \ \/ / _ \ / \ / \_/ __ \ / \ __\ diff --git a/models/repo.go b/models/repo.go index a2b29ff31b..25eb3a62ec 100644 --- a/models/repo.go +++ b/models/repo.go @@ -867,7 +867,7 @@ func DeleteRepository(uid, repoID int64, userName string) error { return err } else if _, err = sess.Delete(&IssueUser{RepoId: repoID}); err != nil { return err - } else if _, err = sess.Delete(&Milestone{RepoId: repoID}); err != nil { + } else if _, err = sess.Delete(&Milestone{RepoID: repoID}); err != nil { return err } else if _, err = sess.Delete(&Release{RepoId: repoID}); err != nil { return err diff --git a/public/css/gogs.min.css b/public/css/gogs.min.css index 9635bd933e..1158fefa60 100644 --- a/public/css/gogs.min.css +++ b/public/css/gogs.min.css @@ -1 +1 @@ -@font-face{font-family:octicons;src:url(../fonts/octicons.eot?#iefix&v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('embedded-opentype'),url(../fonts/octicons.woff?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('woff'),url(../fonts/octicons.ttf?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('truetype'),url(../fonts/octicons.svg?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6#octicons)format('svg');font-weight:400;font-style:normal}.mega-octicon,.octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-alignment-align:before{content:'\f08a'}.octicon-alignment-aligned-to:before{content:'\f08e'}.octicon-alignment-unalign:before{content:'\f08b'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-beer:before{content:'\f069'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hourglass:before{content:'\f09e'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-jump-down:before{content:'\f072'}.octicon-jump-left:before{content:'\f0a5'}.octicon-jump-right:before{content:'\f0a6'}.octicon-jump-up:before{content:'\f073'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicon-link:before{content:'\f05c'}.octicon-link-external:before{content:'\f07f'}.octicon-list-ordered:before{content:'\f062'}.octicon-list-unordered:before{content:'\f061'}.octicon-location:before{content:'\f060'}.octicon-gist-private:before,.octicon-git-fork-private:before,.octicon-lock:before,.octicon-mirror-private:before{content:'\f06a'}.octicon-logo-github:before{content:'\f092'}.octicon-mail:before{content:'\f03b'}.octicon-mail-read:before{content:'\f03c'}.octicon-mail-reply:before{content:'\f051'}.octicon-mark-github:before{content:'\f00a'}.octicon-markdown:before{content:'\f0c9'}.octicon-megaphone:before{content:'\f077'}.octicon-mention:before{content:'\f0be'}.octicon-microscope:before{content:'\f089'}.octicon-milestone:before{content:'\f075'}.octicon-mirror-public:before,.octicon-mirror:before{content:'\f024'}.octicon-mortar-board:before{content:'\f0d7'}.octicon-move-down:before{content:'\f0a8'}.octicon-move-left:before{content:'\f074'}.octicon-move-right:before{content:'\f0a9'}.octicon-move-up:before{content:'\f0a7'}.octicon-mute:before{content:'\f080'}.octicon-no-newline:before{content:'\f09c'}.octicon-octoface:before{content:'\f008'}.octicon-organization:before{content:'\f037'}.octicon-package:before{content:'\f0c4'}.octicon-paintcan:before{content:'\f0d1'}.octicon-pencil:before{content:'\f058'}.octicon-person-add:before,.octicon-person-follow:before,.octicon-person:before{content:'\f018'}.octicon-pin:before{content:'\f041'}.octicon-playback-fast-forward:before{content:'\f0bd'}.octicon-playback-pause:before{content:'\f0bb'}.octicon-playback-play:before{content:'\f0bf'}.octicon-playback-rewind:before{content:'\f0bc'}.octicon-plug:before{content:'\f0d4'}.octicon-file-add:before,.octicon-file-directory-create:before,.octicon-gist-new:before,.octicon-plus:before,.octicon-repo-create:before{content:'\f05d'}.octicon-podium:before{content:'\f0af'}.octicon-primitive-dot:before{content:'\f052'}.octicon-primitive-square:before{content:'\f053'}.octicon-pulse:before{content:'\f085'}.octicon-puzzle:before{content:'\f0c0'}.octicon-question:before{content:'\f02c'}.octicon-quote:before{content:'\f063'}.octicon-radio-tower:before{content:'\f030'}.octicon-repo-delete:before,.octicon-repo:before{content:'\f001'}.octicon-repo-clone:before{content:'\f04c'}.octicon-repo-force-push:before{content:'\f04a'}.octicon-gist-fork:before,.octicon-repo-forked:before{content:'\f002'}.octicon-repo-pull:before{content:'\f006'}.octicon-repo-push:before{content:'\f005'}.octicon-rocket:before{content:'\f033'}.octicon-rss:before{content:'\f034'}.octicon-ruby:before{content:'\f047'}.octicon-screen-full:before{content:'\f066'}.octicon-screen-normal:before{content:'\f067'}.octicon-search-save:before,.octicon-search:before{content:'\f02e'}.octicon-server:before{content:'\f097'}.octicon-settings:before{content:'\f07c'}.octicon-log-in:before,.octicon-sign-in:before{content:'\f036'}.octicon-log-out:before,.octicon-sign-out:before{content:'\f032'}.octicon-split:before{content:'\f0c6'}.octicon-squirrel:before{content:'\f0b2'}.octicon-star-add:before,.octicon-star-delete:before,.octicon-star:before{content:'\f02a'}.octicon-steps:before{content:'\f0c7'}.octicon-stop:before{content:'\f08f'}.octicon-repo-sync:before,.octicon-sync:before{content:'\f087'}.octicon-tag-add:before,.octicon-tag-remove:before,.octicon-tag:before{content:'\f015'}.octicon-telescope:before{content:'\f088'}.octicon-terminal:before{content:'\f0c8'}.octicon-three-bars:before{content:'\f05e'}.octicon-thumbsdown:before{content:'\f0db'}.octicon-thumbsup:before{content:'\f0da'}.octicon-tools:before{content:'\f031'}.octicon-trashcan:before{content:'\f0d0'}.octicon-triangle-down:before{content:'\f05b'}.octicon-triangle-left:before{content:'\f044'}.octicon-triangle-right:before{content:'\f05a'}.octicon-triangle-up:before{content:'\f0aa'}.octicon-unfold:before{content:'\f039'}.octicon-unmute:before{content:'\f0ba'}.octicon-versions:before{content:'\f064'}.octicon-remove-close:before,.octicon-x:before{content:'\f081'}.octicon-zap:before{content:'\26A1'}body{font-family:'Helvetica Neue',Arial,Helvetica,sans-serif,'微软雅黑';background-color:#FAFAFA}img{border-radius:3px}.full.height{padding:0;margin:0 0 -87px 0;min-height:100%}.following.bar{z-index:900;left:0;width:100%;padding:.7em 0}.following.bar.light{background-color:#fff;border-bottom:1px solid #DDD;box-shadow:0 2px 3px rgba(0,0,0,.04)}.following.bar .ui.secondary.menu{height:30px}.following.bar .column .menu{margin-top:0}.following.bar .brand{float:left;margin-right:5px}.following.bar .head.link.item{padding-right:0!important}.following.bar .head.link.item .dropdown.icon,.following.bar .head.link.item .menu .octicon{margin-right:5px}.following.bar .user.avatar{padding:0;margin-top:1px}.following.bar .searchbox{background-color:#f4f4f4!important}.following.bar .searchbox:focus{background-color:#e9e9e9!important}.following.bar .octicon{width:16px;opacity:1!important;text-align:center}.ui.left{float:left}.ui.right{float:right}footer{margin-top:40px!important;background-color:#fff;border-top:1px solid #d6d6d6;clear:both;width:100%;color:#888}footer .fa{width:16px;text-align:center;color:#428bca}footer .links>*{border-left:1px solid #d6d6d6;padding-left:8px;margin-left:5px}footer .links>:first-child{border-left:none}.hide{display:none}.center{text-align:center}.text-error{color:#d95c5c!important}.img-1{width:2px;height:2px}.img-2{width:4px;height:4px}.img-3{width:6px;height:6px}.img-4{width:8px;height:8px}.img-5{width:10px;height:10px}.img-6{width:12px;height:12px}.img-7{width:14px;height:14px}.img-8{width:16px;height:16px}.img-9{width:18px;height:18px}.img-10{width:20px;height:20px}.img-11{width:22px;height:22px}.img-12{width:24px;height:24px}.img-13{width:26px;height:26px}.img-14{width:28px;height:28px}.img-15{width:30px;height:30px}.img-16{width:32px;height:32px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.home{padding-bottom:120px}.home .logo{max-width:250px}.home .hero h1,.home .hero h2{font-family:'PT Sans Narrow',sans-serif}.home .hero h1{font-size:7em}.home .hero h2{font-size:4em}.home .hero .octicon{color:#d9453d;font-size:60px;margin-right:10px}.home .hero.header{font-size:24px}.home p.large{font-size:20px}.home .stackable{padding-top:30px}.home a{color:#d9453d}.install{padding-top:45px;padding-bottom:120px}.install .attached.header{background:#f0f0f0}.install form label{text-align:right;width:40%!important}.install form input{width:35%!important}.install form .field{text-align:left}.install form .field .help{margin-left:41%}.install form .field.optional .title{margin-left:38%}.install .ui .checkbox{margin-left:40%!important}.install .ui .checkbox label{width:auto!important}.form .help{color:#999;padding-top:.6em;padding-bottom:.6em;display:inline-block}.repository{padding-top:15px;padding-bottom:120px}.repository .head{height:75px;padding-top:20px;background-color:#FCFCFC}.repository .head .mega-octicon{width:30px}.repository .head .fork-flag,.repository .head a{font-weight:300}.repository .head .ui.label{margin-top:5px;vertical-align:top}.repository .head .fork-flag{margin-left:38px;display:block;font-size:11px;line-height:10px;white-space:nowrap}.repository .head .button{margin-left:10px}.repository .head .button i{margin-right:5px}.repository .head .num{font-weight:700}.repository .head .octicon{height:5px}.repository .navbar{height:60px;padding-top:20px}.repository .navbar .ui.secondary.menu .item{margin-left:-10px;margin-top:-7px}.repository .navbar .ui.secondary.menu .item>.input .color-picker,.repository .navbar .ui.secondary.menu .item>.input .new-label-input{background-color:#fff;border:1px solid rgba(0,0,0,.15)}.repository .navbar .ui.secondary.menu .item .new-label-input{width:150px}.repository .navbar .ui.secondary.menu .item .color-picker{height:35px;width:auto;padding-left:30px}.repository .navbar .ui.secondary.menu .item .minicolors-swatch.minicolors-sprite{top:10px;left:10px;width:15px;height:15px}.repository .navbar .ui.secondary.menu .item.precolors{padding-left:0;padding-right:0;margin-right:10px;width:120px}.repository .navbar .ui.secondary.menu .item.precolors .color{float:left;width:15px;height:15px}.repository .filter.menu .label.color{margin-left:17px;padding:0 8px}.repository .filter.menu .octicon{float:left;margin-left:-5px;margin-right:-7px}.repository .filter.menu .menu{max-height:300px;overflow-x:auto}.repository .type.item .menu{right:0!important;left:auto!important}.repository .issue.list{clear:both;list-style:none}.repository .issue.list>.item{padding-top:15px;padding-bottom:10px;border-bottom:1px dashed #AAA}.repository .issue.list>.item .title{color:#444;font-size:15px;font-weight:700;margin:0 6px}.repository .issue.list>.item .title:hover{color:#000}.repository .issue.list>.item .comment{padding-right:10px;color:#666}.repository .issue.list>.item .desc{padding-top:5px;color:#999}.repository .issue.list .page.buttons{padding-top:15px}.repository .label.list{clear:both;list-style:none}.repository .label.list .item{padding-top:10px;padding-bottom:10px;border-bottom:1px dashed #AAA}.repository .label.list .item a{font-size:15px;padding-top:5px;padding-right:10px;color:#666}.repository .label.list .item a:hover{color:#000}.repository .label.list .item a.open-issues{margin-right:30px}.repository .milestone.list{clear:both;list-style:none}.repository .milestone.list .item{padding-top:10px;padding-bottom:10px;border-bottom:1px dashed #AAA}.repository .milestone.list .item>a{padding-top:5px;padding-right:10px;color:#000}.repository .milestone.list .item>a:hover{color:#4078c0}.repository .milestone.list .item .ui.progress{width:40%;padding:0;border:0;margin:0}.repository .milestone.list .item .ui.progress .bar{height:20px}.repository .milestone.list .item .meta{color:#999;padding-top:5px}.repository .milestone.list .item .meta .issue-stats .octicon{padding-left:5px}.repository .milestone.list .item .operate{margin-top:-15px}.repository .milestone.list .item .operate>a{font-size:15px;padding-top:5px;padding-right:10px;color:#666}.repository .milestone.list .item .operate>a:hover{color:#000}.repository .milestone.list .item .content{padding-top:10px}.edit-label.modal .color-picker{margin-top:-8px!important;height:35px;width:auto!important;padding-left:30px!important}.edit-label.modal .minicolors-swatch.minicolors-sprite{top:1px;left:10px;width:15px;height:15px}.edit-label.modal .precolors{margin-bottom:-11px!important;padding-left:0!important;padding-right:0!important;margin-right:10px!important;width:120px!important}.edit-label.modal .precolors .color{float:left;margin:0!important;width:15px;height:15px} \ No newline at end of file +@font-face{font-family:octicons;src:url(../fonts/octicons.eot?#iefix&v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('embedded-opentype'),url(../fonts/octicons.woff?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('woff'),url(../fonts/octicons.ttf?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('truetype'),url(../fonts/octicons.svg?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6#octicons)format('svg');font-weight:400;font-style:normal}.mega-octicon,.octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-alignment-align:before{content:'\f08a'}.octicon-alignment-aligned-to:before{content:'\f08e'}.octicon-alignment-unalign:before{content:'\f08b'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-beer:before{content:'\f069'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hourglass:before{content:'\f09e'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-jump-down:before{content:'\f072'}.octicon-jump-left:before{content:'\f0a5'}.octicon-jump-right:before{content:'\f0a6'}.octicon-jump-up:before{content:'\f073'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicon-link:before{content:'\f05c'}.octicon-link-external:before{content:'\f07f'}.octicon-list-ordered:before{content:'\f062'}.octicon-list-unordered:before{content:'\f061'}.octicon-location:before{content:'\f060'}.octicon-gist-private:before,.octicon-git-fork-private:before,.octicon-lock:before,.octicon-mirror-private:before{content:'\f06a'}.octicon-logo-github:before{content:'\f092'}.octicon-mail:before{content:'\f03b'}.octicon-mail-read:before{content:'\f03c'}.octicon-mail-reply:before{content:'\f051'}.octicon-mark-github:before{content:'\f00a'}.octicon-markdown:before{content:'\f0c9'}.octicon-megaphone:before{content:'\f077'}.octicon-mention:before{content:'\f0be'}.octicon-microscope:before{content:'\f089'}.octicon-milestone:before{content:'\f075'}.octicon-mirror-public:before,.octicon-mirror:before{content:'\f024'}.octicon-mortar-board:before{content:'\f0d7'}.octicon-move-down:before{content:'\f0a8'}.octicon-move-left:before{content:'\f074'}.octicon-move-right:before{content:'\f0a9'}.octicon-move-up:before{content:'\f0a7'}.octicon-mute:before{content:'\f080'}.octicon-no-newline:before{content:'\f09c'}.octicon-octoface:before{content:'\f008'}.octicon-organization:before{content:'\f037'}.octicon-package:before{content:'\f0c4'}.octicon-paintcan:before{content:'\f0d1'}.octicon-pencil:before{content:'\f058'}.octicon-person-add:before,.octicon-person-follow:before,.octicon-person:before{content:'\f018'}.octicon-pin:before{content:'\f041'}.octicon-playback-fast-forward:before{content:'\f0bd'}.octicon-playback-pause:before{content:'\f0bb'}.octicon-playback-play:before{content:'\f0bf'}.octicon-playback-rewind:before{content:'\f0bc'}.octicon-plug:before{content:'\f0d4'}.octicon-file-add:before,.octicon-file-directory-create:before,.octicon-gist-new:before,.octicon-plus:before,.octicon-repo-create:before{content:'\f05d'}.octicon-podium:before{content:'\f0af'}.octicon-primitive-dot:before{content:'\f052'}.octicon-primitive-square:before{content:'\f053'}.octicon-pulse:before{content:'\f085'}.octicon-puzzle:before{content:'\f0c0'}.octicon-question:before{content:'\f02c'}.octicon-quote:before{content:'\f063'}.octicon-radio-tower:before{content:'\f030'}.octicon-repo-delete:before,.octicon-repo:before{content:'\f001'}.octicon-repo-clone:before{content:'\f04c'}.octicon-repo-force-push:before{content:'\f04a'}.octicon-gist-fork:before,.octicon-repo-forked:before{content:'\f002'}.octicon-repo-pull:before{content:'\f006'}.octicon-repo-push:before{content:'\f005'}.octicon-rocket:before{content:'\f033'}.octicon-rss:before{content:'\f034'}.octicon-ruby:before{content:'\f047'}.octicon-screen-full:before{content:'\f066'}.octicon-screen-normal:before{content:'\f067'}.octicon-search-save:before,.octicon-search:before{content:'\f02e'}.octicon-server:before{content:'\f097'}.octicon-settings:before{content:'\f07c'}.octicon-log-in:before,.octicon-sign-in:before{content:'\f036'}.octicon-log-out:before,.octicon-sign-out:before{content:'\f032'}.octicon-split:before{content:'\f0c6'}.octicon-squirrel:before{content:'\f0b2'}.octicon-star-add:before,.octicon-star-delete:before,.octicon-star:before{content:'\f02a'}.octicon-steps:before{content:'\f0c7'}.octicon-stop:before{content:'\f08f'}.octicon-repo-sync:before,.octicon-sync:before{content:'\f087'}.octicon-tag-add:before,.octicon-tag-remove:before,.octicon-tag:before{content:'\f015'}.octicon-telescope:before{content:'\f088'}.octicon-terminal:before{content:'\f0c8'}.octicon-three-bars:before{content:'\f05e'}.octicon-thumbsdown:before{content:'\f0db'}.octicon-thumbsup:before{content:'\f0da'}.octicon-tools:before{content:'\f031'}.octicon-trashcan:before{content:'\f0d0'}.octicon-triangle-down:before{content:'\f05b'}.octicon-triangle-left:before{content:'\f044'}.octicon-triangle-right:before{content:'\f05a'}.octicon-triangle-up:before{content:'\f0aa'}.octicon-unfold:before{content:'\f039'}.octicon-unmute:before{content:'\f0ba'}.octicon-versions:before{content:'\f064'}.octicon-remove-close:before,.octicon-x:before{content:'\f081'}.octicon-zap:before{content:'\26A1'}body{font-family:'Helvetica Neue',Arial,Helvetica,sans-serif,'微软雅黑';background-color:#FAFAFA}img{border-radius:3px}.full.height{padding:0;margin:0 0 -87px 0;min-height:100%}.following.bar{z-index:900;left:0;width:100%;padding:.7em 0}.following.bar.light{background-color:#fff;border-bottom:1px solid #DDD;box-shadow:0 2px 3px rgba(0,0,0,.04)}.following.bar .ui.secondary.menu{height:30px}.following.bar .column .menu{margin-top:0}.following.bar .brand{float:left;margin-right:5px}.following.bar .head.link.item{padding-right:0!important}.following.bar .head.link.item .dropdown.icon,.following.bar .head.link.item .menu .octicon{margin-right:5px}.following.bar .user.avatar{padding:0;margin-top:1px}.following.bar .searchbox{background-color:#f4f4f4!important}.following.bar .searchbox:focus{background-color:#e9e9e9!important}.following.bar .octicon{width:16px;opacity:1!important;text-align:center}.ui.left{float:left}.ui.right{float:right}footer{margin-top:40px!important;background-color:#fff;border-top:1px solid #d6d6d6;clear:both;width:100%;color:#888}footer .fa{width:16px;text-align:center;color:#428bca}footer .links>*{border-left:1px solid #d6d6d6;padding-left:8px;margin-left:5px}footer .links>:first-child{border-left:none}.hide{display:none}.center{text-align:center}.text-error{color:#d95c5c!important}.img-1{width:2px;height:2px}.img-2{width:4px;height:4px}.img-3{width:6px;height:6px}.img-4{width:8px;height:8px}.img-5{width:10px;height:10px}.img-6{width:12px;height:12px}.img-7{width:14px;height:14px}.img-8{width:16px;height:16px}.img-9{width:18px;height:18px}.img-10{width:20px;height:20px}.img-11{width:22px;height:22px}.img-12{width:24px;height:24px}.img-13{width:26px;height:26px}.img-14{width:28px;height:28px}.img-15{width:30px;height:30px}.img-16{width:32px;height:32px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.home{padding-bottom:120px}.home .logo{max-width:250px}.home .hero h1,.home .hero h2{font-family:'PT Sans Narrow',sans-serif}.home .hero h1{font-size:7em}.home .hero h2{font-size:4em}.home .hero .octicon{color:#d9453d;font-size:60px;margin-right:10px}.home .hero.header{font-size:24px}.home p.large{font-size:20px}.home .stackable{padding-top:30px}.home a{color:#d9453d}.install{padding-top:45px;padding-bottom:120px}.install .attached.header{background:#f0f0f0}.install form label{text-align:right;width:40%!important}.install form input{width:35%!important}.install form .field{text-align:left}.install form .field .help{margin-left:41%}.install form .field.optional .title{margin-left:38%}.install .ui .checkbox{margin-left:40%!important}.install .ui .checkbox label{width:auto!important}.form .help{color:#999;padding-top:.6em;padding-bottom:.6em;display:inline-block}.repository{padding-top:15px;padding-bottom:120px}.repository .head{height:75px;padding-top:20px;background-color:#FCFCFC}.repository .head .mega-octicon{width:30px}.repository .head .fork-flag,.repository .head a{font-weight:300}.repository .head .ui.label{margin-top:5px;vertical-align:top}.repository .head .fork-flag{margin-left:38px;display:block;font-size:11px;line-height:10px;white-space:nowrap}.repository .head .button{margin-left:10px}.repository .head .button i{margin-right:5px}.repository .head .num{font-weight:700}.repository .head .octicon{height:5px}.repository .navbar{height:60px;padding-top:20px}.repository .navbar .ui.secondary.menu .item{margin-left:-10px;margin-top:-7px}.repository .navbar .ui.secondary.menu .item>.input .color-picker,.repository .navbar .ui.secondary.menu .item>.input .new-label-input{background-color:#fff;border:1px solid rgba(0,0,0,.15)}.repository .navbar .ui.secondary.menu .item .new-label-input{width:150px}.repository .navbar .ui.secondary.menu .item .color-picker{height:35px;width:auto;padding-left:30px}.repository .navbar .ui.secondary.menu .item .minicolors-swatch.minicolors-sprite{top:10px;left:10px;width:15px;height:15px}.repository .navbar .ui.secondary.menu .item.precolors{padding-left:0;padding-right:0;margin-right:10px;width:120px}.repository .navbar .ui.secondary.menu .item.precolors .color{float:left;width:15px;height:15px}.repository .filter.menu .label.color{margin-left:17px;padding:0 8px}.repository .filter.menu .octicon{float:left;margin-left:-5px;margin-right:-7px}.repository .filter.menu .menu{max-height:300px;overflow-x:auto}.repository .type.item .menu{right:0!important;left:auto!important}.repository .page.buttons{padding-top:15px}.repository .issue.list{clear:both;list-style:none}.repository .issue.list>.item{padding-top:15px;padding-bottom:10px;border-bottom:1px dashed #AAA}.repository .issue.list>.item .title{color:#444;font-size:15px;font-weight:700;margin:0 6px}.repository .issue.list>.item .title:hover{color:#000}.repository .issue.list>.item .comment{padding-right:10px;color:#666}.repository .issue.list>.item .desc{padding-top:5px;color:#999}.repository .label.list{clear:both;list-style:none}.repository .label.list .item{padding-top:10px;padding-bottom:10px;border-bottom:1px dashed #AAA}.repository .label.list .item a{font-size:15px;padding-top:5px;padding-right:10px;color:#666}.repository .label.list .item a:hover{color:#000}.repository .label.list .item a.open-issues{margin-right:30px}.repository .milestone.list{clear:both;list-style:none}.repository .milestone.list>.item{padding-top:10px;padding-bottom:10px;border-bottom:1px dashed #AAA}.repository .milestone.list>.item>a{padding-top:5px;padding-right:10px;color:#000}.repository .milestone.list>.item>a:hover{color:#4078c0}.repository .milestone.list>.item .ui.progress{width:40%;padding:0;border:0;margin:0}.repository .milestone.list>.item .ui.progress .bar{height:20px}.repository .milestone.list>.item .meta{color:#999;padding-top:5px}.repository .milestone.list>.item .meta .issue-stats .octicon{padding-left:5px}.repository .milestone.list>.item .operate{margin-top:-15px}.repository .milestone.list>.item .operate>a{font-size:15px;padding-top:5px;padding-right:10px;color:#666}.repository .milestone.list>.item .operate>a:hover{color:#000}.repository .milestone.list>.item .content{padding-top:10px}.edit-label.modal .color-picker{margin-top:-8px!important;height:35px;width:auto!important;padding-left:30px!important}.edit-label.modal .minicolors-swatch.minicolors-sprite{top:1px;left:10px;width:15px;height:15px}.edit-label.modal .precolors{margin-bottom:-11px!important;padding-left:0!important;padding-right:0!important;margin-right:10px!important;width:120px!important}.edit-label.modal .precolors .color{float:left;margin:0!important;width:15px;height:15px} \ No newline at end of file diff --git a/public/less/_repository.less b/public/less/_repository.less index 5cfdc674e1..75736de8f4 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -98,6 +98,9 @@ left: auto!important; } + .page.buttons { + padding-top: 15px; + } .issue.list { clear: both; list-style: none; @@ -123,9 +126,6 @@ color: #999; } } - .page.buttons { - padding-top: 15px; - } } .label.list { @@ -153,7 +153,7 @@ .milestone.list { clear: both; list-style: none; - .item { + > .item { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px dashed #AAA; diff --git a/routers/repo/issue.go b/routers/repo/issue.go index ea990dd1b5..89fcf558b3 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -66,8 +66,6 @@ func Issues(ctx *middleware.Context) { viewType = "all" } - isShowClosed := ctx.Query("state") == "closed" - // Must sign in to see issues about you. if viewType != "all" && !ctx.IsSigned { ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) @@ -96,6 +94,7 @@ func Issues(ctx *middleware.Context) { repo := ctx.Repo.Repository selectLabels := ctx.Query("labels") milestoneID := ctx.QueryInt64("milestone") + isShowClosed := ctx.Query("state") == "closed" issueStats := models.GetIssueStats(repo.Id, uid, com.StrTo(selectLabels).MustInt64(), isShowClosed, filterMode) page := ctx.QueryInt("page") @@ -112,7 +111,7 @@ func Issues(ctx *middleware.Context) { ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5) // Get issues. - issues, err := models.GetIssues(uid, assigneeID, repo.Id, posterID, milestoneID, + issues, err := models.Issues(uid, assigneeID, repo.Id, posterID, milestoneID, page, isShowClosed, filterMode == models.FM_MENTION, selectLabels, ctx.Query("sortType")) if err != nil { ctx.Handle(500, "GetIssues: %v", err) @@ -172,22 +171,25 @@ func CreateIssue(ctx *middleware.Context) { ctx.Data["IsRepoToolbarIssuesList"] = false ctx.Data["AttachmentsEnabled"] = setting.AttachmentEnabled - var err error + var ( + repo = ctx.Repo.Repository + err error + ) // Get all milestones. - ctx.Data["OpenMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, false) + ctx.Data["OpenMilestones"], err = models.Milestones(repo.Id, -1, false) if err != nil { - ctx.Handle(500, "issue.ViewIssue(GetMilestones.1): %v", err) + ctx.Handle(500, "GetMilestones.1: %v", err) return } - ctx.Data["ClosedMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, true) + ctx.Data["ClosedMilestones"], err = models.Milestones(repo.Id, -1, true) if err != nil { - ctx.Handle(500, "issue.ViewIssue(GetMilestones.2): %v", err) + ctx.Handle(500, "GetMilestones.2: %v", err) return } - us, err := ctx.Repo.Repository.GetCollaborators() + us, err := repo.GetCollaborators() if err != nil { - ctx.Handle(500, "issue.CreateIssue(GetCollaborators)", err) + ctx.Handle(500, "GetCollaborators", err) return } @@ -218,12 +220,12 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) { var err error // Get all milestones. - _, err = models.Milestones(ctx.Repo.Repository.Id, false) + _, err = models.Milestones(ctx.Repo.Repository.Id, -1, false) if err != nil { send(500, nil, err) return } - _, err = models.Milestones(ctx.Repo.Repository.Id, true) + _, err = models.Milestones(ctx.Repo.Repository.Id, -1, true) if err != nil { send(500, nil, err) return @@ -371,7 +373,7 @@ func ViewIssue(ctx *middleware.Context) { // Get assigned milestone. if issue.MilestoneId > 0 { - ctx.Data["Milestone"], err = models.GetMilestoneById(issue.MilestoneId) + ctx.Data["Milestone"], err = models.MilestoneById(issue.MilestoneId) if err != nil { if err == models.ErrMilestoneNotExist { log.Warn("issue.ViewIssue(GetMilestoneById): %v", err) @@ -383,12 +385,12 @@ func ViewIssue(ctx *middleware.Context) { } // Get all milestones. - ctx.Data["OpenMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, false) + ctx.Data["OpenMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, -1, false) if err != nil { ctx.Handle(500, "issue.ViewIssue(GetMilestones.1): %v", err) return } - ctx.Data["ClosedMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, true) + ctx.Data["ClosedMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, -1, true) if err != nil { ctx.Handle(500, "issue.ViewIssue(GetMilestones.2): %v", err) return @@ -969,8 +971,24 @@ func Milestones(ctx *middleware.Context) { ctx.Data["PageIsMilestones"] = true isShowClosed := ctx.Query("state") == "closed" + openCount, closedCount := models.MilestoneStats(ctx.Repo.Repository.Id) + ctx.Data["OpenCount"] = openCount + ctx.Data["ClosedCount"] = closedCount - miles, err := models.Milestones(ctx.Repo.Repository.Id, isShowClosed) + page := ctx.QueryInt("page") + if page <= 1 { + page = 1 + } + + var total int + if !isShowClosed { + total = int(openCount) + } else { + total = int(closedCount) + } + ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5) + + miles, err := models.Milestones(ctx.Repo.Repository.Id, page, isShowClosed) if err != nil { ctx.Handle(500, "GetMilestones", err) return @@ -981,10 +999,6 @@ func Milestones(ctx *middleware.Context) { } ctx.Data["Milestones"] = miles - openCount, closedCount := models.MilestoneStats(ctx.Repo.Repository.Id) - ctx.Data["OpenCount"] = openCount - ctx.Data["ClosedCount"] = closedCount - if isShowClosed { ctx.Data["State"] = "closed" } else { @@ -1024,7 +1038,7 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { } mile := &models.Milestone{ - RepoId: ctx.Repo.Repository.Id, + RepoID: ctx.Repo.Repository.Id, Index: int64(ctx.Repo.Repository.NumMilestones) + 1, Name: form.Title, Content: form.Content, @@ -1038,14 +1052,17 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { ctx.Redirect(ctx.Repo.RepoLink + "/milestones") } -func UpdateMilestone(ctx *middleware.Context) { +func EditMilestone(ctx *middleware.Context) {} +func EditMilestonePost(ctx *middleware.Context) {} + +func MilestoneActions(ctx *middleware.Context) { ctx.Data["Title"] = "Update Milestone" ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = true idx := ctx.ParamsInt64(":index") if idx == 0 { - ctx.Handle(404, "issue.UpdateMilestone", nil) + ctx.Handle(404, "get milestone index", nil) return } @@ -1165,7 +1182,3 @@ func IssueGetAttachment(ctx *middleware.Context) { func PullRequest2(ctx *middleware.Context) { ctx.HTML(200, "repo/pr2/list") } - -func Milestones2(ctx *middleware.Context) { - ctx.HTML(200, "repo/milestone2/list") -} diff --git a/templates/.VERSION b/templates/.VERSION index c03ca0c8a5..a143c67694 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.6.3.0803 Beta \ No newline at end of file +0.6.3.0804 Beta \ No newline at end of file diff --git a/templates/repo/issue/create.tmpl b/templates/repo/issue/create.tmpl index de0c47ac20..f38c57d0d5 100644 --- a/templates/repo/issue/create.tmpl +++ b/templates/repo/issue/create.tmpl @@ -54,7 +54,7 @@ {{else}}