Class: Card::LazyTab

Inherits:
Tab show all
Defined in:
card-mod-bootstrap/lib/card/lazy_tab.rb

Instance Attribute Summary

Attributes inherited from Tab

#format, #name

Instance Method Summary collapse

Methods inherited from Tab

#initialize, tab_objects

Constructor Details

This class inherits a constructor from Card::Tab

Instance Method Details

#button_attribObject



19
20
21
# File 'card-mod-bootstrap/lib/card/lazy_tab.rb', line 19

def button_attrib
  @button_attrib ||= super.merge("data-url" => url.html_safe)
end

#contentObject



28
29
30
# File 'card-mod-bootstrap/lib/card/lazy_tab.rb', line 28

def content
  @content ||= ""
end

#tab_buttonObject



11
12
13
14
15
16
17
# File 'card-mod-bootstrap/lib/card/lazy_tab.rb', line 11

def tab_button
  if url
    super
  else
    wrap_with(:li, label, role: "presentation")
  end
end


23
24
25
26
# File 'card-mod-bootstrap/lib/card/lazy_tab.rb', line 23

def tab_button_link
  add_class button_attrib, "load" unless active?
  super
end

#tab_pane(args = nil, &block) ⇒ Object



32
33
34
35
# File 'card-mod-bootstrap/lib/card/lazy_tab.rb', line 32

def tab_pane args=nil, &block
  @content = yield if active? && block_given?
  super
end

#urlObject



3
4
5
# File 'card-mod-bootstrap/lib/card/lazy_tab.rb', line 3

def url
  @url ||= (config_hash? && @config[:path]) || format.path(view: view)
end

#viewObject



7
8
9
# File 'card-mod-bootstrap/lib/card/lazy_tab.rb', line 7

def view
  @view ||= (config_hash? && @config[:view]) || @config
end