Module: LybSidebar::Helper

Defined in:
lib/lyb_sidebar/helper.rb

Instance Method Summary collapse

Instance Method Details

#prepare_sidebarsObject

Sidebar



18
19
20
21
22
23
24
# File 'lib/lyb_sidebar/helper.rb', line 18

def prepare_sidebars
  return if controller.sidebars.nil?
  
  for partial in controller.sidebars
    render partial
  end
end

#render_sidebarObject



26
27
28
# File 'lib/lyb_sidebar/helper.rb', line 26

def render_sidebar
  content_for :sidebar
end

#render_sidebarsObject



30
31
32
33
# File 'lib/lyb_sidebar/helper.rb', line 30

def render_sidebars
  prepare_sidebars
  render_sidebar
end


11
12
13
14
15
# File 'lib/lyb_sidebar/helper.rb', line 11

def sidebar_tag_filter
  content_for :sidebar do
    tag_filter
  end
end

#tag_filter(model = nil, filters = nil, scope = :tagged_with) ⇒ Object

Tag support



4
5
6
7
8
9
# File 'lib/lyb_sidebar/helper.rb', line 4

def tag_filter(model = nil, filters = nil, scope = :tagged_with)
  model ||= controller_name.singularize.camelize.constantize
  filters ||= model.top_tags

  render 'layouts/tag_filter', :filters => filters, :scope => scope
end