diff --git a/app/coffee/utils.coffee b/app/coffee/utils.coffee index a8ec6979..fc6d1757 100644 --- a/app/coffee/utils.coffee +++ b/app/coffee/utils.coffee @@ -215,6 +215,9 @@ _.mixin isImage = (name) -> return name.match(/\.(jpe?g|png|gif|gifv|webm)/i) != null +isPdf = (name) -> + return name.match(/\.(pdf)/i) != null + patch = (oldImmutable, newImmutable) -> pathObj = {} @@ -252,4 +255,5 @@ taiga.stripTags = stripTags taiga.replaceTags = replaceTags taiga.defineImmutableProperty = defineImmutableProperty taiga.isImage = isImage +taiga.isPdf = isPdf taiga.patch = patch diff --git a/app/modules/components/attachment-link/attachment-link.directive.coffee b/app/modules/components/attachment-link/attachment-link.directive.coffee index 2e357f15..d1a5d299 100644 --- a/app/modules/components/attachment-link/attachment-link.directive.coffee +++ b/app/modules/components/attachment-link/attachment-link.directive.coffee @@ -28,6 +28,9 @@ AttachmentLinkDirective = ($parse, attachmentsPreviewService, lightboxService) - scope.$apply -> lightboxService.open($('tg-attachments-preview')) 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() return {