mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-05 04:56:02 +01:00
(refs #12) Implemented the process of saving image.
This commit is contained in:
@@ -25,7 +25,7 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport {
|
||||
|
||||
post("/image/:owner/:repository"){
|
||||
execute { (file, fileId) =>
|
||||
|
||||
FileUtils.writeByteArrayToFile(new java.io.File(getAttachedDir(params("owner"), params("repository")), fileId), file.get)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -274,8 +274,7 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
})
|
||||
|
||||
get("/:owner/:repository/_attached/:file")(referrersOnly { repository =>
|
||||
println("----" + params("file"))
|
||||
|
||||
new java.io.File(Directory.getAttachedDir(repository.owner, repository.name), params("file"))
|
||||
})
|
||||
|
||||
val assignedUserName = (key: String) => params.get(key) filter (_.trim != "")
|
||||
|
||||
@@ -52,9 +52,8 @@ $(function(){
|
||||
maxFilesize: 10,
|
||||
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your images...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
|
||||
success: function(file, id) {
|
||||
var index = file.name.indexOf('.');
|
||||
$('#content').val($('#content').val() +
|
||||
'\n/_attached/' + id + file.name.substring(index) + ')');
|
||||
var images = '\n![' + file.name.split('.')[0] + '](@url(repository)/_attached/' + id + ')';
|
||||
$('#content').val($('#content').val() + images);
|
||||
file.previewElement.remove();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user