Merge branch 'release/4.3' into feature/rails4

pull/6827/head
Alex Coles 9 years ago
commit be589a5898
  1. 6
      lib/open_project/xls_export/patches/work_packages_controller_patch.rb
  2. 2
      spec/patches/work_packages_controller_patch_spec.rb

@ -39,7 +39,7 @@ module OpenProject::XlsExport
sb = SpreadsheetBuilder.new("#{I18n.t(:label_work_package_plural)}") sb = SpreadsheetBuilder.new("#{I18n.t(:label_work_package_plural)}")
formatters = OpenProject::XlsExport::Formatters.for_columns(columns) formatters = OpenProject::XlsExport::Formatters.for_columns(columns)
headers = columns.collect(&:caption).unshift("#") headers = columns.collect(&:caption)
headers << WorkPackage.human_attribute_name(:description) if options[:show_descriptions] headers << WorkPackage.human_attribute_name(:description) if options[:show_descriptions]
sb.add_headers headers, 0 sb.add_headers headers, 0
@ -48,14 +48,14 @@ module OpenProject::XlsExport
cv = formatters[column].format work_package, column cv = formatters[column].format work_package, column
cv = cv.in_time_zone(current_user.time_zone) if cv.is_a?(ActiveSupport::TimeWithZone) cv = cv.in_time_zone(current_user.time_zone) if cv.is_a?(ActiveSupport::TimeWithZone)
(cv.respond_to? :name) ? cv.name : cv (cv.respond_to? :name) ? cv.name : cv
end).unshift(work_package.id) end)
row << work_package.description if options[:show_descriptions] row << work_package.description if options[:show_descriptions]
sb.add_row(row) sb.add_row(row)
end end
columns.each_with_index do |column, i| columns.each_with_index do |column, i|
options = formatters[column].format_options column options = formatters[column].format_options column
sb.add_format_option_to_column i + 1, options sb.add_format_option_to_column i, options
end end
sb sb

@ -100,7 +100,7 @@ describe WorkPackagesController, "rendering to xls", :type => :controller do
it 'should include estimated hours' do it 'should include estimated hours' do
expect(@sheet.rows.size).to eq(4 + 1) expect(@sheet.rows.size).to eq(4 + 1)
hours = @sheet.rows.last.values_at(3) hours = @sheet.rows.last.values_at(2)
expect(hours).to include(27.5) expect(hours).to include(27.5)
end end
end end

Loading…
Cancel
Save