Module: AbstractInterface::ControllerHelper
- Defined in:
- lib/abstract_interface/controller_helper.rb
Constant Summary collapse
- TEMPLATE_EXTENSIONS =
['html.haml', 'html.erb']
Instance Method Summary collapse
Instance Method Details
#current_theme ⇒ Object
26 27 28 |
# File 'lib/abstract_interface/controller_helper.rb', line 26 def current_theme @current_theme ||= AbstractInterface::Theme.new end |
#themed_partial(partial) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/abstract_interface/controller_helper.rb', line 18 def themed_partial partial if themed_partial_exist? partial "/themes/#{current_theme.name}/#{partial}_t" else "/themes/default/#{partial}_t" end end |
#themed_partial_exist?(partial) ⇒ Boolean
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/abstract_interface/controller_helper.rb', line 5 def themed_partial_exist? partial partial = partial + "_t" partial_fname = if pos = partial.index('/') partial.clone.insert(pos + 1, '_') else "_#{partial}" end TEMPLATE_EXTENSIONS.any?{|ext| File.exist? "#{AbstractInterface.themes_dir}/#{current_theme.name}/#{partial_fname}.#{ext}"} end |