Module: NsSettingsUi::SettingsHelper

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

Instance Method Summary collapse

Instance Method Details

#render_default_value_field(form, setting) ⇒ Object


13
14
15
# File 'app/helpers/ns_settings_ui/settings_helper.rb', line 13

def render_default_value_field(form, setting)
  render_field(form, setting.value_type, :default_value)
end

#render_value_field(form, setting) ⇒ Object


9
10
11
# File 'app/helpers/ns_settings_ui/settings_helper.rb', line 9

def render_value_field(form, setting)
  render_field(form, setting.value_type, :value, setting_value_class(setting))
end

#setting_value_class(setting) ⇒ Object


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

def setting_value_class(setting)
  return 'alert-danger' if setting.value.nil? || setting.value.empty?
  return 'alert-warning' if setting.value != setting.default_value
  ''
end