mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:24:31 -04:00
Lazy load invoice documents
This commit is contained in:
parent
ea2f154b1f
commit
ee2ef4608e
@ -998,7 +998,18 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Initialize document upload
|
// Initialize document upload
|
||||||
dropzone = new Dropzone('#document-upload .dropzone', {
|
window.dropzone = false;
|
||||||
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
|
if (window.dropzone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var target = $(e.target).attr('href') // activated tab
|
||||||
|
if (target != '#attached-documents') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.dropzone = new Dropzone('#document-upload .dropzone', {
|
||||||
url:{!! json_encode(url('document')) !!},
|
url:{!! json_encode(url('document')) !!},
|
||||||
params:{
|
params:{
|
||||||
_token:"{{ Session::getToken() }}"
|
_token:"{{ Session::getToken() }}"
|
||||||
@ -1031,7 +1042,7 @@
|
|||||||
dropzone.emit('addedfile', mockFile);
|
dropzone.emit('addedfile', mockFile);
|
||||||
dropzone.emit('complete', mockFile);
|
dropzone.emit('complete', mockFile);
|
||||||
if(document.preview_url()){
|
if(document.preview_url()){
|
||||||
dropzone.emit('thumbnail', mockFile, document.preview_url()||document.url());
|
dropzone.emit('thumbnail', mockFile, document.preview_url());
|
||||||
}
|
}
|
||||||
else if(document.type()=='jpeg' || document.type()=='png' || document.type()=='svg'){
|
else if(document.type()=='jpeg' || document.type()=='png' || document.type()=='svg'){
|
||||||
dropzone.emit('thumbnail', mockFile, document.url());
|
dropzone.emit('thumbnail', mockFile, document.url());
|
||||||
@ -1039,6 +1050,7 @@
|
|||||||
dropzone.files.push(mockFile);
|
dropzone.files.push(mockFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user