Module: SettingsHelper

Defined in:
lib/settings/lib/settings_helper.rb

Instance Method Summary collapse

Instance Method Details

#boolean_setting(s) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/settings/lib/settings_helper.rb', line 16

def boolean_setting(s)
  %Q{
    #{s.inspect}
    <div class="controls">
      <label class="checkbox">
        <input type="checkbox" name="#{s['name']}" #{s['default'] ? 'checked' : ''}">
        #{s['label']}
      </label>
    </div>
  }
end

#integer_setting(s) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/settings/lib/settings_helper.rb', line 6

def integer_setting(s)
  %Q{
    <label class="control-label" for="#{s['name']}">#{s['label']}</label>
    <div class="controls">
      <input type="text" name="#{s['name']}" placeholder="#{s['default']}">
      <span class="help-block">#{s['hint']}</span>
    </div>
  }
end

#setting(setting) ⇒ Object



2
3
4
# File 'lib/settings/lib/settings_helper.rb', line 2

def setting(setting)
  send "#{setting['type']}_setting", setting
end