| @@ -1,7 +1,9 @@ | |||||
| json.commit do | |||||
| json.message entry['latest_commit']['message'] | |||||
| json.sha entry['latest_commit']['sha'] | |||||
| json.created_at render_format_time_with_unix(entry['latest_commit']['created_at'].to_i) | |||||
| json.time_from_now time_from_now(render_format_time_with_unix(entry['latest_commit']['created_at'].to_i)) | |||||
| json.created_at_unix entry['latest_commit']['created_at'] | |||||
| if latest_commit.blank? | |||||
| json.nil! | |||||
| else | |||||
| json.message latest_commit['message'] | |||||
| json.sha latest_commit['sha'] | |||||
| json.created_at render_format_time_with_unix(latest_commit['created_at'].to_i) | |||||
| json.time_from_now time_from_now(render_format_time_with_unix(latest_commit['created_at'].to_i)) | |||||
| json.created_at_unix latest_commit['created_at'] | |||||
| end | end | ||||
| @@ -15,12 +15,8 @@ if @project.forge? | |||||
| json.direct_download direct_download | json.direct_download direct_download | ||||
| json.image_type image_type | json.image_type image_type | ||||
| json.is_readme_file is_readme?(entry['type'], entry['name']) | json.is_readme_file is_readme?(entry['type'], entry['name']) | ||||
| if entry['latest_commit'] | |||||
| if entry['type'] != 'file' | |||||
| json.partial! 'last_commit', entry: entry | |||||
| else | |||||
| json.commit nil | |||||
| end | |||||
| json.commit do | |||||
| json.partial! 'last_commit', latest_commit: entry['latest_commit'] | |||||
| end | end | ||||
| end | end | ||||
| @@ -38,8 +34,11 @@ if @project.educoder? | |||||
| json.direct_download false | json.direct_download false | ||||
| json.image_type false | json.image_type false | ||||
| json.is_readme_file false | json.is_readme_file false | ||||
| if entry['latest_commit'] | |||||
| # json.partial! 'last_commit', entry: entry | |||||
| json.partial! 'repositories/simple_entry', locals: { entry: entry } | |||||
| json.commit do | |||||
| json.message entry['title'] | |||||
| json.time_from_now entry['time'] | |||||
| json.sha nil | |||||
| json.created_at_unix nil | |||||
| json.created_at nil | |||||
| end | end | ||||
| end | end | ||||
| @@ -54,8 +54,8 @@ if @project.forge? | |||||
| json.is_readme_file is_readme?(entry['type'], entry['name']) | json.is_readme_file is_readme?(entry['type'], entry['name']) | ||||
| json.content decode64_content(entry, @owner, @repository, @ref, @path) | json.content decode64_content(entry, @owner, @repository, @ref, @path) | ||||
| json.target entry['target'] | json.target entry['target'] | ||||
| if entry['latest_commit'] | |||||
| json.partial! 'last_commit', entry: entry | |||||
| json.commit do | |||||
| json.partial! 'last_commit', latest_commit: entry['latest_commit'] | |||||
| end | end | ||||
| end | end | ||||
| end | end | ||||