parent
e06558e208
commit
9ab96172fc
File diff suppressed because one or more lines are too long
@ -1,44 +0,0 @@ |
|||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a MIT-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repo |
|
||||||
|
|
||||||
import ( |
|
||||||
"github.com/Unknwon/paginater" |
|
||||||
|
|
||||||
"github.com/gogits/gogs/models" |
|
||||||
"github.com/gogits/gogs/modules/base" |
|
||||||
"github.com/gogits/gogs/modules/middleware" |
|
||||||
) |
|
||||||
|
|
||||||
const ( |
|
||||||
STARS base.TplName = "repo/stars" |
|
||||||
) |
|
||||||
|
|
||||||
func Stars(ctx *middleware.Context) { |
|
||||||
ctx.Data["Title"] = ctx.Tr("repos.stars") |
|
||||||
|
|
||||||
page := ctx.QueryInt("page") |
|
||||||
if page <= 0 { |
|
||||||
page = 1 |
|
||||||
} |
|
||||||
|
|
||||||
ctx.Data["Page"] = paginater.New(ctx.Repo.Repository.NumStars, models.ItemsPerPage, page, 5) |
|
||||||
|
|
||||||
stars, err := ctx.Repo.Repository.GetStars(ctx.QueryInt("page")) |
|
||||||
|
|
||||||
if err != nil { |
|
||||||
ctx.Handle(500, "GetStars", err) |
|
||||||
return |
|
||||||
} |
|
||||||
|
|
||||||
if (ctx.QueryInt("page")-1)*models.ItemsPerPage > ctx.Repo.Repository.NumStars { |
|
||||||
ctx.Handle(404, "ctx.Repo.Repository.NumStars", nil) |
|
||||||
return |
|
||||||
} |
|
||||||
|
|
||||||
ctx.Data["Stars"] = stars |
|
||||||
|
|
||||||
ctx.HTML(200, STARS) |
|
||||||
} |
|
@ -1,44 +0,0 @@ |
|||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a MIT-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repo |
|
||||||
|
|
||||||
import ( |
|
||||||
"github.com/Unknwon/paginater" |
|
||||||
|
|
||||||
"github.com/gogits/gogs/models" |
|
||||||
"github.com/gogits/gogs/modules/base" |
|
||||||
"github.com/gogits/gogs/modules/middleware" |
|
||||||
) |
|
||||||
|
|
||||||
const ( |
|
||||||
WATCHERS base.TplName = "repo/watchers" |
|
||||||
) |
|
||||||
|
|
||||||
func Watchers(ctx *middleware.Context) { |
|
||||||
ctx.Data["Title"] = ctx.Tr("repos.watches") |
|
||||||
|
|
||||||
page := ctx.QueryInt("page") |
|
||||||
if page <= 0 { |
|
||||||
page = 1 |
|
||||||
} |
|
||||||
|
|
||||||
ctx.Data["Page"] = paginater.New(ctx.Repo.Repository.NumWatches, models.ItemsPerPage, page, 5) |
|
||||||
|
|
||||||
watchers, err := ctx.Repo.Repository.GetWatchers(ctx.QueryInt("page")) |
|
||||||
|
|
||||||
if err != nil { |
|
||||||
ctx.Handle(500, "GetWatchers", err) |
|
||||||
return |
|
||||||
} |
|
||||||
|
|
||||||
if (ctx.QueryInt("page")-1)*models.ItemsPerPage > ctx.Repo.Repository.NumWatches { |
|
||||||
ctx.Handle(404, "ctx.Repo.Repository.NumWatches", nil) |
|
||||||
return |
|
||||||
} |
|
||||||
|
|
||||||
ctx.Data["Watchers"] = watchers |
|
||||||
|
|
||||||
ctx.HTML(200, WATCHERS) |
|
||||||
} |
|
@ -1,27 +1,23 @@ |
|||||||
{{template "ng/base/head" .}} |
{{template "base/head" .}} |
||||||
{{template "ng/base/header" .}} |
<div class="repository forks"> |
||||||
<div id="repo-wrapper"> |
{{template "repo/header" .}} |
||||||
{{template "repo/header_old" .}} |
<div class="ui container"> |
||||||
<div id="repo-content" class="clear container"> |
{{template "repo/sidebar" .}} |
||||||
<div id="repo-main" class="left grid-5-6"> |
<h2 class="ui dividing header"> |
||||||
<div id="forks"> |
{{.i18n.Tr "repo.forks"}} |
||||||
<h4> |
</h2> |
||||||
<strong>{{.i18n.Tr "repos.forks"}}</strong> |
<div class="ui list"> |
||||||
</h4> |
{{range .Forks}} |
||||||
|
<div class="item"> |
||||||
<ol> |
<img class="ui avatar image" src="{{.Owner.AvatarLink}}"> |
||||||
{{range .Forks}} |
<div class="link"> |
||||||
<p> |
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a> |
||||||
<img class="avatar-small" src="{{.Owner.AvatarLink}}"> |
/ |
||||||
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a> |
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a> |
||||||
/ |
</div> |
||||||
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a> |
|
||||||
</p> |
|
||||||
{{end}} |
|
||||||
</div> |
|
||||||
</div> |
</div> |
||||||
|
{{end}} |
||||||
{{template "repo/sidebar" .}} |
|
||||||
</div> |
</div> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
{{template "ng/base/footer" .}} |
{{template "base/footer" .}} |
||||||
|
@ -1,61 +0,0 @@ |
|||||||
{{template "ng/base/head" .}} |
|
||||||
{{template "ng/base/header" .}} |
|
||||||
<div id="repo-wrapper"> |
|
||||||
{{template "repo/header_old" .}} |
|
||||||
<div id="repo-content" class="clear container"> |
|
||||||
<div id="repo-main" class="left grid-5-6"> |
|
||||||
<div id="stars"> |
|
||||||
<h4> |
|
||||||
<strong>{{.i18n.Tr "repos.stars"}}</strong> |
|
||||||
</h4> |
|
||||||
|
|
||||||
<ol> |
|
||||||
{{range .Stars}} |
|
||||||
<li> |
|
||||||
<a href="{{AppSubUrl}}/{{.Name}}"> |
|
||||||
<img class="avatar" src="{{.AvatarLink}}" title="{{.Name}}"/> |
|
||||||
|
|
||||||
<h3>{{.Name}}</h3> |
|
||||||
</a> |
|
||||||
|
|
||||||
<p> |
|
||||||
{{if .Website}} |
|
||||||
<span class="octicon octicon-link"></span> <a href="{{.Website}}" target="_blank">{{.Website}}</a> |
|
||||||
{{else if .Location}} |
|
||||||
<span class="octicon octicon-location"></span> {{.Location}} |
|
||||||
{{else}} |
|
||||||
<span class="octicon octicon-clock"></span> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}} |
|
||||||
{{end}} |
|
||||||
</p> |
|
||||||
</li> |
|
||||||
{{end}} |
|
||||||
</ol> |
|
||||||
|
|
||||||
{{with .Page}} |
|
||||||
{{if gt .TotalPages 1}} |
|
||||||
<div class="pagination"> |
|
||||||
{{if .HasPrevious}} |
|
||||||
<a href="{{$.RepoLink}}/stars?page={{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a> |
|
||||||
{{end}} |
|
||||||
|
|
||||||
{{range .Pages}} |
|
||||||
{{if eq .Num -1}} |
|
||||||
<a class="disabled item">...</a> |
|
||||||
{{else}} |
|
||||||
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/stars?page={{.Num}}"{{end}}>{{.Num}}</a> |
|
||||||
{{end}} |
|
||||||
{{end}} |
|
||||||
|
|
||||||
{{if .HasNext}} |
|
||||||
<a href="{{$.RepoLink}}/stars?page={{.Next}}">{{$.i18n.Tr "issues.next"}}</a> |
|
||||||
{{end}} |
|
||||||
</div> |
|
||||||
{{end}} |
|
||||||
{{end}} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
{{template "repo/sidebar" .}} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
{{template "ng/base/footer" .}} |
|
@ -1,61 +1,57 @@ |
|||||||
{{template "ng/base/head" .}} |
{{template "base/head" .}} |
||||||
{{template "ng/base/header" .}} |
<div class="repository watchers"> |
||||||
<div id="repo-wrapper"> |
{{template "repo/header" .}} |
||||||
{{template "repo/header_old" .}} |
<div class="ui container"> |
||||||
<div id="repo-content" class="clear container"> |
{{template "repo/sidebar" .}} |
||||||
<div id="repo-main" class="left grid-5-6"> |
<h2 class="ui dividing header"> |
||||||
<div id="stars"> |
{{if .PageIsWatchers}} |
||||||
<h4> |
{{.i18n.Tr "repo.watchers"}} |
||||||
<strong>{{.i18n.Tr "repos.watches"}}</strong> |
{{else}} |
||||||
</h4> |
{{.i18n.Tr "repo.stargazers"}} |
||||||
|
{{end}} |
||||||
|
</h2> |
||||||
|
<ul class="list"> |
||||||
|
{{range .Watchers}} |
||||||
|
<li class="item ui segment"> |
||||||
|
<a href="{{.HomeLink}}"> |
||||||
|
<img class="avatar" src="{{.AvatarLink}}"/> |
||||||
|
</a> |
||||||
|
<h3 class="name"><a href="{{.HomeLink}}">{{.DisplayName}}</a></h3> |
||||||
|
|
||||||
<ol> |
<div class="meta"> |
||||||
{{range .Watchers}} |
{{if .Website}} |
||||||
<li> |
<span class="icon octicon octicon-link"></span> <a href="{{.Website}}" target="_blank">{{.Website}}</a> |
||||||
<a href="{{AppSubUrl}}/{{.Name}}"> |
{{else if .Location}} |
||||||
<img class="avatar" src="{{.AvatarLink}}" title="{{.Name}}"/> |
<span class="icon octicon octicon-location"></span> {{.Location}} |
||||||
|
{{else}} |
||||||
<h3>{{.Name}}</h3> |
<span class="icon octicon octicon-clock"></span> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}} |
||||||
</a> |
{{end}} |
||||||
|
|
||||||
<p> |
|
||||||
{{if .Website}} |
|
||||||
<span class="octicon octicon-link"></span> <a href="{{.Website}}" target="_blank">{{.Website}}</a> |
|
||||||
{{else if .Location}} |
|
||||||
<span class="octicon octicon-location"></span> {{.Location}} |
|
||||||
{{else}} |
|
||||||
<span class="octicon octicon-clock"></span> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}} |
|
||||||
{{end}} |
|
||||||
</p> |
|
||||||
</li> |
|
||||||
{{end}} |
|
||||||
</ol> |
|
||||||
|
|
||||||
{{with .Page}} |
|
||||||
{{if gt .TotalPages 1}} |
|
||||||
<div class="pagination"> |
|
||||||
{{if .HasPrevious}} |
|
||||||
<a href="{{$.RepoLink}}/watchers?page={{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a> |
|
||||||
{{end}} |
|
||||||
|
|
||||||
{{range .Pages}} |
|
||||||
{{if eq .Num -1}} |
|
||||||
<a class="disabled item">...</a> |
|
||||||
{{else}} |
|
||||||
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/watchers?page={{.Num}}"{{end}}>{{.Num}}</a> |
|
||||||
{{end}} |
|
||||||
{{end}} |
|
||||||
|
|
||||||
{{if .HasNext}} |
|
||||||
<a href="{{$.RepoLink}}/watchers?page={{.Next}}">{{$.i18n.Tr "issues.next"}}</a> |
|
||||||
{{end}} |
|
||||||
</div> |
|
||||||
{{end}} |
|
||||||
{{end}} |
|
||||||
</div> |
|
||||||
</div> |
</div> |
||||||
|
</li> |
||||||
{{template "repo/sidebar" .}} |
{{end}} |
||||||
|
</ul> |
||||||
|
|
||||||
|
{{with .Page}} |
||||||
|
{{if gt .TotalPages 1}} |
||||||
|
<div class="center page buttons"> |
||||||
|
<div class="ui borderless pagination menu"> |
||||||
|
<a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.Link}}?page={{.Previous}}"{{end}}> |
||||||
|
<i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}} |
||||||
|
</a> |
||||||
|
{{range .Pages}} |
||||||
|
{{if eq .Num -1}} |
||||||
|
<a class="disabled item">...</a> |
||||||
|
{{else}} |
||||||
|
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.Link}}?page={{.Num}}"{{end}}>{{.Num}}</a> |
||||||
|
{{end}} |
||||||
|
{{end}} |
||||||
|
<a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.Link}}?page={{.Next}}"{{end}}> |
||||||
|
{{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i> |
||||||
|
</a> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
|
{{end}} |
||||||
|
{{end}} |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
{{template "ng/base/footer" .}} |
{{template "base/footer" .}} |
Loading…
Reference in new issue