Merge branch 'standalone_develop' into pm_project_develop

# Conflicts:
#	app/models/attachment.rb
#	app/views/api/v1/attachments/_simple_detail.json.jbuilder
This commit is contained in:
2024-04-29 09:11:08 +08:00
45 changed files with 344 additions and 52 deletions

View File

@@ -14,7 +14,7 @@
<label>
建站工具 <span class="ml10 color-orange mr20">*</span>
</label>
<% state_options = [['hugo', "hugo"], ['jeklly', "jeklly"],['hexo',"hexo"]] %>
<% state_options = [['hugo', "hugo"], ['jeklly', "jeklly"],['hexo',"hexo"],['files',"files"]] %>
<%= select_tag('page_theme[language_frame]', options_for_select(state_options), class: 'form-control') %>
</div>
<% end%>

View File

@@ -6,7 +6,7 @@
<%= form_tag(admins_page_themes_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<div class="form-group mr-2">
<label for="language_frame">建站工具:</label>
<% state_options = [['全部',nil], ['hugo', 0], ['jeklly', 1],['hexo',2]] %>
<% state_options = [['全部',nil], ['hugo', 0], ['jeklly', 1],['hexo',2],['files',3]] %>
<%= select_tag(:language_frame, options_for_select(state_options), class: 'form-control') %>
</div>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>

View File

@@ -0,0 +1,11 @@
json.id attachment.uuid
json.title attachment.title
json.description attachment.description
json.filesize number_to_human_size(attachment.filesize)
json.is_pdf attachment.is_pdf?
json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
json.created_on attachment.created_on.strftime("%Y-%m-%d %H:%M:%S")
json.content_type attachment.content_type
json.creator do
json.partial! "api/v1/users/simple_user", locals: {user: attachment.author}
end

View File

@@ -1,5 +1,6 @@
json.id attachment.id
json.id attachment.uuid
json.title attachment.title
json.description attachment.description
json.filesize number_to_human_size(attachment.filesize)
json.is_pdf attachment.is_pdf?
json.url Rails.application.config_for(:configuration)['platform_url'] + (attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)).to_s

View File

@@ -0,0 +1,14 @@
json.total_count @project_datasets.total_count
json.project_datasets @project_datasets.each do |dataset|
json.(dataset, :id, :title, :description, :paper_content)
json.project do
json.partial! "api/v1/projects/simple_detail", project: dataset.project
end
if dataset.license.present?
json.license do
json.(dataset.license, :name, :content)
end
else
json.license nil
end
end

View File

@@ -1,7 +1,7 @@
if project.present?
json.type project.project_type
json.(project,
:description, :forked_count, :forked_from_project_id, :identifier,
:id, :description, :forked_count, :forked_from_project_id, :identifier,
:issues_count, :pull_requests_count, :invite_code, :website, :platform,
:name, :open_devops, :praises_count, :is_public, :status, :watchers_count,
:ignore_id, :license_id, :project_category_id, :project_language_id)

View File

@@ -1,4 +1,6 @@
json.total_count @result_object[:total_data].to_i
json.ssh_url @object_detail['ssh_url']
json.clone_url @object_detail['clone_url']
json.commits @result_object[:data].each do |commit|
json.sha commit['sha']
json.author do
@@ -9,5 +11,6 @@ json.commits @result_object[:data].each do |commit|
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['commit']['committer']), name: commit['commit']['committer']['name'] }
end
json.commit_message commit['commit']['message']
json.time_from_now time_from_now(commit['created'])
json.parent_shas commit['parents'].map{|x|x['sha']}
end

View File

@@ -0,0 +1,6 @@
json.(@project_dataset, :id, :title, :description, :license_id, :paper_content)
json.license_name @project_dataset&.license&.name
json.attachment_total_count @attachments.total_count
json.attachments @attachments do |at|
json.partial! "api/v1/attachments/detail", locals: {attachment: at}
end

View File

@@ -17,6 +17,7 @@ json.projects @projects do |project|
json.forked_from_project_id project.forked_from_project_id
json.open_devops project.open_devops?
json.platform project.platform
json.has_dataset project.has_menu_permission("dataset") && project.project_dataset.present?
json.author do
if project.educoder?
project_educoder = project.project_educoder

View File

@@ -36,7 +36,8 @@ json.setting do
json.subject_banner_url default_setting.subject_banner_url&.[](1..-1)
json.course_banner_url default_setting.course_banner_url&.[](1..-1)
json.competition_banner_url default_setting.competition_banner_url&.[](1..-1)
json.competition_banner_url EduSetting.get("competition_banner_url").to_s
json.competition_banner_href EduSetting.get("competition_banner_href").to_s
json.moop_cases_banner_url default_setting.moop_cases_banner_url&.[](1..-1)
json.oj_banner_url default_setting.oj_banner_url&.[](1..-1)

View File

@@ -16,6 +16,12 @@ json.user_login user&.login
json.image_url user.present? ? url_to_avatar(user) : ""
json.attachments do
json.array! version.try(:attachments) do |attachment|
json.partial! "attachments/attachment_simple", locals: {attachment: attachment}
# json.partial! "attachments/attachment_simple", locals: {attachment: attachment}
json.id attachment.id
json.title attachment.title
json.filesize number_to_human_size attachment.filesize
json.description attachment.description
json.is_pdf attachment.is_pdf?
json.url "/#{@owner.login}/#{@repository.identifier}/releases/download/#{version&.tag_name}/#{attachment.filename}"
end
end