Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 1b4cf33adf
Fetching contributors…

Cannot retrieve contributors at this time

54 lines (44 sloc) 1.824 kb
# :include: README
# Library Files
module DynamicReports
@@default_view_paths = ["#{File::dirname(File::expand_path(__FILE__))}/dynamic_reports/views/"]
def self.default_view_paths
@@default_view_paths
end
def self.default_view_paths=(paths)
@@default_view_paths = paths
end
end
require "dynamic_reports/charts"
require "dynamic_reports/reports"
require "dynamic_reports/templates"
require "dynamic_reports/views"
require "dynamic_reports/vendor/google_chart"
# TODO: Figure out why this will not load:
# require "dynamic_reports/rails"
# For now placing the code right here:
if defined?(Rails)
# ath_to_lib = File.join(Rails.root, "app") #adjust if necessary
# path_to_tree = "#{path_to_lib}/reports"
# Dir["#{path_to_tree}/**/*.rb"].each { |fn|
# fn =~ /^#{Regexp.escape(path_to_lib)}\/(.*)\.rb$/
# require $1
# }
# Load all defined reports.
# Question: How to get Rails to reload files other than ones matching the requested constant...
#Dir.glob("#{File.join(Rails.root, "app", "reports")}/*.rb").each { |file| require file }
ActiveSupport::Dependencies.load_paths << File.join(Rails.root, "app", "reports")
# Question: Should we allow for report directory nesting ?
# Set default views directory
# TODO: These should be added to Rails views directories?
DynamicReports.default_view_paths += [
File.join(Rails.root, "app", "views", "reports"),
File.join(Rails.root, "app", "views", "layouts")
]
# TODO: Render extension
# TODO: AR extensions:
# has_report :daily, :columns => [...], :options => {...}, :title => ...
# Which will generate a report object DailyReport with the given definition.
# Everything after the name corresponds to options available in the configuration block.
# TODO: Generator
end
Jump to Line
Something went wrong with that request. Please try again.