[ADD]增加下载文件接口
This commit is contained in:
parent
5447d54d30
commit
47cc70f2c5
|
@ -1,4 +1,13 @@
|
||||||
class ApplySignaturesController < ApplicationController
|
class ApplySignaturesController < ApplicationController
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
def template_file
|
||||||
|
license = License.find_by_name("PHengLET")
|
||||||
|
file = license.attachments.take
|
||||||
|
normal_status(-1, "文件不存在") if file.blank?
|
||||||
|
send_file(absolute_path(local_path(file)), filename: file.title,stream:false, type: file.content_type.presence || 'application/octet-stream')
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -153,7 +153,7 @@ class ProjectsController < ApplicationController
|
||||||
private
|
private
|
||||||
def project_params
|
def project_params
|
||||||
params.permit(:user_id, :name, :description, :repository_name,
|
params.permit(:user_id, :name, :description, :repository_name,
|
||||||
:project_category_id, :project_language_id, :license_id, :ignore_id)
|
:project_category_id, :project_language_id, :license_id, :ignore_id, :private)
|
||||||
end
|
end
|
||||||
|
|
||||||
def mirror_params
|
def mirror_params
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||||
<td><%= project.id %></td>
|
<td><%= project.id %></td>
|
||||||
<td class="text-left">
|
<td class="text-left">
|
||||||
<%= link_to(project.name, "/projects/#{project.owner.login}/#{project.identifier}", target: '_blank') %>
|
<%= link_to(project.name, "/projects/#{project.owner&.login}/#{project.identifier}", target: '_blank') %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= project.is_public ? '√' : '' %></td>
|
<td><%= project.is_public ? '√' : '' %></td>
|
||||||
<td><%= project.is_secret ? '√' : '' %></td>
|
<td><%= project.is_secret ? '√' : '' %></td>
|
||||||
|
|
|
@ -59,7 +59,11 @@ Rails.application.routes.draw do
|
||||||
delete :destroy_files
|
delete :destroy_files
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :apply_signatures, only: [:create]
|
resources :apply_signatures, only: [:create] do
|
||||||
|
collection do
|
||||||
|
get :template_file
|
||||||
|
end
|
||||||
|
end
|
||||||
get 'home/index'
|
get 'home/index'
|
||||||
get 'home/search'
|
get 'home/search'
|
||||||
get 'main/first_stamp'
|
get 'main/first_stamp'
|
||||||
|
|
Loading…
Reference in New Issue