module Tuning::Extensions::ActionView::Base

Public Instance Methods

active_trail?(path) click to toggle source
# File lib/tuning/extensions/action_view/base.rb, line 7
def active_trail?(path)
  (path == '/' && request.path == path) || request.path.start_with?(path)
end
content_tag_if(condition, name, options={}, &block) click to toggle source
# File lib/tuning/extensions/action_view/base.rb, line 11
def content_tag_if(condition, name, options={}, &block)
  if condition
    content_tag(name, options, &block)
  else
    capture(&block)
  end
end
extending(layout, &block) click to toggle source
# File lib/tuning/extensions/action_view/base.rb, line 19
def extending(layout, &block)
  if block_given?
    old_layout = @view_flow.get(:layout)
    new_layout = (capture(&block) || '')
    old_layout.replace(new_layout)
  end
  render file: "layouts/#{layout}"
end