Fix module namespaces

pull/6827/head
Michael Frister 11 years ago committed by Michael Frister
parent 2eaf168c26
commit fc112adc42
  1. 4
      lib/open_project/xls_export/filename_helper.rb
  2. 4
      lib/open_project/xls_export/filter_settings_helper.rb
  3. 7
      lib/open_project/xls_export/patches/issues_controller_patch.rb
  4. 7
      lib/open_project/xls_export/spreadsheet_builder.rb

@ -1,7 +1,9 @@
class FilenameHelper
module OpenProject::XlsExport
class FilenameHelper
# Remove characters that could cause problems on popular OSses
# => A string that does not start with a space or dot and does not contain any of \/:*?"<>|
def self.sane_filename(str)
str.gsub(/^[ \.]/,"").gsub(/[\\\/:\*\?"<>|"]/, "_")
end
end
end

@ -1,4 +1,5 @@
class FilterSettingsHelper
module OpenProject::XlsExport
class FilterSettingsHelper
class << self
def group_by_setting(query)
I18n.t("field_#{query.group_by.to_s.gsub(/\_id$/, "")}") if query.group_by
@ -24,4 +25,5 @@ class FilterSettingsHelper
end.compact
end
end
end
end

@ -2,7 +2,8 @@
#require_dependency 'xls_report/spreadsheet_builder'
#require_dependency 'additional_formats/filter_settings_helper'
module OpenProject::XlsExport::Patches
module OpenProject::XlsExport
module Patches
module IssuesControllerPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
@ -20,7 +21,7 @@ module OpenProject::XlsExport::Patches
super do |format|
yield format
format.xls do
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
@issues = @query.issues(:include => [:assigned_to, :type, :priority, :category, :fixed_version],
:order => sort_clause)
unless @issues.empty?
send_data(issues_to_xls, :type => "application/vnd.ms-excel",
@ -36,6 +37,7 @@ module OpenProject::XlsExport::Patches
# Convert an issues query with associated issues to xls using the queries columns as headers
def build_spreadsheet(project, issues, query)
columns = query.columns
sb = SpreadsheetBuilder.new
project_name = (project.name if project) || "All Projects"
sb.add_title("#{project_name} >> #{l(:label_issue_plural)} (#{format_date(Date.today)})")
@ -78,4 +80,5 @@ module OpenProject::XlsExport::Patches
end
end
end
end
end

@ -11,7 +11,9 @@ require 'spreadsheet'
# If a worksheet with an index larger than the number of worksheets is requested,
# a new worksheet is created.
#
class SpreadsheetBuilder
module OpenProject::XlsExport
class SpreadsheetBuilder
Worksheet = Struct.new(:sheet, :column_widths) unless defined? Worksheet
@ -164,7 +166,7 @@ class SpreadsheetBuilder
io.read
end
private
private
def raw_xls
@xls
end
@ -172,4 +174,5 @@ private
def raw_sheet
@sheet
end
end
end

Loading…
Cancel
Save