mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 05:55:51 +01:00
(refs #13)Bug fix
This commit is contained in:
@@ -356,7 +356,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
repo.html.files(revision, repository,
|
repo.html.files(revision, repository,
|
||||||
if(path == ".") Nil else path.split("/").toList, // current path
|
if(path == ".") Nil else path.split("/").toList, // current path
|
||||||
new JGitUtil.CommitInfo(revCommit), // latest commit
|
new JGitUtil.CommitInfo(revCommit), // latest commit
|
||||||
files, readme)
|
files, readme, hasWritePermission(repository.owner, repository.name, context.loginAccount))
|
||||||
}
|
}
|
||||||
} getOrElse NotFound
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
val headTip = git.getRepository.resolve(s"refs/heads/${branch}")
|
val headTip = git.getRepository.resolve(s"refs/heads/${branch}")
|
||||||
|
|
||||||
JGitUtil.processTree(git, headTip){ (path, tree) =>
|
JGitUtil.processTree(git, headTip){ (path, tree) =>
|
||||||
if(path != newPath && !oldPath.exists(_ == path)){
|
if(!newPath.exists(_ == path) && !oldPath.exists(_ == path)){
|
||||||
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,8 +387,8 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
newPath.foreach { newPath =>
|
newPath.foreach { newPath =>
|
||||||
builder.add(JGitUtil.createDirCacheEntry(newPath, FileMode.REGULAR_FILE,
|
builder.add(JGitUtil.createDirCacheEntry(newPath, FileMode.REGULAR_FILE,
|
||||||
inserter.insert(Constants.OBJ_BLOB, content.getBytes(charset))))
|
inserter.insert(Constants.OBJ_BLOB, content.getBytes(charset))))
|
||||||
builder.finish()
|
|
||||||
}
|
}
|
||||||
|
builder.finish()
|
||||||
|
|
||||||
val commitId = JGitUtil.createNewCommit(git, inserter, headTip, builder.getDirCache.writeTree(inserter),
|
val commitId = JGitUtil.createNewCommit(git, inserter, headTip, builder.getDirCache.writeTree(inserter),
|
||||||
loginAccount.fullName, loginAccount.mailAddress, message)
|
loginAccount.fullName, loginAccount.mailAddress, message)
|
||||||
|
|||||||
@@ -27,6 +27,21 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
|
@*
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<select id="indent" class="input-small" style="margin-bottom: 0px;">
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="4">4</option>
|
||||||
|
<option value="8">8</option>
|
||||||
|
</select>
|
||||||
|
<select id="wrap" class="input-medium" style="margin-bottom: 0px;">
|
||||||
|
<option value="false">No wrap</option>
|
||||||
|
<option value="true">Soft wrap</option>
|
||||||
|
</select>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
*@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div id="editor"></div>
|
<div id="editor"></div>
|
||||||
@@ -59,17 +74,34 @@ $(function(){
|
|||||||
$('#editor').text($('#initial').val());
|
$('#editor').text($('#initial').val());
|
||||||
var editor = ace.edit("editor");
|
var editor = ace.edit("editor");
|
||||||
editor.setTheme("ace/theme/monokai");
|
editor.setTheme("ace/theme/monokai");
|
||||||
|
editor.getSession().setUseWrapMode(false);
|
||||||
|
|
||||||
@if(fileName.isDefined){
|
@if(fileName.isDefined){
|
||||||
editor.getSession().setMode("ace/mode/@editorType(fileName.get)");
|
editor.getSession().setMode("ace/mode/@editorType(fileName.get)");
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.on('change', function(){
|
editor.on('change', function(){
|
||||||
$('#commit').attr('disabled', editor.getValue() == $('#initial').val());
|
$('#commit').attr('disabled', editor.getValue() == $('#initial').val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@*
|
||||||
|
$('#wrap').change(function(){
|
||||||
|
console.log($('#wrap option:selected').val());
|
||||||
|
if($('#wrap option:selected').val() == 'true'){
|
||||||
|
editor.getSession().setUseWrapMode(true);
|
||||||
|
} else {
|
||||||
|
editor.getSession().setUseWrapMode(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#indent').change(function(){
|
||||||
|
console.log($('#indent option:selected').val());
|
||||||
|
editor.getSession().setUseWrapMode(parseInt($('#indent option:selected').val()));
|
||||||
|
});
|
||||||
|
*@
|
||||||
|
|
||||||
$('#commit').click(function(){
|
$('#commit').click(function(){
|
||||||
$('#content').val(editor.getValue());
|
$('#content').val(editor.getValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
pathList: List[String],
|
pathList: List[String],
|
||||||
latestCommit: util.JGitUtil.CommitInfo,
|
latestCommit: util.JGitUtil.CommitInfo,
|
||||||
files: List[util.JGitUtil.FileInfo],
|
files: List[util.JGitUtil.FileInfo],
|
||||||
readme: Option[(List[String], String)])(implicit context: app.Context)
|
readme: Option[(List[String], String)],
|
||||||
|
hasWritePermission: Boolean)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
||||||
@@ -19,8 +20,9 @@
|
|||||||
@pathList.zipWithIndex.map { case (section, i) =>
|
@pathList.zipWithIndex.map { case (section, i) =>
|
||||||
<a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
<a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> /
|
||||||
}
|
}
|
||||||
<!-- TODO Add new file icon for committers -->
|
@if(hasWritePermission){
|
||||||
<a href="@url(repository)/new/@encodeRefName(branch)/@pathList.mkString("/")">+</a>
|
<a href="@url(repository)/new/@encodeRefName(branch)/@pathList.mkString("/")">+</a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<table class="table table-file-list" style="border: 1px solid silver;">
|
<table class="table table-file-list" style="border: 1px solid silver;">
|
||||||
|
|||||||
Reference in New Issue
Block a user