mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
Merge pull request #1741 from gitbucket/encode-url-path
Encode file paths in URL
This commit is contained in:
@@ -7,11 +7,11 @@
|
|||||||
isBlame: Boolean,
|
isBlame: Boolean,
|
||||||
isLfsFile: Boolean)(implicit context: gitbucket.core.controller.Context)
|
isLfsFile: Boolean)(implicit context: gitbucket.core.controller.Context)
|
||||||
@import gitbucket.core.view.helpers
|
@import gitbucket.core.view.helpers
|
||||||
@gitbucket.core.html.main(s"${(repository.name :: pathList).mkString("/")} at ${helpers.encodeRefName(branch)} - ${repository.owner}/${repository.name}", Some(repository)) {
|
@gitbucket.core.html.main(s"${(repository.name :: pathList).mkString("/")} at ${branch} - ${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
@gitbucket.core.html.menu("files", repository){
|
@gitbucket.core.html.menu("files", repository){
|
||||||
<div class="head">
|
<div class="head">
|
||||||
<div class="pull-right hide-if-blame"><div class="btn-group">
|
<div class="pull-right hide-if-blame"><div class="btn-group">
|
||||||
<a href="@helpers.url(repository)/blob/@latestCommit.id/@pathList.mkString("/")" data-hotkey="y" style="display: none;">Transfer to URL with SHA</a>
|
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName((latestCommit.id :: pathList).mkString("/"))" data-hotkey="y" style="display: none;">Transfer to URL with SHA</a>
|
||||||
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t">Find file</a>
|
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t">Find file</a>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div class="line-age-legend">
|
<div class="line-age-legend">
|
||||||
@@ -31,13 +31,9 @@
|
|||||||
<span>Older</span>
|
<span>Older</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="branchCtrlWrapper" style="display:inline;">
|
<div id="branchCtrlWrapper" style="display:inline;">
|
||||||
@gitbucket.core.helper.html.branchcontrol(
|
@gitbucket.core.helper.html.branchcontrol(branch, repository, hasWritePermission){
|
||||||
branch,
|
|
||||||
repository,
|
|
||||||
hasWritePermission
|
|
||||||
){
|
|
||||||
@repository.branchList.map { x =>
|
@repository.branchList.map { x =>
|
||||||
<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>
|
</div>
|
||||||
@@ -46,7 +42,7 @@
|
|||||||
@if(i == pathList.length - 1){
|
@if(i == pathList.length - 1){
|
||||||
@section
|
@section
|
||||||
} else {
|
} else {
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName((branch :: pathList.take(i + 1)).mkString("/"))">@section</a> /
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if(isLfsFile){
|
@if(isLfsFile){
|
||||||
@@ -61,15 +57,16 @@
|
|||||||
<a href="@helpers.url(repository)/commit/@latestCommit.id" class="commit-message">@helpers.link(latestCommit.summary, repository)</a>
|
<a href="@helpers.url(repository)/commit/@latestCommit.id" class="commit-message">@helpers.link(latestCommit.summary, repository)</a>
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){
|
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){
|
||||||
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/edit/@helpers.encodeRefName(branch)/@pathList.mkString("/")">Edit</a>
|
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/edit/@helpers.encodeRefName((branch :: pathList).mkString("/"))">Edit</a>
|
||||||
}
|
}
|
||||||
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/raw/@latestCommit.id/@pathList.mkString("/")">Raw</a>
|
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/raw/@latestCommit.id/@helpers.encodeRefName(pathList.mkString("/"))">Raw</a>
|
||||||
@if(content.viewType == "text"){
|
@if(content.viewType == "text"){
|
||||||
<a class="btn btn-sm btn-default blame-action" href="@helpers.url(repository)/blame/@latestCommit.id/@pathList.mkString("/")" data-url="@helpers.url(repository)/get-blame/@latestCommit.id/@pathList.mkString("/")" data-repository="@helpers.url(repository)">Blame</a>
|
<a class="btn btn-sm btn-default blame-action" href="@helpers.url(repository)/blame/@latestCommit.id/@helpers.encodeRefName(pathList.mkString("/"))"
|
||||||
|
data-url="@helpers.url(repository)/get-blame/@helpers.encodeRefName((latestCommit.id :: pathList).mkString("/"))" data-repository="@helpers.url(repository)">Blame</a>
|
||||||
}
|
}
|
||||||
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/commits/@helpers.encodeRefName(branch)/@pathList.mkString("/")">History</a>
|
<a class="btn btn-sm btn-default" href="@helpers.url(repository)/commits/@helpers.encodeRefName((branch :: pathList).mkString("/"))">History</a>
|
||||||
@if(hasWritePermission && repository.branchList.contains(branch)){
|
@if(hasWritePermission && repository.branchList.contains(branch)){
|
||||||
<a class="btn btn-sm btn-danger" href="@helpers.url(repository)/remove/@helpers.encodeRefName(branch)/@pathList.mkString("/")">Delete</a>
|
<a class="btn btn-sm btn-danger" href="@helpers.url(repository)/remove/@helpers.encodeRefName((branch :: pathList).mkString("/"))">Delete</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -88,12 +85,12 @@
|
|||||||
}
|
}
|
||||||
@if(content.viewType == "image"){
|
@if(content.viewType == "image"){
|
||||||
<div class="box-content-bottom">
|
<div class="box-content-bottom">
|
||||||
<img src="@helpers.url(repository)/raw/@helpers.encodeRefName(branch)/@pathList.mkString("/")"/>
|
<img src="@helpers.url(repository)/raw/@helpers.encodeRefName((branch :: pathList).mkString("/"))"/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if(content.viewType == "large" || content.viewType == "binary"){
|
@if(content.viewType == "large" || content.viewType == "binary"){
|
||||||
<div class="box-content-bottom" style="text-align: center; padding-top: 20px; padding-bottom: 20px;">
|
<div class="box-content-bottom" style="text-align: center; padding-top: 20px; padding-bottom: 20px;">
|
||||||
<a href="@helpers.url(repository)/raw/@helpers.encodeRefName(branch)/@pathList.mkString("/")">View Raw</a><br>
|
<a href="@helpers.url(repository)/raw/@helpers.encodeRefName((branch :: pathList).mkString("/"))">View Raw</a><br>
|
||||||
<br>
|
<br>
|
||||||
(Sorry about that, but we can't show files that are this big right now)
|
(Sorry about that, but we can't show files that are this big right now)
|
||||||
</div>
|
</div>
|
||||||
@@ -133,7 +130,7 @@ $(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("/")';
|
var commitUrl = '@helpers.url(repository)/blob/@helpers.encodeRefName((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('-');
|
||||||
window.history.pushState('', '', commitUrl + lines[0] + '-L' + line);
|
window.history.pushState('', '', commitUrl + lines[0] + '-L' + line);
|
||||||
@@ -170,7 +167,7 @@ $(window).load(function(){
|
|||||||
updateSourceLineNum();
|
updateSourceLineNum();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(document.body).toggleClass('no-box-shadow', document.body.style.boxShadow===undefined);
|
$(document.body).toggleClass('no-box-shadow', document.body.style.boxShadow === undefined);
|
||||||
$('.blame-action').addClass("active");
|
$('.blame-action').addClass("active");
|
||||||
var base = $('<div class="blame">').css({height: pre.height()}).prependTo(pre.parents("div.box-content-bottom"));
|
var base = $('<div class="blame">').css({height: pre.height()}).prependTo(pre.parents("div.box-content-bottom"));
|
||||||
base.parent().addClass("blame-container");
|
base.parent().addClass("blame-container");
|
||||||
|
|||||||
@@ -12,11 +12,7 @@
|
|||||||
@gitbucket.core.html.menu("files", repository){
|
@gitbucket.core.html.menu("files", repository){
|
||||||
<div class="head">
|
<div class="head">
|
||||||
@if(pathList.isEmpty){
|
@if(pathList.isEmpty){
|
||||||
@gitbucket.core.helper.html.branchcontrol(
|
@gitbucket.core.helper.html.branchcontrol(branch, repository, hasWritePermission){
|
||||||
branch,
|
|
||||||
repository,
|
|
||||||
hasWritePermission
|
|
||||||
){
|
|
||||||
@repository.branchList.map { x =>
|
@repository.branchList.map { x =>
|
||||||
<li><a href="@helpers.url(repository)/commits/@helpers.encodeRefName(x)">@gitbucket.core.helper.html.checkicon(x == branch) @x</a></li>
|
<li><a href="@helpers.url(repository)/commits/@helpers.encodeRefName(x)">@gitbucket.core.helper.html.checkicon(x == branch) @x</a></li>
|
||||||
}
|
}
|
||||||
@@ -29,7 +25,7 @@
|
|||||||
@if(i == pathList.length - 1){
|
@if(i == pathList.length - 1){
|
||||||
<span class="strong">@section</span>
|
<span class="strong">@section</span>
|
||||||
} else {
|
} else {
|
||||||
<a class="strong" href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a class="strong" href="@helpers.url(repository)/tree/@helpers.encodeRefName((branch :: pathList.take(i + 1)).mkString("/"))">@section</a> /
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<div class="head">
|
<div class="head">
|
||||||
<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) =>
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName((branch :: pathList.take(i + 1)).mkString("/"))">@section</a> /
|
||||||
}
|
}
|
||||||
@fileName
|
@fileName
|
||||||
<input type="hidden" name="fileName" id="fileName" value="@fileName"/>
|
<input type="hidden" name="fileName" id="fileName" value="@fileName"/>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<th style="font-weight: normal;" class="box-header">
|
<th style="font-weight: normal;" class="box-header">
|
||||||
<span class="monospace">@fileName</span>
|
<span class="monospace">@fileName</span>
|
||||||
<div class="pull-right align-right">
|
<div class="pull-right align-right">
|
||||||
<a href="@helpers.url(repository)/blob/@branch/@{(pathList ::: List(fileName)).mkString("/")}" class="btn btn-default btn-sm">View</a>
|
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName((branch :: pathList ::: List(fileName)).mkString("/"))" class="btn btn-default btn-sm">View</a>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<input type="text" name="message" class="form-control"/>
|
<input type="text" name="message" class="form-control"/>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-danger">Cancel</a>
|
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName((branch :: pathList).mkString("/"))" class="btn btn-danger">Cancel</a>
|
||||||
<input type="submit" id="commitButton" class="btn btn-success" value="Commit changes"/>
|
<input type="submit" id="commitButton" class="btn btn-success" value="Commit changes"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="head">
|
<div class="head">
|
||||||
<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) =>
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName((branch :: pathList.take(i + 1)).mkString("/"))">@section</a> /
|
||||||
}
|
}
|
||||||
<input type="text" name="newFileName" id="newFileName" class="form-control" placeholder="Name your file..." value="@fileName"/>
|
<input type="text" name="newFileName" id="newFileName" class="form-control" placeholder="Name your file..." value="@fileName"/>
|
||||||
<input type="hidden" name="oldFileName" id="oldFileName" value="@fileName"/>
|
<input type="hidden" name="oldFileName" id="oldFileName" value="@fileName"/>
|
||||||
@@ -58,9 +58,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
@if(fileName.isEmpty){
|
@if(fileName.isEmpty){
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@{pathList.mkString("/")}" class="btn btn-danger">Cancel</a>
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName((branch :: pathList).mkString("/"))" class="btn btn-danger">Cancel</a>
|
||||||
} else {
|
} else {
|
||||||
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName(branch)/@{(pathList ++ Seq(fileName.get)).mkString("/")}" class="btn btn-danger">Cancel</a>
|
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName((branch :: pathList ++ Seq(fileName.get)).mkString("/"))" class="btn btn-danger">Cancel</a>
|
||||||
}
|
}
|
||||||
<input type="submit" id="commitButton" class="btn btn-success" value="Commit changes" disabled="true"/>
|
<input type="submit" id="commitButton" class="btn btn-success" value="Commit changes" disabled="true"/>
|
||||||
<input type="hidden" id="charset" name="charset" value="@content.charset"/>
|
<input type="hidden" id="charset" name="charset" value="@content.charset"/>
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
if(branch == repository.repository.defaultBranch){
|
if(branch == repository.repository.defaultBranch){
|
||||||
s"${repository.owner}/${repository.name}"
|
s"${repository.owner}/${repository.name}"
|
||||||
} else {
|
} else {
|
||||||
s"${repository.owner}/${repository.name} at ${helpers.encodeRefName(branch)}"
|
s"${repository.owner}/${repository.name} at ${branch}"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s"${(repository.name :: pathList).mkString("/")} at ${helpers.encodeRefName(branch)} - ${repository.owner}/${repository.name}"
|
s"${(repository.name :: pathList).mkString("/")} at ${branch} - ${repository.owner}/${repository.name}"
|
||||||
}, Some(repository)) {
|
}, Some(repository)) {
|
||||||
@gitbucket.core.html.menu("files", repository, Some(branch), info, error){
|
@gitbucket.core.html.menu("files", repository, Some(branch), info, error){
|
||||||
@if(pathList.isEmpty) {
|
@if(pathList.isEmpty) {
|
||||||
@@ -32,9 +32,9 @@
|
|||||||
<div class="head" style="height: 24px;">
|
<div class="head" style="height: 24px;">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="@helpers.url(repository)/tree/@latestCommit.id/@pathList.mkString("/")" data-hotkey="y" style="display: none;">Transfer to URL with SHA</a>
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName((latestCommit.id :: pathList).mkString("/"))" data-hotkey="y" style="display: none;">Transfer to URL with SHA</a>
|
||||||
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t"><i class="octicon octicon-search"></i></a>
|
<a href="@helpers.url(repository)/find/@helpers.encodeRefName(branch)" class="btn btn-sm btn-default" data-hotkey="t"><i class="octicon octicon-search"></i></a>
|
||||||
<a href="@helpers.url(repository)/commits/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default"><i class="octicon octicon-history"></i> @if(commitCount > 10000){10000+} else {@commitCount} @helpers.plural(commitCount, "commit")</a>
|
<a href="@helpers.url(repository)/commits/@helpers.encodeRefName((branch :: pathList).mkString("/"))" class="btn btn-sm btn-default"><i class="octicon octicon-history"></i> @if(commitCount > 10000){10000+} else {@commitCount} @helpers.plural(commitCount, "commit")</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if(pathList.isEmpty){
|
@if(pathList.isEmpty){
|
||||||
@@ -84,14 +84,14 @@
|
|||||||
@if(pathList.nonEmpty){
|
@if(pathList.nonEmpty){
|
||||||
<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) =>
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName((branch :: pathList.take(i + 1)).mkString("/"))">@section</a> /
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@if(hasWritePermission){
|
@if(hasWritePermission){
|
||||||
<div class="btn-group pull-left" style="margin-left: 4px;">
|
<div class="btn-group pull-left" style="margin-left: 4px;">
|
||||||
<a href="@helpers.url(repository)/new/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default pc" title="Create a new file"><i class="octicon octicon-plus"></i></a>
|
<a href="@helpers.url(repository)/new/@helpers.encodeRefName((branch :: pathList).mkString("/"))" class="btn btn-sm btn-default pc" title="Create a new file"><i class="octicon octicon-plus"></i></a>
|
||||||
<a href="@helpers.url(repository)/upload/@helpers.encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-sm btn-default pc" title="Upload files"><i class="octicon octicon-cloud-upload"></i></a>
|
<a href="@helpers.url(repository)/upload/@helpers.encodeRefName((branch :: pathList).mkString("/"))" class="btn btn-sm btn-default pc" title="Upload files"><i class="octicon octicon-cloud-upload"></i></a>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
@if(pathList.size > 0){
|
@if(pathList.size > 0){
|
||||||
<tr>
|
<tr>
|
||||||
<td width="16" class="file-icon"></td>
|
<td width="16" class="file-icon"></td>
|
||||||
<td><a href="@helpers.url(repository)@if(pathList.size > 1){/tree/@helpers.encodeRefName(branch)/@pathList.init.mkString("/")}">..</a></td>
|
<td><a href="@helpers.url(repository)@if(pathList.size > 1){/tree/@helpers.encodeRefName(branch)/@helpers.encodeRefName(pathList.init.mkString("/"))}">..</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
case None => {
|
case None => {
|
||||||
<a href={helpers.url(repository) + "/tree" + (branch :: pathList).map(helpers.encodeRefName).mkString("/", "/", "/") + helpers.encodeRefName(file.name)}>
|
<a href={helpers.url(repository) + "/tree" + helpers.encodeRefName((branch :: pathList).mkString("/", "/", "/") + file.name)}>
|
||||||
<span class="simplified-path">{file.name.split("/").toList.init match {
|
<span class="simplified-path">{file.name.split("/").toList.init match {
|
||||||
case Nil => ""
|
case Nil => ""
|
||||||
case list => list.mkString("", "/", "/")
|
case list => list.mkString("", "/", "/")
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
} else {
|
} else {
|
||||||
<a href="@helpers.url(repository)/blob@{(branch :: pathList).map(helpers.encodeRefName).mkString("/", "/", "/")}@{helpers.encodeRefName(file.name)}">@file.name</a>
|
<a href="@helpers.url(repository)/blob@{helpers.encodeRefName((branch :: pathList).mkString("/", "/", "/") + file.name)}">@file.name</a>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="ellipsis-cell" style="width: 70%;">
|
<td class="ellipsis-cell" style="width: 70%;">
|
||||||
|
|||||||
@@ -59,19 +59,19 @@ $(function(){
|
|||||||
if(e.keyCode == 40){ // DOWN
|
if(e.keyCode == 40){ // DOWN
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
changeCursor(cursor+1);
|
changeCursor(cursor + 1);
|
||||||
}else if(e.keyCode==38){ // UP
|
}else if(e.keyCode == 38){ // UP
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
changeCursor(cursor-1);
|
changeCursor(cursor - 1);
|
||||||
}else if(e.keyCode==13){ // ENTER
|
}else if(e.keyCode == 13){ // ENTER
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
target = $(".tree-browser-result.navigation-focus a");
|
target = $(".tree-browser-result.navigation-focus a");
|
||||||
if(target[0]){
|
if(target[0]){
|
||||||
target[0].click();
|
target[0].click();
|
||||||
}
|
}
|
||||||
}else if(e.keyCode==27){ // ESC
|
}else if(e.keyCode == 27){ // ESC
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
history.back();
|
history.back();
|
||||||
@@ -90,23 +90,25 @@ $(function(){
|
|||||||
}
|
}
|
||||||
function filter(){
|
function filter(){
|
||||||
var v = $('#tree-finder-field').val();
|
var v = $('#tree-finder-field').val();
|
||||||
if(v==preKeyword || paths.length==0){
|
if(v == preKeyword || paths.length == 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
scrollIntoView('#tree-finder-field');
|
scrollIntoView('#tree-finder-field');
|
||||||
preKeyword=v;
|
preKeyword = v;
|
||||||
cursor=0;
|
cursor = 0;
|
||||||
var p = string_score_sort(v, paths, 50);
|
var p = string_score_sort(v, paths, 50);
|
||||||
res.html("");
|
res.html("");
|
||||||
if(p.length==0){
|
if(p.length == 0){
|
||||||
$(".no-results").show();
|
$(".no-results").show();
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
$(".no-results").hide();
|
$(".no-results").hide();
|
||||||
for(var i=0;i < p.length;i++){
|
for(var i = 0; i < p.length; i++){
|
||||||
var row = template.clone();
|
var row = template.clone();
|
||||||
row.find("a").attr("href",pathBase+"/"+p[i].string).html(string_score_highlight(p[i], '<b>'));
|
// console.log('Path base: ' + pathBase);
|
||||||
if(cursor==i){
|
// console.log('Path rest ' + p[i].string);
|
||||||
|
row.find("a").attr("href", pathBase + "/" + encodeURIComponent(p[i].string).replace('%2F', '/')).html(string_score_highlight(p[i], '<b>'));
|
||||||
|
if(cursor == i){
|
||||||
row.addClass("navigation-focus");
|
row.addClass("navigation-focus");
|
||||||
}
|
}
|
||||||
row.appendTo(res);
|
row.appendTo(res);
|
||||||
@@ -116,4 +118,4 @@ $(function(){
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<div class="head">
|
<div class="head">
|
||||||
<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) =>
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch + "/" + pathList.take(i + 1).mkString("/"))">@section</a> /
|
||||||
}
|
}
|
||||||
<input type="hidden" name="branch" id="branch" value="@branch"/>
|
<input type="hidden" name="branch" id="branch" value="@branch"/>
|
||||||
<input type="hidden" name="path" id="path" value="@pathList.mkString("/")"/>
|
<input type="hidden" name="path" id="path" value="@pathList.mkString("/")"/>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<input type="text" name="message" class="form-control"/>
|
<input type="text" name="message" class="form-control"/>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch)/@{pathList.mkString("/")}" class="btn btn-danger">Cancel</a>
|
<a href="@helpers.url(repository)/tree/@helpers.encodeRefName(branch + "/" + pathList.mkString("/"))" class="btn btn-danger">Cancel</a>
|
||||||
<input type="submit" id="commit" class="btn btn-success" value="Commit changes" disabled="true"/>
|
<input type="submit" id="commit" class="btn btn-success" value="Commit changes" disabled="true"/>
|
||||||
<input type="hidden" id="upload-files-data" name="uploadFiles" value=""/>
|
<input type="hidden" id="upload-files-data" name="uploadFiles" value=""/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user