Merge branch 'develop' into dev_newproject

This commit is contained in:
huang 2016-11-07 17:18:36 +08:00
commit 0ef3dbf5f8
3 changed files with 12 additions and 31 deletions

View File

@ -50,7 +50,7 @@ class AdminController < ApplicationController
cycle = params[:cycle] cycle = params[:cycle]
g = Gitlab.client g = Gitlab.client
users_results = [] users_results = []
User.first(13).each do |user| User.all.each do |user|
unless user.mail.nil? unless user.mail.nil?
user_mail = user.mail user_mail = user.mail
user.projects.where("gpid is not null").each do |project| user.projects.where("gpid is not null").each do |project|

View File

@ -73,35 +73,16 @@ class RepositoriesController < ApplicationController
def export_rep_static def export_rep_static
# 管理员界面导出所有项目 # 管理员界面导出所有项目
if params[:cycle] == "admin_week" || params[:cycle] == "admin_month" || params[:cycle] == "admin_all" @project = Project.find(params[:id])
if User.current.admin? gpid = @project.gpid
@project = Project.find(params[:id]) rev = params[:rev]
gpid = @project.gpid cycle = params[:cycle]
rev = params[:rev] respond_to do |format|
cycle = params[:cycle] format.html
cycle_name = (params[:cycle] == "admin_week" ? "每周" : (params[:cycle] == "admin_month" ? "每月" : "所有")) format.xls{
respond_to do |format| filename = "#{@project.name.to_s}_#{l(:label_rep_xls)}.xls"
format.html send_data(export_rep_xls(gpid, :rev => rev, :cycle => cycle), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
format.xls{ }
filename = "#{l(:label_user_rep_xls)}_#{l(:cycle_name)}_.xls"
send_data(admin_export_rep_xls(gpid, :rev => rev, :cycle => "1"), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
else
render_403
end
else
@project = Project.find(params[:id])
gpid = @project.gpid
rev = params[:rev]
cycle = params[:cycle]
respond_to do |format|
format.html
format.xls{
filename = "#{@project.name.to_s}_#{l(:label_rep_xls)}.xls"
send_data(export_rep_xls(gpid, :rev => rev, :cycle => cycle), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
end end
end end

View File

@ -93,7 +93,7 @@ module ApplicationHelper
end end
xls_report = StringIO.new xls_report = StringIO.new
book = Spreadsheet::Workbook.new book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "版本库" sheet1 = book.create_worksheet :name => l(:project_module_repository)
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue sheet1.row(0).default_format = blue
sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_changeset),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle),l(:rep_author_mail)]) sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_changeset),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle),l(:rep_author_mail)])