附件为pdf的添加判断,并修改链接

dev_winse
SylorHuang 6 years ago
parent f348c35190
commit b262d98873

@ -6,6 +6,7 @@ json.publish_time attachment.publish_time
json.quotes attachment.quotes_count
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
json.url attachment_path(attachment, type: 'history').gsub("/api","")
# json.url attachment_path(attachment, type: 'history').gsub("/api","")
json.is_pdf attachment.is_history_pdf?
json.url attachment.is_history_pdf? ? attachment_path(attachment, type: 'history').gsub("/api","") : attachment_path(attachment, type: 'history')
json.attachment_id attachment.attachment_id

@ -11,6 +11,7 @@ json.quotes attachment.quotes_count
json.description attachment.description
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
json.url download_url(attachment)
json.is_pdf attachment.is_pdf?
json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
# json.url download_url(attachment) unless attachment.locked?(@is_member)

@ -2,5 +2,7 @@ json.id attachment.id
json.title attachment.title
json.filesize number_to_human_size attachment.filesize
json.description attachment.description
json.url download_url(attachment)
json.is_pdf attachment.is_pdf?
json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
# json.url download_url(attachment)
json.set! :delete, delete.nil? ? true : delete if defined? delete

@ -1,6 +1,6 @@
json.id attachment.id
json.title attachment.title
json.filesize number_to_human_size(attachment.filesize)
json.url download_url(attachment)
json.is_pdf attachment.is_pdf?
json.url attachment.is_pdf? ? download_url(attachment).gsub("/api","") : download_url(attachment)
json.created_on attachment.created_on
json.is_pdf attachment.is_pdf?

@ -1,9 +1,3 @@
# json.partial! 'attachments/attachment_small', attachment: @file
json.id @file.id
json.title @file.title
json.filesize number_to_human_size(@file.filesize)
json.url download_url(@file).gsub("/api","")
json.created_on @file.created_on
json.is_pdf @file.is_pdf?
json.partial! 'attachments/attachment_small', attachment: @file
json.partial! "attachment_histories/list", attachment_histories: @attachment_histories

Loading…
Cancel
Save