里程碑加入导出excel功能

This commit is contained in:
daiao 2016-09-22 08:40:41 +08:00
parent 2ae7dd0087
commit c37c880eb2
2 changed files with 9 additions and 2 deletions

View File

@ -54,7 +54,6 @@ class VersionsController < ApplicationController
@versions = @versions.slice(@offset, @limit)
#end by young
@issues_by_version = {}
if @selected_tracker_ids.any? && @versions.any?
issues = Issue.visible.all(
@ -81,6 +80,14 @@ class VersionsController < ApplicationController
all
}
format.api
format.xls {
@issues = @version.fixed_issues.visible.
includes(:status, :tracker, :priority).
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
all
filename = "#{@version.name.to_s}_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
end

View File

@ -57,10 +57,10 @@
<div class="roadmap_list">
<p class="f14 mb5">&#187;<%= l(:label_versions_description)%></p>
<p><%=h version.description %></p>
<p class="f14 mb5">&#187;<%= link_to "导出XLS", version_path(version, :format => 'xls') %></p>
</div><!--roadmap_list end-->
</div><!--roadmap_box end-->
<% end %>
<ul class="wlist" >
<%= pagination_links_full @versions_pages%>
</ul>