init project

This commit is contained in:
Jasder
2020-03-09 00:40:16 +08:00
commit 2937b2a94d
6549 changed files with 7215173 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
json.id project.id
json.identifier project.identifier
json.name project.name
json.description project.description
json.visits project.visits
json.praises_count project.praises_count
json.forked_count project.forked_count
json.is_public project.is_public
json.mirror_url project.repository&.mirror_url
json.last_update_time render_unix_time(project.updated_on)
json.time_ago time_from_now(project.updated_on)

View File

@@ -0,0 +1,25 @@
json.array! @branches do |branch|
json.name branch['name']
json.user_can_push branch['user_can_push']
json.user_can_merge branch['user_can_merge']
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.id branch['commit']['id']
json.message branch['commit']['message']
json.timestamp render_unix_time(branch['commit']['timestamp'])
json.time_from_now time_from_now(branch['commit']['timestamp'])
end
user = User.find_by_login branch['commit']['author']['name']
json.author do
if user
json.login user.login
json.image_url url_to_avatar(user)
else
json.nil
end
end
end

View File

@@ -0,0 +1 @@
json.extract! @project, :id, :name,:identifier

View File

@@ -0,0 +1,5 @@
json.array! @project_group_list do |group|
json.project_type group.project_type
json.name render_zh_project_type(group.project_type)
json.projects_count group.projects_count
end

View File

@@ -0,0 +1,27 @@
json.total_count @total_count
json.projects do
json.array! @projects do |project|
json.partial! 'project', project: project
json.author do
json.name project.owner.login
json.login project.owner.login
json.image_url url_to_avatar(project.owner)
end
json.category do
if project.project_category.blank?
json.nil!
else
json.id project.project_category.id
json.name project.project_category.name
end
end
json.language do
if project.project_language.blank?
json.nil!
else
json.id project.project_language.id
json.name project.project_language.name
end
end
end
end

View File

@@ -0,0 +1 @@
json.extract! @project, :id, :name

View File

@@ -0,0 +1,6 @@
json.name @project.name
json.identifier @project.identifier
json.is_public @project.is_public
json.description @project.description
json.repo_id @project.repository.id
json.repo_identifier @project.repository.identifier

View File

@@ -0,0 +1,7 @@
json.id @project.id
json.identifier @project.identifier
json.name @project.name
json.description @project.description
json.project_category_id @project.project_category_id
json.project_language_id @project.project_language_id
json.is_public @project.is_public