Module: Refinery::Admin::SettingsHelper

Defined in:
app/helpers/refinery/admin/settings_helper.rb

Instance Method Summary collapse

Instance Method Details

#form_value_typeObject



4
5
6
# File 'app/helpers/refinery/admin/settings_helper.rb', line 4

def form_value_type
  @setting.form_value_type.presence || 'text_area'
end

#setting_field(f, help) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/refinery/admin/settings_helper.rb', line 16

def setting_field(f, help)
  case form_value_type
  when 'check_box'
    raw "#{f.check_box :value, :value => @setting.form_value}
         #{f.label :value, help.presence || t('enabled', :scope => 'refinery.admin.settings.form'),
                   :class => 'stripped'}"
  else
    f.text_area :value, :value => @setting.form_value,
                :class => 'widest', :rows => 5
  end
end

#setting_title(f) ⇒ Object



8
9
10
11
12
13
14
# File 'app/helpers/refinery/admin/settings_helper.rb', line 8

def setting_title(f)
  if @setting.form_value_type == 'check_box'
    raw "<h3>#{@setting.name.to_s.titleize}?</h3>"
  else
    f.label :value
  end
end