Permalink
Browse files

patched template query to handle HAML extensions

  • Loading branch information...
1 parent 7ae37c7 commit a540467639c55f2f8069a0d39ba36850879fe412 matthew committed Jul 16, 2008
View
@@ -1,3 +1,5 @@
+07/16/08 - patched template query to handle HAML extensions [Matthew Bass]
+
06/23/08 - added Sandro's patch for help text below edit fields [Matthew Bass]
06/16/08 - fixed partial rendering calls that had been missed during RC3 refactoring [Matthew Bass]
@@ -45,11 +45,15 @@ def managed_views
# Returns true if the given template exists under <tt>app/views</tt>.
# The template name can optionally include an extension. If an extension
- # is not provided, <tt>rhtml</tt> will be used by default.
+ # is not provided, <tt>rhtml</tt> and <tt>.html.haml</tt> will be used by default.
def specific_template_exists?(template)
template, extension = template.split('.')
path = File.join(RAILS_ROOT, "app/views", template)
- File.exist?("#{path}.#{extension || 'rhtml'}")
+ if extension.blank?
+ File.exist?("#{path}.rhtml") || File.exist?("#{path}.html.haml")
+ else
+ File.exist?("#{path}.#{extension}")
+ end
end
def convert_default_options(options)
@@ -6,6 +6,7 @@
it "specific template exists?" do
assert specific_template_exists?("templates/template")
+ assert specific_template_exists?("templates/haml_template")
assert specific_template_exists?("templates/template.rhtml")
assert specific_template_exists?("templates/template.rxml")
assert !specific_template_exists?("templates/template.rpdf")

0 comments on commit a540467

Please sign in to comment.