forgeplus/app/views/project_trends/_detail.json.jbuilder

36 lines
1.3 KiB
Plaintext
Raw Normal View History

2021-05-27 16:40:15 +08:00
json.id trend.id
json.trend_type trend.trend_type
json.action_type l("trend.#{trend.action_type}") + l("trend.#{trend.trend_type}")
json.trend_id trend.trend_id
json.user_name trend.user.try(:show_real_name)
json.user_login trend.user.login
json.user_avatar url_to_avatar(trend.user)
json.action_time time_from_now(trend.created_at)
2021-12-22 13:57:02 +08:00
json.project do
json.owner do
json.partial! 'users/user_simple', locals: {user: trend&.project&.owner}
end
json.identifier trend&.project&.identifier
json.description trend&.project&.description
end
2021-05-27 16:40:15 +08:00
if trend.trend_type == "Issue"
json.partial! "issues/simple_issue_item", locals: {issue: trend.trend}
elsif trend.trend_type == "VersionRelease"
json.partial! "version_releases/simple_version_release", locals: {version: trend.trend}
elsif trend.trend_type == "CommitLog"
2023-04-18 09:56:25 +08:00
commit_log = trend.trend
json.name commit_log.message
json.created_at format_time(commit_log.created_at)
json.commit_log do
json.user do
json.partial! 'users/user_simple', locals: {user: commit_log.user}
end
json.ref commit_log.ref.to_s.gsub("refs/heads/", "")
json.extract! commit_log, :id,:name,:full_name,:message, :commit_id,:created_at,:updated_at
end
2021-05-27 16:40:15 +08:00
else
2021-06-02 15:29:00 +08:00
json.name trend.trend&.title
json.created_at format_time(trend.trend&.created_at)
2021-05-27 16:40:15 +08:00
end