diff options
author | Christopher Brickley <brickley@gmail.com> | 2014-08-26 08:20:18 -0400 |
---|---|---|
committer | Christopher Brickley <brickley@gmail.com> | 2014-09-01 14:56:19 -0400 |
commit | 00a864e693434bce687f3f5145d8369583197b78 (patch) | |
tree | df25bf583ec2a0070c159bcb3d0d161d931f6801 /templates | |
parent | d55c5b9e289c0c97aa51ffe5cb5b77f703cc2a47 (diff) | |
download | gitea-00a864e693434bce687f3f5145d8369583197b78.tar.gz gitea-00a864e693434bce687f3f5145d8369583197b78.zip |
add commit compare functionality
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/commits.tmpl | 43 | ||||
-rw-r--r-- | templates/repo/commits_table.tmpl | 42 | ||||
-rw-r--r-- | templates/repo/diff.tmpl | 15 |
3 files changed, 56 insertions, 44 deletions
diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 420e973a50..e7518e9835 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -3,47 +3,6 @@ {{template "repo/nav" .}} {{template "repo/toolbar" .}} <div id="body" class="container"> - <div id="commits"> - <div class="panel panel-default commit-box info-box"> - <div class="panel-heading info-head"> - <form class="search pull-right col-md-3" action="{{.RepoLink}}/commits/{{.BranchName}}/search" method="get" id="commits-search-form"> - <div class="input-group"> - <input class="form-control search" type="search" placeholder="search commit" name="q" value="{{.Keyword}}" /> - <div class="input-group-btn"> - <button type="submit" class="btn btn-default">Find</button> - </div> - </div> - </form> - <h4>{{.CommitCount}} Commits</h4> - </div> - <table class="panel-footer table commit-list table table-striped"> - <thead> - <tr> - <th class="author">Author</th> - <th class="sha">SHA1</th> - <th class="message">Message</th> - <th class="date">Date</th> - </tr> - </thead> - <tbody> - {{ $username := .Username}} - {{ $reponame := .Reponame}} - {{$r := List .Commits}} - {{range $r}} - <tr> - <td class="author"><img class="avatar" src="{{AvatarLink .Author.Email}}" alt=""/><a href="/user/email2user?email={{.Author.Email}}">{{.Author.Name}}</a></td> - <td class="sha"><a rel="nofollow" class="label label-success" href="/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td> - <td class="message">{{.Summary}} </td> - <td class="date">{{TimeSince .Author.When $.Lang}}</td> - </tr> - {{end}} - </tbody> - </table> - </div> - {{if not .IsSearchPage}}<ul class="pagination" id="commits-pager"> - {{if .LastPageNum}}<li><a href="{{.RepoLink}}/commits/{{.BranchName}}{{if .FileName}}/{{.FileName}}{{end}}?p={{.LastPageNum}}" rel="nofollow">« Newer</a></li>{{end}} - {{if .NextPageNum}}<li><a href="{{.RepoLink}}/commits/{{.BranchName}}{{if .FileName}}/{{.FileName}}{{end}}?p={{.NextPageNum}}" rel="nofollow">» Older</a></li>{{end}} - </ul>{{end}} - </div> + {{template "repo/commits_table" .}} </div> {{template "base/footer" .}} diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl new file mode 100644 index 0000000000..4612398a53 --- /dev/null +++ b/templates/repo/commits_table.tmpl @@ -0,0 +1,42 @@ +<div id="commits"> + <div class="panel panel-default commit-box info-box"> + <div class="panel-heading info-head"> + <form class="search pull-right col-md-3" action="{{.RepoLink}}/commits/{{.BranchName}}/search" method="get" id="commits-search-form"> + <div class="input-group"> + <input class="form-control search" type="search" placeholder="search commit" name="q" value="{{.Keyword}}" /> + <div class="input-group-btn"> + <button type="submit" class="btn btn-default">Find</button> + </div> + </div> + </form> + <h4>{{.CommitCount}} Commits</h4> + </div> + <table class="panel-footer table commit-list table table-striped"> + <thead> + <tr> + <th class="author">Author</th> + <th class="sha">SHA1</th> + <th class="message">Message</th> + <th class="date">Date</th> + </tr> + </thead> + <tbody> + {{ $username := .Username}} + {{ $reponame := .Reponame}} + {{$r := List .Commits}} + {{range $r}} + <tr> + <td class="author"><img class="avatar" src="{{AvatarLink .Author.Email}}" alt=""/><a href="/user/email2user?email={{.Author.Email}}">{{.Author.Name}}</a></td> + <td class="sha"><a rel="nofollow" class="label label-success" href="/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td> + <td class="message">{{.Summary}} </td> + <td class="date">{{TimeSince .Author.When $.Lang}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{if not .IsSearchPage}}<ul class="pagination" id="commits-pager"> + {{if .LastPageNum}}<li><a href="{{.RepoLink}}/commits/{{.BranchName}}{{if .FileName}}/{{.FileName}}{{end}}?p={{.LastPageNum}}" rel="nofollow">« Newer</a></li>{{end}} + {{if .NextPageNum}}<li><a href="{{.RepoLink}}/commits/{{.BranchName}}{{if .FileName}}/{{.FileName}}{{end}}?p={{.NextPageNum}}" rel="nofollow">» Older</a></li>{{end}} + </ul>{{end}} +</div> diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 6adea04593..7873345083 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -3,9 +3,20 @@ {{template "repo/nav" .}} <div id="body" class="container" data-page="repo"> <div id="source"> + {{if .IsDiffCompare }} <div class="panel panel-info diff-box diff-head-box"> <div class="panel-heading"> <a class="pull-right btn btn-primary btn-sm" rel="nofollow" href="{{.SourcePath}}">Browse Source</a> + <h4><a href="{{$.RepoLink}}/commit/{{.BeforeCommitId}}" class="label label-success">{{ShortSha .BeforeCommitId}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitId}}" class="label label-success">{{ShortSha .AfterCommitId}}</a></h4> + </div> + <div class="panel-body compare"> + {{template "repo/commits_table" .}} + </div> + </div> + {{else}} + <div class="panel panel-info diff-box diff-head-box"> + <div class="panel-heading"> + <a class="pull-right btn btn-primary btn-sm" rel="nofollow" href="{{.SourcePath}}">Browse Source</a> <h4>{{.Commit.Message}}</h4> </div> <div class="panel-body"> @@ -22,9 +33,9 @@ <a class="name" href="/user/email2user?email={{.Commit.Author.Email}}"><strong>{{.Commit.Author.Name}}</strong></a> <span class="time">{{TimeSince .Commit.Author.When $.Lang}}</span> </p> - </div> + </div> </div> - + {{end}} {{if .DiffNotAvailable}} <h4>Diff Data Not Available.</h4> {{else}} |