Sha256: eacc92a41f8047023813740ca32c6943e7c32b9d4dc6b50fc6f4d67ad488d6c5
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
module MultiHelper module View module LayoutMethods def show_content_if(content, &block) if content.present? yield(content) end end def table_block(options, &block) body = content_tag(:div, capture(&block), :class=> 'content') general_block(body, options.merge({:id => 'block-list', :class => 'block'})) end def list_block(options, &block) body = content_tag(:div, capture(&block), :class=> 'content') general_block(body, options.merge({:id => 'block-list', :class => 'block'})) end def text_block(options, &block) body = content_tag(:div, capture(&block), :class=> 'content') general_block(body, options.merge({:id => 'block-text', :class => 'block'})) end def sidebar_link(name, options = {}, html_options = nil) content_tag(:li, link_to(name, options, html_options)) end def navigation_block() render(:partial => 'shared/secondary_navigation') end private def general_block(content, options) options = {:nav => true}.merge(options) body = if options[:nav] navigation_block + render(:partial => 'shared/flash_messages') else "" end if options[:title].present? body += title_tag(options[:title]) options.delete(:title) end body += content concat(content_tag(:div, body, options)) end def title_tag(title) content_tag(:br) + content_tag(:h2, title, :class => 'title') end end end end ActionView::Base.send :include, MultiHelper::View::LayoutMethods
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lucasefe-multi_helper-0.0.1 | lib/multi_helper/view.rb |