mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-15 22:42:43 +00:00
commithgraph / timeline (#428)
* Add model and tests for graph * Add route and router for graph * Add assets for graph * Add template for graph
This commit is contained in:
parent
35d9378e4e
commit
22e1bd31c6
10 changed files with 673 additions and 2 deletions
|
@ -18,6 +18,7 @@ import (
|
|||
|
||||
const (
|
||||
tplCommits base.TplName = "repo/commits"
|
||||
tplGraph base.TplName = "repo/graph"
|
||||
tplDiff base.TplName = "repo/diff/page"
|
||||
)
|
||||
|
||||
|
@ -75,6 +76,32 @@ func Commits(ctx *context.Context) {
|
|||
ctx.HTML(200, tplCommits)
|
||||
}
|
||||
|
||||
// Graph render commit graph - show commits from all branches.
|
||||
func Graph(ctx *context.Context) {
|
||||
ctx.Data["PageIsCommits"] = true
|
||||
|
||||
commitsCount, err := ctx.Repo.Commit.CommitsCount()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetCommitsCount", err)
|
||||
return
|
||||
}
|
||||
|
||||
graph, err := models.GetCommitGraph(ctx.Repo.GitRepo)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetCommitGraph", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Graph"] = graph
|
||||
ctx.Data["Username"] = ctx.Repo.Owner.Name
|
||||
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
|
||||
ctx.Data["CommitCount"] = commitsCount
|
||||
ctx.Data["Branch"] = ctx.Repo.BranchName
|
||||
ctx.Data["RequireGitGraph"] = true
|
||||
ctx.HTML(200, tplGraph)
|
||||
|
||||
}
|
||||
|
||||
// SearchCommits render commits filtered by keyword
|
||||
func SearchCommits(ctx *context.Context) {
|
||||
ctx.Data["PageIsCommits"] = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue