@@ -65,7 +65,6 @@ const (
6565 tplRepoHome base.TplName = "repo/home"
6666 tplRepoViewList base.TplName = "repo/view_list"
6767 tplWatchers base.TplName = "repo/watchers"
68- tplCards base.TplName = "repo/user_cards"
6968 tplForks base.TplName = "repo/forks"
7069 tplMigrating base.TplName = "repo/migrate/migrating"
7170)
@@ -1102,17 +1101,15 @@ func checkOutdatedBranch(ctx *context.Context) {
11021101}
11031102
11041103// RenderUserCards render a page show users according the input template
1105- func RenderUserCards (ctx * context.Context , pageType string , total int , getter func (goctx gocontext.Context , repoID int64 , opts db.ListOptions ) ([]* user_model.User , error ), tpl base.TplName ) {
1106- ctx .Data ["Title" ] = ctx .Tr (pageType )
1107- ctx .Data ["CardsTitle" ] = ctx .Tr (pageType )
1104+ func RenderUserCards (ctx * context.Context , total int , getter func (opts db.ListOptions ) ([]* user_model.User , error ), tpl base.TplName ) {
11081105 page := ctx .FormInt ("page" )
11091106 if page <= 0 {
11101107 page = 1
11111108 }
11121109 pager := context .NewPagination (total , setting .ItemsPerPage , page , 5 )
11131110 ctx .Data ["Page" ] = pager
11141111
1115- items , err := getter (ctx , ctx . Repo . Repository . ID , db.ListOptions {
1112+ items , err := getter (db.ListOptions {
11161113 Page : pager .Paginater .Current (),
11171114 PageSize : setting .ItemsPerPage ,
11181115 })
@@ -1127,22 +1124,23 @@ func RenderUserCards(ctx *context.Context, pageType string, total int, getter fu
11271124
11281125// Watchers render repository's watch users
11291126func Watchers (ctx * context.Context ) {
1130- RenderUserCards (ctx , "repo.watchers" , ctx .Repo .Repository .NumWatches , repo_model .GetRepoWatchers , tplWatchers )
1131- }
1127+ ctx .Data ["Title" ] = ctx .Tr ("repo.watchers" )
1128+ ctx .Data ["CardsTitle" ] = ctx .Tr ("repo.watchers" )
1129+ ctx .Data ["PageIsWatchers" ] = true
11321130
1133- // WatchersCards renders a repository's watchers user cards
1134- func WatchersCards (ctx * context. Context ) {
1135- RenderUserCards ( ctx , "repo.watchers" , ctx . Repo . Repository . NumWatches , repo_model . GetRepoWatchers , tplCards )
1131+ RenderUserCards ( ctx , ctx . Repo . Repository . NumWatches , func ( opts db. ListOptions ) ([] * user_model. User , error ) {
1132+ return repo_model . GetRepoWatchers (ctx , ctx . Repo . Repository . ID , opts )
1133+ }, tplWatchers )
11361134}
11371135
11381136// Stars render repository's starred users
11391137func Stars (ctx * context.Context ) {
1140- RenderUserCards ( ctx , "repo.stargazers" , ctx .Repo . Repository . NumStars , repo_model . GetStargazers , tplWatchers )
1141- }
1142-
1143- // StarsCards renders a repository's stargazers user cards
1144- func StarsCards (ctx * context. Context ) {
1145- RenderUserCards ( ctx , "repo.stargazers" , ctx . Repo . Repository . NumStars , repo_model . GetStargazers , tplCards )
1138+ ctx . Data [ "Title" ] = ctx .Tr ( "repo.stargazers" )
1139+ ctx . Data [ "CardsTitle" ] = ctx . Tr ( "repo.stargazers" )
1140+ ctx . Data [ "PageIsStargazers" ] = true
1141+ RenderUserCards ( ctx , ctx . Repo . Repository . NumStars , func ( opts db. ListOptions ) ([] * user_model. User , error ) {
1142+ return repo_model . GetStargazers (ctx , ctx . Repo . Repository , opts )
1143+ }, tplWatchers )
11461144}
11471145
11481146// Forks render repository's forked users
0 commit comments