ADD repository url

dev_forge
Jasder 5 years ago
parent 8d5b371b88
commit 98fa2bbb99

@ -6,4 +6,20 @@ module ProjectsHelper
when 'mirror' then "开源镜像项目" when 'mirror' then "开源镜像项目"
end end
end end
def render_zip_url(project, archive_name)
[gitea_domain, project.owner.login, project.identifier, "#{archive_name}.zip"].join('/')
end
def render_tar_url(project, archive_name)
[gitea_domain, project.owner.login, project.identifier, "#{archive_name}.tar.gz"].join('/')
end
def render_http_url(project)
[gitea_domain, project.owner.login, "#{project.identifier}.git"].join('/')
end
def gitea_domain
Gitea.gitea_config[:domain]
end
end end

@ -3,6 +3,9 @@ json.array! @branches do |branch|
json.user_can_push branch['user_can_push'] json.user_can_push branch['user_can_push']
json.user_can_merge branch['user_can_merge'] json.user_can_merge branch['user_can_merge']
json.protected branch['protected'] json.protected branch['protected']
json.http_url render_http_url(@project)
json.zip_url render_zip_url(@project, branch['name'])
json.tar_url render_tar_url(@project, branch['name'])
json.last_commit do json.last_commit do
json.id branch['commit']['id'] json.id branch['commit']['id']
json.message branch['commit']['message'] json.message branch['commit']['message']

Loading…
Cancel
Save