Module: Wagons::ViewHelper
- Defined in:
- lib/wagons/view_helper.rb
Instance Method Summary collapse
-
#current_template_folder ⇒ Object
The folder of the current partial relative to app/views.
-
#extension_folders ⇒ Object
The view folders relative to app/views in which extensions are searched for.
-
#render_extensions(key, options = {}) ⇒ Object
Renders all partials with names that match “_[ key ]_*.[ format ].[ handler ]” in alphabetical order.
Instance Method Details
#current_template_folder ⇒ Object
The folder of the current partial relative to app/views
21 22 23 |
# File 'lib/wagons/view_helper.rb', line 21 def current_template_folder @virtual_path[/(.+)\/.*/, 1] end |
#extension_folders ⇒ Object
The view folders relative to app/views in which extensions are searched for. Uses the folder of the current template.
16 17 18 |
# File 'lib/wagons/view_helper.rb', line 16 def extension_folders [current_template_folder] end |
#render_extensions(key, options = {}) ⇒ Object
Renders all partials with names that match “_[ key ]_*.[ format ].[ handler ]” in alphabetical order. Accepts an additional option :folder to pass an additional folder to search extension partials in.
7 8 9 10 11 12 |
# File 'lib/wagons/view_helper.rb', line 7 def render_extensions(key, = {}) extensions = find_extension_partials(key, .delete(:folder)).map do |partial| render .merge(:partial => partial) end safe_join(extensions) end |