Module: Settr::SettingsHelper

Defined in:
app/helpers/settr/settings_helper.rb

Instance Method Summary collapse

Instance Method Details

#hash_depth(hash) ⇒ Object



14
15
16
17
# File 'app/helpers/settr/settings_helper.rb', line 14

def hash_depth(hash)
  hashes = hash.values.select{|h| h.is_a?(Hash)}
  hashes.present? ? hashes.map{|h| hash_depth(h)}.max + 1 : 1
end

#header(content) ⇒ Object



3
4
5
6
# File 'app/helpers/settr/settings_helper.rb', line 3

def header(content)
  html_options = Settr.header_class ? {:class => Settr.header_class} : {}
  (Settr.header_tag.to_sym, content, html_options)
end


8
9
10
11
12
# File 'app/helpers/settr/settings_helper.rb', line 8

def link(body, url, html_options = {})
  options = Settr.link_class ? {:class => Settr.link_class} : {}
  options.update(html_options)
  link_to(body, url, options)
end