@(branch: String,
repository: service.RepositoryService.RepositoryInfo,
pathList: List[String],
content: util.JGitUtil.ContentInfo,
latestCommit: util.JGitUtil.CommitInfo,
settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
@import context._
@import view.helpers._
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
@html.header("code", repository)
@tab(branch, repository, "files", settings)
<div class="head">
<a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> /
@pathList.zipWithIndex.map { case (section, i) =>
@if(i == pathList.length - 1){
@section
} else {
<a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
}
}
</div>
<table class="table table-bordered">
<tr>
<th style="font-weight: normal;">
<div class="pull-left">
@avatar(latestCommit, 20)
@user(latestCommit.committer, latestCommit.mailAddress, "username strong")
<span class="muted">@datetime(latestCommit.time)</span>
<a href="@url(repository)/commit/@latestCommit.id" class="commit-message">@link(latestCommit.summary, repository)</a>
</div>
<div class="btn-group pull-right">
<a class="btn btn-mini" href="?raw=true">Raw</a>
<a class="btn btn-mini" href="@url(repository)/commits/@encodeRefName(branch)/@pathList.mkString("/")">History</a>
</div>
</th>
</tr>
<tr>
<td>
@if(content.viewType == "text"){
<pre class="prettyprint linenums blob">@content.content.get</pre>
}
@if(content.viewType == "image"){
<img src="?raw=true"/>
}
@if(content.viewType == "large" || content.viewType == "binary"){
<div style="text-align: center">
<a href="?raw=true">View Raw</a><br>
(Sorry about that, but we can't show files that are this big right now)
</div>
}
</td>
</tr>
</table>
}
<script src="@assets/common/js/jquery.ba-hashchange.js"></script>
<script>
$(window).load(function(){
$(window).hashchange(function(){
updateHighlighting();
}).hashchange();
});
/**
* Hightlight lines which are specified by URL hash.
*/
function updateHighlighting(){
var hash = location.hash;
if(hash.match(/#L\d+(-L\d+)?/)){
$('li.highlight').removeClass('highlight');
var lines = hash.substr(1).split('-');
if(lines.length == 1){
$('#' + lines[0]).addClass('highlight');
$(window).scrollTop($('#' + lines[0]).offset().top - 40);
} else if(lines.length > 1){
var start = parseInt(lines[0].substr(1));
var end = parseInt(lines[1].substr(1));
for(var i = start; i <= end; i++){
$('#L' + i).addClass('highlight');
}
$(window).scrollTop($('#L' + start).offset().top - 40);
}
}
}
</script>