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