@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo, completionContext: String, generateScript: Boolean = true)(textarea: Html)(implicit context: gitbucket.core.controller.Context) @import gitbucket.core.util.FileUtil @import gitbucket.core.view.helpers
@textarea
Attach images or documents by dragging & dropping, or selecting them.
@defining("(id=\")([\\w\\-]*)(\")".r.findFirstMatchIn(textarea.body).map(_.group(2))){ textareaId =>
} @dropzone(clickable: Boolean, textareaId: Option[String]) = { url: '@context.path/upload/file/@repository.owner/@repository.name', maxFilesize: 10, clickable: @clickable, acceptedFiles: @Html(FileUtil.mimeTypeWhiteList.mkString("'", ",", "'")), dictInvalidFileType: 'Unfortunately, we don\'t support that file type. Try again with a PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, or PDF.', previewTemplate: "
\n
Uploading your files...
\n
\n
", success: function(file, id) { var attachFile = (file.type.match(/image\/.*/) ? '\n![' + file.name.split('.')[0] : '\n[' + file.name) + '](@context.baseUrl/@repository.owner/@repository.name/_attached/' + id + ')'; $('#@textareaId').val($('#@textareaId').val() + attachFile); $(file.previewElement).prevAll('div.dz-preview').addBack().remove(); } }