lib/brochure/application.rb in brochure-0.5.1 vs lib/brochure/application.rb in brochure-0.5.2
- old
+ new
@@ -1,16 +1,17 @@
module Brochure
class Application
- attr_reader :app_root, :template_root, :asset_root, :plugin_root, :assigns
+ attr_reader :app_root, :template_root, :asset_root, :plugin_root, :assigns, :template_options
def initialize(root, options = {})
@app_root = File.expand_path(root)
@template_root = File.join(@app_root, "templates")
@asset_root = File.join(@app_root, "public")
@plugin_root = File.join(@app_root, "vendor", "plugins")
@assigns = options[:assigns] || {}
+ @template_options = options[:template_options] || {}
helpers.push(*options[:helpers]) if options[:helpers]
initialize_plugins
end
def initialize_plugins
@@ -74,10 +75,14 @@
template_trail.find(logical_path, logical_path + format_extension, logical_path + "/index" + format_extension)
end
def find_partial_path(logical_path, format_extension)
dirname, basename = File.split(logical_path)
- partial_path = File.join(dirname, "_" + basename)
+ if dirname == "."
+ partial_path = "_" + basename
+ else
+ partial_path = File.join(dirname, "_" + basename)
+ end
template_trail.find(partial_path, partial_path + format_extension)
end
def template_for(template_path)
if Brochure.development?