mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
Open attachment when click thumbnail on modal
This commit is contained in:
15
js/script.js
15
js/script.js
@@ -459,14 +459,12 @@ View.prototype = {
|
||||
event.stopPropagation();
|
||||
OC.dialogs.filepicker(t('quicknotes', 'Select file to attach'), function(datapath, returntype) {
|
||||
OC.Files.getClient().getFileInfo(datapath).then((status, fileInfo) => {
|
||||
var attach = {
|
||||
file_id: fileInfo.id,
|
||||
preview_url: OC.generateUrl('core') + '/preview.png?file=' + encodeURI(datapath) + '&x=512&y=512'
|
||||
};
|
||||
|
||||
var attachts = self._editableAttachts();
|
||||
attachts.push(attach);
|
||||
|
||||
attachts.push({
|
||||
file_id: fileInfo.id,
|
||||
preview_url: OC.generateUrl('core') + '/preview.png?file=' + encodeURI(datapath) + '&x=512&y=512',
|
||||
redirect_url: OC.generateUrl('/apps/files/?dir={dir}&scrollto={scrollto}', {dir: fileInfo.path, scrollto: fileInfo.name})
|
||||
});
|
||||
self._editableAttachts(attachts);
|
||||
}).fail(() => {
|
||||
console.log("ERRORRR");
|
||||
@@ -722,7 +720,8 @@ View.prototype = {
|
||||
return $("#modal-note-div .note-attach").toArray().map(function (value) {
|
||||
return {
|
||||
file_id: value.getAttribute('attach-file-id'),
|
||||
preview_url: value.getAttribute('data-background-image')
|
||||
preview_url: value.getAttribute('data-background-image'),
|
||||
redirect_url: value.parentElement.getAttribute('href')
|
||||
};
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<div class='note-attachts'>
|
||||
{{#each attachts}}
|
||||
<div class='note-attach-grid'>
|
||||
<div class="attach-preview note-attach" attach-file-id="{{file_id}}" data-background-image="{{preview_url}}"/>
|
||||
<a target="_blank" href="{{redirect_url}}">
|
||||
<div class="attach-preview note-attach" attach-file-id="{{file_id}}" data-background-image="{{preview_url}}"/>
|
||||
</a>
|
||||
<div class="attach-remove icon-delete" title="{{t "quicknotes" "Delete attachment"}}"/>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
||||
Reference in New Issue
Block a user