Module: Golden::Theme::Foundation::TabsHelper

Defined in:
lib/golden/theme/foundation/tabs_helper.rb

Instance Method Summary collapse

Instance Method Details

#foundation_remote_tab_nav(text, url, tag_id, default) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/golden/theme/foundation/tabs_helper.rb', line 35

def foundation_remote_tab_nav text, url, tag_id, default
  active = current_page?(url) || tag_id == default
  dd_class = 'active' if active
  options = {
    remote: true,
    data: {
      toggle: 'tab',
      target: "##{tag_id}",
      type: 'html'
    }
  }
  [ link_to(text, url, options), { class: dd_class } ]
end

#foundation_remote_tab_pane(url, tag_id, default) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/golden/theme/foundation/tabs_helper.rb', line 49

def foundation_remote_tab_pane url, tag_id, default
  active = current_page?(url) || tag_id == default
  tab_class = 'content'
  tab_class << ' active' if active
   :div, class: tab_class, id: tag_id do
    yield active if block_given?
  end
end

#foundation_tab_nav(text, tag_id, default) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/golden/theme/foundation/tabs_helper.rb', line 14

def foundation_tab_nav text, tag_id, default
  active = tag_id == default
  dd_class = 'active' if active
  options = {
    data: {
      toggle: 'tab',
      target: "##{tag_id}"
    }
  }
  [ link_to(text, "##{tag_id}", options), { class: dd_class } ]
end

#foundation_tab_pane(tag_id, default) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/golden/theme/foundation/tabs_helper.rb', line 26

def foundation_tab_pane tag_id, default
  active = tag_id == default
  tab_class = 'content'
  tab_class << ' active' if active
   :div, class: tab_class, id: tag_id do
    yield active if block_given?
  end
end

#foundation_tabs(options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/golden/theme/foundation/tabs_helper.rb', line 3

def foundation_tabs options = {}, &block
  html_class = options.delete :class
  options = {
    class: "tabs #{html_class}".strip,
    data: {
      tab: true
    }
  }.deep_merge options
  foundation_dl_tag options, &block
end