diff --git a/app/views/journals/_journal_item.json.jbuilder b/app/views/journals/_journal_item.json.jbuilder new file mode 100644 index 000000000..03fd35c7b --- /dev/null +++ b/app/views/journals/_journal_item.json.jbuilder @@ -0,0 +1,16 @@ +json.id journal.id +json.user_name journal.user.try(:show_real_name) +json.user_login journal.user.try(:login) +json.user_picture url_to_avatar(journal.user) +json.is_journal_detail journal.is_journal_detail? #判断是否修改了参数而添加的回复内容 +json.content journal.try(:notes) +json.children_journals children_content(journal.id) +json.journal_details journal.journal_content +json.format_time format_time(journal.created_on) +json.created_at time_from_now(journal.created_on) + +json.attachments do + json.array! journal.attachments do |attachment| + json.partial! "attachments/attachment_simple", locals: {attachment: attachment} + end +end \ No newline at end of file diff --git a/app/views/journals/edit.json.jbuilder b/app/views/journals/edit.json.jbuilder new file mode 100644 index 000000000..f5460ded4 --- /dev/null +++ b/app/views/journals/edit.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! @journal, :id,:notes +json.issue_id @journal.journalized_id \ No newline at end of file diff --git a/app/views/journals/index.json.jbuilder b/app/views/journals/index.json.jbuilder new file mode 100644 index 000000000..2485e72bd --- /dev/null +++ b/app/views/journals/index.json.jbuilder @@ -0,0 +1,8 @@ +json.partial! "commons/success" +json.limit @limit +json.journals_count @journals_size +json.issue_journals do + json.array! @journals do |journal| + json.partial! "journals/journal_item", journal: journal + end +end \ No newline at end of file diff --git a/app/views/journals/update.json.jbuilder b/app/views/journals/update.json.jbuilder new file mode 100644 index 000000000..e69de29bb