mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Add support for viewing pdfs
This commit is contained in:
parent
f177e416ee
commit
070e8831b4
3 changed files with 67 additions and 2 deletions
|
|
@ -69,7 +69,54 @@
|
||||||
border: 1px solid #000;
|
border: 1px solid #000;
|
||||||
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
|
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
|
||||||
}
|
}
|
||||||
|
#viewer-overlay{
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 48px; /* height of the navbar */
|
||||||
|
left: 0;
|
||||||
|
z-index: 9999 !important;
|
||||||
|
background: rgba(13,13,13,0.9);
|
||||||
|
}
|
||||||
|
#viewer-container {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#viewer-close {
|
||||||
|
color:white;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 4em;
|
||||||
|
top: 0;
|
||||||
|
right: 16px;
|
||||||
|
position: absolute;
|
||||||
|
padding: 20 20;
|
||||||
|
}
|
||||||
|
#viewer-container{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
#pdf-viewer {
|
||||||
|
width: 40vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
.pdf-preview-error{
|
||||||
|
margin-top: 20vh;
|
||||||
|
display: block;
|
||||||
|
font-size: 2em;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 1600px) {
|
||||||
|
#pdf-viewer {
|
||||||
|
width: 60vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
|
|
||||||
|
#pdf-viewer {
|
||||||
|
width: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
.attachments-galery .attachment-item {
|
.attachments-galery .attachment-item {
|
||||||
width: 48%;
|
width: 48%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,12 @@ template(name="attachmentDeletePopup")
|
||||||
button.js-confirm.negate.full(type="submit") {{_ 'delete'}}
|
button.js-confirm.negate.full(type="submit") {{_ 'delete'}}
|
||||||
|
|
||||||
template(name="attachmentsGalery")
|
template(name="attachmentsGalery")
|
||||||
|
#viewer-overlay.hidden
|
||||||
|
#viewer-container
|
||||||
|
object#pdf-viewer(type="application/pdf")
|
||||||
|
span.pdf-preview-error Your device does not support previewing pdfs. Try downloading instead.
|
||||||
|
a#viewer-close.fa.fa-times-thin
|
||||||
|
|
||||||
.attachments-galery
|
.attachments-galery
|
||||||
if currentUser.isBoardMember
|
if currentUser.isBoardMember
|
||||||
unless currentUser.isCommentOnly
|
unless currentUser.isCommentOnly
|
||||||
|
|
@ -40,7 +46,8 @@ template(name="attachmentsGalery")
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
each attachments
|
each attachments
|
||||||
.attachment-item
|
.attachment-item
|
||||||
a.attachment-thumbnail.swipebox(href="{{link}}" title="{{sanitize name}}")
|
|
||||||
|
span.attachment-thumbnail(href="{{link}}" title="{{sanitize name}}" class="{{#if isImage}}swipebox{{/if}} {{#if $eq extension 'pdf'}}pdf{{/if}}")
|
||||||
if link
|
if link
|
||||||
if($eq extension 'svg')
|
if($eq extension 'svg')
|
||||||
img.attachment-thumbnail-img(src="{{link}}" title="{{sanitize name}}" type="image/svg+xml")
|
img.attachment-thumbnail-img(src="{{link}}" title="{{sanitize name}}" type="image/svg+xml")
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,17 @@ const filesize = require('filesize');
|
||||||
const prettyMilliseconds = require('pretty-ms');
|
const prettyMilliseconds = require('pretty-ms');
|
||||||
|
|
||||||
Template.attachmentsGalery.events({
|
Template.attachmentsGalery.events({
|
||||||
|
'click .pdf'(event) {
|
||||||
|
let link = $(event.currentTarget).attr("href");
|
||||||
|
$("#pdf-viewer").attr("data", link);
|
||||||
|
$("#viewer-overlay").removeClass("hidden");
|
||||||
|
},
|
||||||
|
'click #viewer-container'(event) {
|
||||||
|
$("#viewer-overlay").addClass("hidden");
|
||||||
|
},
|
||||||
|
'click #viewer-close'(event) {
|
||||||
|
$("#viewer-overlay").addClass("hidden");
|
||||||
|
},
|
||||||
'click .js-add-attachment': Popup.open('cardAttachments'),
|
'click .js-add-attachment': Popup.open('cardAttachments'),
|
||||||
// If we let this event bubble, FlowRouter will handle it and empty the page
|
// If we let this event bubble, FlowRouter will handle it and empty the page
|
||||||
// content, see #101.
|
// content, see #101.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue