Module: Tuning::Extensions::ActionView::Base
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/tuning/extensions/action_view/base.rb
Instance Method Summary collapse
- #active_trail?(path) ⇒ Boolean
- #content_tag_if(condition, name, options = {}, &block) ⇒ Object
- #extending(layout, &block) ⇒ Object
Instance Method Details
#active_trail?(path) ⇒ 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 content_tag_if(condition, name, ={}, &block) if condition content_tag(name, , &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 |