open pdf attachments in a new tab

stable
Juanfran 2016-05-27 09:26:16 +02:00
parent fefb6aca10
commit 389f27880c
2 changed files with 7 additions and 0 deletions

View File

@ -215,6 +215,9 @@ _.mixin
isImage = (name) -> isImage = (name) ->
return name.match(/\.(jpe?g|png|gif|gifv|webm)/i) != null return name.match(/\.(jpe?g|png|gif|gifv|webm)/i) != null
isPdf = (name) ->
return name.match(/\.(pdf)/i) != null
patch = (oldImmutable, newImmutable) -> patch = (oldImmutable, newImmutable) ->
pathObj = {} pathObj = {}
@ -252,4 +255,5 @@ taiga.stripTags = stripTags
taiga.replaceTags = replaceTags taiga.replaceTags = replaceTags
taiga.defineImmutableProperty = defineImmutableProperty taiga.defineImmutableProperty = defineImmutableProperty
taiga.isImage = isImage taiga.isImage = isImage
taiga.isPdf = isPdf
taiga.patch = patch taiga.patch = patch

View File

@ -28,6 +28,9 @@ AttachmentLinkDirective = ($parse, attachmentsPreviewService, lightboxService) -
scope.$apply -> scope.$apply ->
lightboxService.open($('tg-attachments-preview')) lightboxService.open($('tg-attachments-preview'))
attachmentsPreviewService.fileId = attachment.getIn(['file', 'id']) attachmentsPreviewService.fileId = attachment.getIn(['file', 'id'])
else if taiga.isPdf(attachment.getIn(['file', 'name']))
event.preventDefault()
window.open(attachment.getIn(['file', 'url']))
scope.$on "$destroy", -> el.off() scope.$on "$destroy", -> el.off()
return { return {