admin中添加导出所有项目统计

This commit is contained in:
huang 2016-11-02 15:33:42 +08:00
parent 9d15052486
commit 928412e83d
3 changed files with 30 additions and 10 deletions

View File

@ -72,6 +72,15 @@ class RepositoriesController < ApplicationController
end end
def export_rep_static def export_rep_static
# 管理员界面导出所有项目
if params[:cycle] == "admin_week" || params[:cycle] == "admin_month" || params[:cycle] == "admin_all"
if User.current.admin
projects = Project.where(:gpid => !nil)
else
render_403
end
else
@project = Project.find(params[:id]) @project = Project.find(params[:id])
gpid = @project.gpid gpid = @project.gpid
rev = params[:rev] rev = params[:rev]
@ -84,6 +93,7 @@ class RepositoriesController < ApplicationController
} }
end end
end end
end
def forked def forked
@project = Project.find(params[:id]) @project = Project.find(params[:id])

View File

@ -115,6 +115,11 @@ module ApplicationHelper
xls_report.string xls_report.string
end end
# 管理员界面导出所有项目代码、提交次数统计
def admin_export_rep_xls
end
# 项目issue列表导出Excel功能 # 项目issue列表导出Excel功能
def issue_list_xls issues def issue_list_xls issues
xls_report = StringIO.new xls_report = StringIO.new

View File

@ -77,6 +77,11 @@
</div> </div>
<% html_title(l(:label_project_plural)) -%> <% html_title(l(:label_project_plural)) -%>
<div class="fr">项目代码/提交数统计:
<%= link_to "最近一周", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "admin_week" }, :class => "linkBlue2" %> <a style="color: #7f7f7f;">|</a>
<%= link_to "最近一月", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "admin_month" }, :class => "linkBlue2" %>
<%= link_to "所有", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "admin_all" }, :class => "linkBlue2" %>
</div>
<script> <script>
function delcfm() { function delcfm() {