woodpecker/pkg/template/pages/repo_commit.html
Alex Suraci 2d837cc3db query and show commits by branch
This allows the same SHA to have different builds on different branches, each
separately viewable. This is useful for expressing a "pipeline" in terms of
branches, e.g. a commit starts on branch A and progress through B and C to
master, with the build script switching on branch name.

Previously viewing each build would arbitrarily choose which branch's commit
to show.
2014-03-14 12:13:34 -07:00

87 lines
2.7 KiB
HTML

{{ define "title" }}{{.Repo.Slug}} · {{ .Commit.HashShort }}{{ end }}
{{ define "content" }}
<div class="subhead">
<div class="container">
<ul class="nav nav-tabs pull-right">
<li class="active"><a href="/{{.Repo.Slug}}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}">{{ .Commit.HashShort }}</a></li>
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
<li><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
</ul> <!-- ./nav -->
<h1>
<span>{{.Repo.Name}}</span>
<small>{{.Repo.Owner}}</small>
</h1>
</div><!-- ./container -->
</div><!-- ./subhead -->
<div class="container">
<div class="alert alert-build-{{ .Build.Status }}">
<a href="/{{.Repo.Slug}}/{{.Commit.Branch}}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}" class="btn btn-{{ .Build.Status }}"></a>
{{ if .Commit.PullRequest }}
<span>opened pull request <span># {{ .Commit.PullRequest }}</span></span>
{{ else }}
<span>commit <span>{{ .Commit.HashShort }}</span> to <span>{{.Commit.Branch}}</span> branch</span>
{{ end }}
</div>
<div class="build-details container affix-top" data-spy="affix" data-offset-top="248">
<div class="build-summary">
<dt>Status</dt>
<dd>{{.Build.Status}}</dd>
<dt>Started</dt>
<dd><span class="timeago" title="{{ .Build.StartedString }}"></span></dd>
<dt>Duration</dt>
<dd>{{ if .Build.IsRunning }}--{{else}}{{ .Build.HumanDuration }}{{end}}</dd>
</div>
<img src="{{.Commit.Image}}">
<div class="commit-summary">
<dt>Commit</dt>
<dd><u>{{ .Commit.HashShort }}</u></dd>
<dt>Committer</dt>
<dd>{{ .Commit.Author }}</dd>
<dt>Message</dt>
<dd>{{ .Commit.Message }}</dd>
</div>
</div>
<pre id="stdout"></pre>
<span id="follow">Follow</span>
</div><!-- ./container -->
{{ end }}
{{ define "script" }}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
<script>
$(document).ready(function() {
$(".timeago").timeago();
});
</script>
<script>
{{ if .Build.IsRunning }}
$(document).ready(function() {
var commitUpdates = new Drone.CommitUpdates('/feed?token='+{{ .Token }});
var outputBox = document.getElementById('stdout');
commitUpdates.startOutput(outputBox);
$("#follow").on("click", function(e) {
e.preventDefault();
if(commitUpdates.autoFollow) {
commitUpdates.autoFollow = false;
$(this).text("Follow");
} else {
commitUpdates.autoFollow = true;
$(this).text("Stop following");
}
});
});
{{ else }}
$.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Branch }}/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt", function( data ) {
var lineFormatter = new Drone.LineFormatter();
$( "#stdout" ).html(lineFormatter.format(data));
});
{{ end }}
</script>
{{ end }}