Module: ControlCenter::Helpers
- Defined in:
- lib/helpers.rb
Overview
Helpers that control center uses
Instance Method Summary collapse
- #current_sub_tab ⇒ Object
- #current_tab ⇒ Object
- #select_sub_tab(tab) ⇒ Object
- #select_tab(tab) ⇒ Object
-
#sidebar(&block) ⇒ Object
Sets up a sidebar in control center.
- #sidebar? ⇒ Boolean
- #sub_tab(tab_name, tab_url) ⇒ Object
- #sub_tabs ⇒ Object
- #tab(tab_name, tab_url) ⇒ Object
- #title(title) ⇒ Object
Instance Method Details
#current_sub_tab ⇒ Object
28 29 30 |
# File 'lib/helpers.rb', line 28 def current_sub_tab @cc_current_sub_tab end |
#current_tab ⇒ Object
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 |
#sidebar(&block) ⇒ Object
Sets up a sidebar in control center.
33 34 35 36 37 38 39 40 |
# File 'lib/helpers.rb', line 33 def (&block) if block_given? @sidebar_set = true content_for :sidebar do yield end end end |
#sidebar? ⇒ Boolean
42 43 44 45 |
# File 'lib/helpers.rb', line 42 def @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) = {} [:class] = "active" if current_sub_tab == tab_name content_tag "li", , true do link_to tab_name, tab_url end end |
#sub_tabs ⇒ Object
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) = {} [:class] = "active" if current_tab == tab_name content_tag "li", , 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 |