merb-core 1.0.7 → 1.0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/merb-core/controller/mixins/render.rb +24 -20
- data/lib/merb-core/version.rb +1 -1
- metadata +2 -2
@@ -412,31 +412,35 @@ module Merb::RenderMixin
|
|
412
412
|
#
|
413
413
|
# :api: private
|
414
414
|
def _template_for(context, content_type, controller=nil, template=nil, locals=[])
|
415
|
-
self.class._templates_for[[context, content_type, controller, template, locals]]
|
416
|
-
|
417
|
-
template_method, template_location = nil, nil
|
415
|
+
tmp = self.class._templates_for[[context, content_type, controller, template, locals]]
|
416
|
+
return tmp if tmp
|
418
417
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
418
|
+
template_method, template_location = nil, nil
|
419
|
+
|
420
|
+
# absolute path to a template (:template => "/foo/bar")
|
421
|
+
if template.is_a?(String) && template =~ %r{^/}
|
422
|
+
template_location = self._absolute_template_location(template, content_type)
|
423
|
+
return [_template_method_for(template_location, locals), template_location]
|
424
|
+
end
|
424
425
|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
end
|
433
|
-
|
434
|
-
break if template_method = _template_method_for(template_location.to_s, locals)
|
426
|
+
self.class._template_roots.reverse_each do |root, template_meth|
|
427
|
+
# :template => "foo/bar.html" where root / "foo/bar.html.*" exists
|
428
|
+
if template
|
429
|
+
template_location = root / self.send(template_meth, template, content_type, nil)
|
430
|
+
# :layout => "foo" where root / "layouts" / "#{controller}.html.*" exists
|
431
|
+
else
|
432
|
+
template_location = root / self.send(template_meth, context, content_type, controller)
|
435
433
|
end
|
434
|
+
|
435
|
+
break if template_method = _template_method_for(template_location.to_s, locals)
|
436
|
+
end
|
436
437
|
|
437
|
-
|
438
|
-
|
438
|
+
# template_location is a Pathname
|
439
|
+
ret = [template_method, template_location.to_s]
|
440
|
+
unless Merb::Config[:reload_templates]
|
441
|
+
self.class._templates_for[[context, content_type, controller, template, locals]] = ret
|
439
442
|
end
|
443
|
+
ret
|
440
444
|
end
|
441
445
|
|
442
446
|
# Return the template method for a location, and check to make sure the current controller
|
data/lib/merb-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.7
|
4
|
+
version: 1.0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-31 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|