Sha256: 9e6017f9649db75cb1168da3d97020365122077df15429142f5495d070b2816f
Contents?: true
Size: 855 Bytes
Versions: 16
Compression:
Stored size: 855 Bytes
Contents
module Admix class Tab # include ActionView::Helpers::CaptureHelper # include ActionView::Helpers::TagHelper attr_reader :tab_id, :header, :content, :view_context, :options def initialize(view_context, tab_name, tab_id = nil, options={}, &block) @view_context ||= view_context @tab_id = "tab-#{tab_name}".parameterize.to_sym unless tab_id @tab_name = tab_name @options = options @header = view_context.content_tag :li, class: (options[:first] ? 'active' : '') do view_context.link_to(@tab_name, "##{@tab_id}") end @content = ''.html_safe yield(self) end def tab_header(&block) @header = block_given? ? @view_context.capture(&block) : '' end def tab_content(&block) @content = block_given? ? @view_context.capture(&block) : '' end end end
Version data entries
16 entries across 16 versions & 2 rubygems