github.com/unclejack/drone@v0.2.1-0.20140918182345-831b034aa33b/pkg/template/pages/repo_commit.html (about)

     1  {{ define "title" }}{{.Repo.Slug}} ยท {{ .Commit.HashShort }}{{ end }}
     2  
     3  {{ define "content" }}
     4  
     5  	<div class="subhead">
     6  		<div class="container">
     7  			<ul class="nav nav-tabs pull-right">
     8  				<li class="active"><a href="/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}?branch={{ .Commit.Branch }}">{{ .Commit.HashShort }}</a></li>
     9  				<li><a href="/{{.Repo.Slug}}">Commits</a></li>
    10  				<li><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
    11  			</ul> <!-- ./nav -->
    12  			<h1>
    13  				<span>{{.Repo.Name}}</span>
    14  				<small>{{.Repo.Owner}}</small>
    15  			</h1>
    16  		</div><!-- ./container -->
    17  	</div><!-- ./subhead -->
    18  
    19  	<div class="container">
    20  		<div class="alert alert-build-{{ .Build.Status }}">
    21  			<a href="/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}?branch={{ .Commit.Branch }}" class="btn btn-{{ .Build.Status }}"></a>
    22  			{{ if .Commit.PullRequest }}
    23  			<span>opened pull request <span># {{ .Commit.PullRequest }}</span></span>
    24  			{{ else }}
    25  			<span>commit <span>{{ .Commit.HashShort }}</span> to <span>{{.Commit.Branch}}</span> branch</span>
    26  			{{ end }}
    27  
    28        <div class="actions">
    29  				{{ if .IsAdmin }}
    30  					{{ if not .Build.IsRunning }}
    31  					<form action="/{{.Repo.Slug}}/commit/{{.Commit.Hash}}/rebuild?branch={{ .Commit.Branch }}"
    32  								method="POST">
    33  						<input class="btn btn-default" type="submit" value="Rebuild"/>
    34  					</form>
    35  					{{	end	 }}
    36  				{{ end }}
    37  			</div>
    38  
    39  		</div>
    40  		<div class="build-details container affix-top" data-spy="affix" data-offset-top="248">
    41  			<div class="build-summary">
    42  				<dt>Status</dt>
    43  				<dd>{{.Build.Status}}</dd>
    44  				<dt>Started</dt>
    45  				<dd><span class="timeago" title="{{ .Build.StartedString }}"></span></dd>
    46  				<dt>Duration</dt>
    47  				<dd>{{ if .Build.IsRunning }}--{{else}}{{ .Build.HumanDuration }}{{end}}</dd>
    48  			</div>
    49  			<img src="{{.Commit.Image}}">
    50  			<div class="commit-summary">
    51  				<dt>Commit</dt>
    52  				<dd><u>{{ .Commit.HashShort }}</u></dd>
    53  				<dt>Committer</dt>
    54  				<dd>{{ .Commit.Author }}</dd>
    55  				<dt>Message</dt>
    56  				<dd>{{ .Commit.Message }}</dd>
    57  			</div>
    58  		</div>
    59  		<pre id="stdout"></pre>
    60  		<span id="follow">Follow</span>
    61  	</div><!-- ./container -->
    62  {{ end }}
    63  
    64  {{ define "script" }}
    65  	<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
    66  	<script>
    67  		$(document).ready(function() {
    68  			$(".timeago").timeago();
    69  		});
    70  	</script>
    71  
    72  	<script>
    73  	{{ if .Build.IsRunning }}
    74  		$(document).ready(function() {
    75  			var commitUpdates = new Drone.CommitUpdates('/feed?token='+{{ .Token }});
    76  			var outputBox = document.getElementById('stdout');
    77  			commitUpdates.startOutput(outputBox);
    78  
    79  			$("#follow").on("click", function(e) {
    80  				e.preventDefault();
    81  
    82  				if(commitUpdates.autoFollow) {
    83  					commitUpdates.autoFollow = false;
    84  					$(this).text("Follow");
    85  				} else {
    86  					commitUpdates.autoFollow = true;
    87  					$(this).text("Stop following");
    88  				}
    89  			});
    90  		});
    91  
    92  	{{ else }}
    93  		$.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt?branch={{ .Commit.Branch }}", function( data ) {
    94  			var lineFormatter = new Drone.LineFormatter();
    95  			$( "#stdout" ).html(lineFormatter.format(data));
    96  		});
    97  	{{ end }}
    98  	</script>
    99  {{ end }}