open pdf attachments in a new tab
parent
fefb6aca10
commit
389f27880c
|
@ -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
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue