Browse Source

修改commits的返回值

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
657b1f36d5
1 changed files with 11 additions and 8 deletions
  1. +11
    -8
      app/views/repositories/commits.json.jbuilder

+ 11
- 8
app/views/repositories/commits.json.jbuilder View File

@@ -1,10 +1,13 @@
json.total_count @hash_commit[:total_count]
json.commits do
json.array! @hash_commit[:body] do |commit|
json.sha commit['sha']
json.message commit['commit']['message']
json.timestamp render_unix_time(commit['commit']['author']['date'])
json.time_from_now time_from_now(commit['commit']['author']['date'])
json.partial! 'author', user: @project.owner
unless @hash_commit[:status].present? #如果有状态值,则表示报错了
json.total_count @hash_commit[:total_count]
json.commits do
json.array! @hash_commit[:body] do |commit|
json.sha commit['sha']
json.message commit['commit']['message']
json.timestamp render_unix_time(commit['commit']['author']['date'])
json.time_from_now time_from_now(commit['commit']['author']['date'])
json.partial! 'author', user: @project.owner
end
end
end


Loading…
Cancel
Save