mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-12-23 08:49:55 +01:00
Transfer to URL with commit ID when select line(s).
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
</ol>
|
</ol>
|
||||||
<span>Older</span>
|
<span>Older</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="branchCtrlWrapper" style="display:inline;">
|
||||||
@gitbucket.core.helper.html.branchcontrol(
|
@gitbucket.core.helper.html.branchcontrol(
|
||||||
branch,
|
branch,
|
||||||
repository,
|
repository,
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
<li><a href="@helpers.url(repository)/blob/@helpers.encodeRefName(x)/@pathList.mkString("/")">@gitbucket.core.helper.html.checkicon(x == branch) @x</a></li>
|
<li><a href="@helpers.url(repository)/blob/@helpers.encodeRefName(x)/@pathList.mkString("/")">@gitbucket.core.helper.html.checkicon(x == branch) @x</a></li>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a> /
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)">@repository.name</a> /
|
||||||
@pathList.zipWithIndex.map { case (section, i) =>
|
@pathList.zipWithIndex.map { case (section, i) =>
|
||||||
@if(i == pathList.length - 1){
|
@if(i == pathList.length - 1){
|
||||||
@@ -130,14 +132,18 @@ $(window).load(function(){
|
|||||||
}
|
}
|
||||||
var line = pos[i].id.replace(/^L/,'');
|
var line = pos[i].id.replace(/^L/,'');
|
||||||
var hash = location.hash;
|
var hash = location.hash;
|
||||||
|
var commitUrl = '@helpers.url(repository)/blob/@latestCommit.id/@pathList.mkString("/")';
|
||||||
if(e.shiftKey == true && hash.match(/#L\d+(-L\d+)?/)){
|
if(e.shiftKey == true && hash.match(/#L\d+(-L\d+)?/)){
|
||||||
var lines = hash.split('-');
|
var lines = hash.split('-');
|
||||||
location.hash = lines[0] + '-L' + line;
|
window.history.pushState('', '', commitUrl + lines[0] + '-L' + line);
|
||||||
} else {
|
} else {
|
||||||
var p = $("#L"+line).attr('id',"");
|
var p = $("#L"+line).attr('id',"");
|
||||||
location.hash = '#L' + line;
|
window.history.pushState('', '', commitUrl + '#L' + line);
|
||||||
p.attr('id','L'+line);
|
p.attr('id','L'+line);
|
||||||
}
|
}
|
||||||
|
$("#branchCtrlWrapper .btn .muted").text("tree:");
|
||||||
|
$("#branchCtrlWrapper .btn .strong").text("@latestCommit.id.substring(0, 10)");
|
||||||
|
updateHighlighting();
|
||||||
}).appendTo(pre);
|
}).appendTo(pre);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user