Class: Admix::Tab
- Inherits:
-
Object
- Object
- Admix::Tab
- Defined in:
- app/helpers/admix/tab.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper.
-
#header ⇒ Object
readonly
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper.
-
#options ⇒ Object
readonly
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper.
-
#tab_id ⇒ Object
readonly
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper.
-
#view_context ⇒ Object
readonly
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper.
Instance Method Summary collapse
-
#initialize(view_context, tab_name, tab_id = nil, options = {}) {|_self| ... } ⇒ Tab
constructor
A new instance of Tab.
- #tab_content(&block) ⇒ Object
- #tab_header(&block) ⇒ Object
Constructor Details
#initialize(view_context, tab_name, tab_id = nil, options = {}) {|_self| ... } ⇒ Tab
Returns a new instance of Tab.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/admix/tab.rb', line 9 def initialize(view_context, tab_name, tab_id = nil, ={}, &block) @view_context ||= view_context @tab_id = "tab-#{tab_name}".parameterize.to_sym unless tab_id @tab_name = tab_name @options = @header = view_context.content_tag :li, class: ([:first] ? 'active' : '') do view_context.link_to(@tab_name, "##{@tab_id}") end @content = ''.html_safe yield(self) end |
Instance Attribute Details
#content ⇒ Object (readonly)
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper
7 8 9 |
# File 'app/helpers/admix/tab.rb', line 7 def content @content end |
#header ⇒ Object (readonly)
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper
7 8 9 |
# File 'app/helpers/admix/tab.rb', line 7 def header @header end |
#options ⇒ Object (readonly)
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper
7 8 9 |
# File 'app/helpers/admix/tab.rb', line 7 def @options end |
#tab_id ⇒ Object (readonly)
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper
7 8 9 |
# File 'app/helpers/admix/tab.rb', line 7 def tab_id @tab_id end |
#view_context ⇒ Object (readonly)
include ActionView::Helpers::CaptureHelper include ActionView::Helpers::TagHelper
7 8 9 |
# File 'app/helpers/admix/tab.rb', line 7 def view_context @view_context end |
Instance Method Details
#tab_content(&block) ⇒ Object
28 29 30 |
# File 'app/helpers/admix/tab.rb', line 28 def tab_content(&block) @content = block_given? ? @view_context.capture(&block) : '' end |
#tab_header(&block) ⇒ Object
24 25 26 |
# File 'app/helpers/admix/tab.rb', line 24 def tab_header(&block) @header = block_given? ? @view_context.capture(&block) : '' end |