mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-13 17:05:50 +01:00
Change the upload form for PDF files
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
@import context._
|
@import context._
|
||||||
<div class="muted attachable">
|
<div class="muted attachable">
|
||||||
@textarea
|
@textarea
|
||||||
<div class="clickable">Attach images by dragging & dropping, or selecting them.</div>
|
<div class="clickable">Attach images or PDF files by dragging & dropping, or selecting them.</div>
|
||||||
</div>
|
</div>
|
||||||
@defining("(id=\")([\\w\\-]*)(\")".r.findFirstMatchIn(textarea.body).map(_.group(2))){ textareaId =>
|
@defining("(id=\")([\\w\\-]*)(\")".r.findFirstMatchIn(textarea.body).map(_.group(2))){ textareaId =>
|
||||||
<script>
|
<script>
|
||||||
@@ -13,10 +13,11 @@ $(function(){
|
|||||||
maxFilesize: 10,
|
maxFilesize: 10,
|
||||||
acceptedFiles: 'image/*,application/pdf',
|
acceptedFiles: 'image/*,application/pdf',
|
||||||
dictInvalidFileType: 'Unfortunately, we don\'t support that file type. Try again with a PNG, GIF, or JPG.',
|
dictInvalidFileType: 'Unfortunately, we don\'t support that file type. Try again with a PNG, GIF, or JPG.',
|
||||||
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>",
|
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your images or PDF files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
|
||||||
success: function(file, id) {
|
success: function(file, id) {
|
||||||
var images = '\n![' + file.name.split('.')[0] + '](@baseUrl/@owner/@repository/_attached/' + id + ')';
|
var attachFile = (file.type.match(/image\/.*/) ? '\n![' + file.name.split('.')[0] : '\n[' + file.name) +
|
||||||
$('#@textareaId').val($('#@textareaId').val() + images);
|
'](@baseUrl/@owner/@repository/_attached/' + id + ')';
|
||||||
|
$('#@textareaId').val($('#@textareaId').val() + attachFile);
|
||||||
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
|
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user