some
[appoyo.git] / vendor / plugins / facebooker / lib / facebooker / rails / extensions / action_view.rb
blob529ac8d8ea7fd172f3b1bc6b60f6d5be478a7761
1 class ActionView::PathSet
3   # Try to find fbml version if the format is fbjs
4   def find_template_with_facebooker(original_template_path, format = nil, html_fallback = true)
5     find_template_without_facebooker(original_template_path, format, html_fallback)
6   rescue ActionView::MissingTemplate
7     template_path = original_template_path.sub(/^\//, '')
9     each do |load_path|
10      if format == :fbjs && html_fallback && template = load_path["#{template_path}.#{I18n.locale}.fbml"]
11         return template
12       elsif format == :fbjs && html_fallback && template = load_path["#{template_path}.fbml"]
13         return template
14       end
16       raise MissingTemplate.new(self, original_template_path, format)
17     end
18   end
20   alias_method_chain :find_template, :facebooker
21 end