Module: ControlCenter::Helpers

Defined in:
lib/helpers.rb

Overview

Helpers that control center uses

Instance Method Summary collapse

Instance Method Details

#current_sub_tabObject



28
29
30
# File 'lib/helpers.rb', line 28

def current_sub_tab
  @cc_current_sub_tab
end

#current_tabObject



13
14
15
# File 'lib/helpers.rb', line 13

def current_tab
  @cc_current_tab
end

#select_sub_tab(tab) ⇒ Object



25
26
27
# File 'lib/helpers.rb', line 25

def select_sub_tab(tab)
  @cc_current_sub_tab = tab
end

#select_tab(tab) ⇒ Object



10
11
12
# File 'lib/helpers.rb', line 10

def select_tab(tab)
  @cc_current_tab = tab
end

Sets up a sidebar in control center.



33
34
35
36
37
38
39
40
# File 'lib/helpers.rb', line 33

def sidebar(&block)
  if block_given?
    @sidebar_set = true
    content_for :sidebar do
      yield
    end
  end
end

#sidebar?Boolean

Returns:



42
43
44
45
# File 'lib/helpers.rb', line 42

def sidebar?
  @sidebar_set ||= false
  @sidebar_set
end

#sub_tab(tab_name, tab_url) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/helpers.rb', line 55

def sub_tab(tab_name, tab_url)
  options = {}
  options[:class] = "active" if  current_sub_tab == tab_name
   "li", options, true do
    link_to tab_name, tab_url
  end
end

#sub_tabsObject



17
18
19
20
21
22
23
# File 'lib/helpers.rb', line 17

def sub_tabs
  if block_given?
    content_for :sub_tabs do
      yield
    end
  end
end

#tab(tab_name, tab_url) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/helpers.rb', line 47

def tab(tab_name, tab_url)
  options = {}
  options[:class] = "active" if  current_tab == tab_name
   "li", options, true do
    link_to tab_name, tab_url
  end
end

#title(title) ⇒ Object



6
7
8
# File 'lib/helpers.rb', line 6

def title(title)
  @control_center_title = title
end