Module: Tuning::Extensions::ActionView::Base

Extended by:
ActiveSupport::Concern
Defined in:
lib/tuning/extensions/action_view/base.rb

Instance Method Summary collapse

Instance Method Details

#active_trail?(path) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# 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) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/tuning/extensions/action_view/base.rb', line 11

def (condition, name, options={}, &block)
  if condition
    (name, options, &block)
  else
    capture(&block)
  end
end

#extending(layout, &block) ⇒ Object



19
20
21
22
23
24
25
26
# 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