mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-10 07:25:50 +01:00
(refs #12) Implemented the upload area in preview.hrml.
This commit is contained in:
@@ -24,8 +24,10 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport {
|
||||
}
|
||||
|
||||
post("/image/:owner/:repository"){
|
||||
execute { (file, fileId) =>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private def execute(f: (FileItem, String) => Unit) = fileParams.get("file") match {
|
||||
case Some(file) if(FileUtil.isImage(file.name)) =>
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab1">
|
||||
<span id="error-content" class="error"></span>
|
||||
<div id="clickable">
|
||||
<textarea id="content" name="content"@if(style.nonEmpty){ style="@style"} placeholder="@placeholder">@content</textarea>
|
||||
<span class="muted">Attach images by dragging & dropping, or selecting them.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab2">
|
||||
<div class="markdown-body" id="preview-area">
|
||||
@@ -42,5 +45,17 @@ $(function(){
|
||||
prettyPrint();
|
||||
});
|
||||
});
|
||||
|
||||
@if(!enableWikiLink){
|
||||
$("div#clickable").dropzone({
|
||||
url: '@path/upload/image/@repository.owner/@repository.name',
|
||||
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) {
|
||||
$('#content').val($('#content').val() + "\n" + id + "\n" + file.name);
|
||||
file.previewElement.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -21,7 +21,6 @@ $(function(){
|
||||
var dropzone = new Dropzone('div#clickable', {
|
||||
url: '@path/upload/image',
|
||||
previewsContainer: 'div#avatar',
|
||||
paramName: 'file',
|
||||
parallelUploads: 1,
|
||||
thumbnailWidth: 120,
|
||||
thumbnailHeight: 120
|
||||
|
||||
Reference in New Issue
Block a user