Class: ActionView::Base
- Inherits:
-
Object
- Object
- ActionView::Base
- Defined in:
- lib/plugems/plugem_view_support.rb
Class Method Summary collapse
- .plugin_layouts ⇒ Object
- .plugin_template(file_name) ⇒ Object
-
.plugin_templates ⇒ Object
This is cached, and maybe should not be cached in development mode.
Instance Method Summary collapse
- #full_template_path(template_path, extension) ⇒ Object
- #lookup_full_template_path(template_path, extension) ⇒ Object
Class Method Details
.plugin_layouts ⇒ Object
42 43 44 |
# File 'lib/plugems/plugem_view_support.rb', line 42 def self.plugin_layouts plugin_templates.select {|dir| dir =~ /views\/layouts/ } end |
.plugin_template(file_name) ⇒ Object
38 39 40 |
# File 'lib/plugems/plugem_view_support.rb', line 38 def self.plugin_template(file_name) plugin_templates.select {|dir| dir =~ /#{file_name}/ } end |
.plugin_templates ⇒ Object
This is cached, and maybe should not be cached in development mode.
32 33 34 35 36 |
# File 'lib/plugems/plugem_view_support.rb', line 32 def self.plugin_templates # Note: This does support symlinks (top-level) vendor/plugins/acts_as_funky_chicken, # but not vendor/plugins/acts/acts_as_funky_bacon (Plugems::Loader.gem_views + Plugems::Loader.plugin_views).flatten.uniq end |
Instance Method Details
#full_template_path(template_path, extension) ⇒ Object
19 20 21 |
# File 'lib/plugems/plugem_view_support.rb', line 19 def full_template_path(template_path, extension) TemplateCache.cache[ [template_path, extension] ] ||= lookup_full_template_path(template_path, extension) end |
#lookup_full_template_path(template_path, extension) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/plugems/plugem_view_support.rb', line 23 def lookup_full_template_path(template_path, extension) default_template = "#{@base_path}/#{template_path}.#{extension}" return default_template if File.exist?(default_template) plugin_views = self.class.plugin_template("#{template_path}.#{extension}") return plugin_views.first || default_template end |