Browse Source

新增:接口附件内容返回

pull/342/head
yystopf 3 years ago
parent
commit
656d5b69b6
4 changed files with 17 additions and 1 deletions
  1. +7
    -0
      app/views/api/v1/attachments/_simple_detail.json.jbuilder
  2. +4
    -1
      app/views/api/v1/issues/_detail.json.jbuilder
  3. +3
    -0
      app/views/api/v1/issues/journals/_children_detail.json.jbuilder
  4. +3
    -0
      app/views/api/v1/issues/journals/_detail.json.jbuilder

+ 7
- 0
app/views/api/v1/attachments/_simple_detail.json.jbuilder View File

@@ -0,0 +1,7 @@
json.id attachment.id
json.title attachment.title
json.filesize number_to_human_size(attachment.filesize)
json.is_pdf attachment.is_pdf?
json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
json.created_on attachment.created_on.strftime("%Y-%m-%d %H:%M")
json.content_type attachment.content_type

+ 4
- 1
app/views/api/v1/issues/_detail.json.jbuilder View File

@@ -39,4 +39,7 @@ json.participants issue.participants.distinct.each do |participant|
json.partial! "api/v1/users/simple_user", locals: {user: participant}
end
json.comment_journals_count issue.comment_journals.size
json.operate_journals_count issue.operate_journals.size
json.operate_journals_count issue.operate_journals.size
json.attachments issue.attachments.each do |attachment|
json.partial! "api/v1/attachments/simple_detail", locals: {attachment: attachment}
end

+ 3
- 0
app/views/api/v1/issues/journals/_children_detail.json.jbuilder View File

@@ -14,4 +14,7 @@ json.reply_user do
else
json.nil!
end
end
json.attachments journal.attachments.each do |attachment|
json.partial! "api/v1/attachments/simple_detail", locals: {attachment: attachment}
end

+ 3
- 0
app/views/api/v1/issues/journals/_detail.json.jbuilder View File

@@ -17,4 +17,7 @@ else
json.children_journals journal.first_ten_children_journals.each do |journal|
json.partial! "children_detail", journal: journal
end
json.attachments journal.attachments do |attachment|
json.partial! "api/v1/attachments/simple_detail", locals: {attachment: attachment}
end
end

Loading…
Cancel
Save