Module: PreferencesHelper

Defined in:
app/helpers/preferences_helper.rb

Instance Method Summary collapse

Instance Method Details

#pref(model, pref_name, &block) ⇒ Object


3
4
5
6
7
8
9
# File 'app/helpers/preferences_helper.rb', line 3

def pref(model, pref_name, &block)
  s = (:label, Preference.human_attribute_name(pref_name), :for => model+pref_name)
  s << "<br/>".html_safe
  s << yield
  s << "<br/><br/>".html_safe
  s
end

#pref_with_select_field(model, pref_name, collection = [ [t('preferences.is_true'),true], [t('preferences.is_false'), false] ]) ⇒ Object


11
12
13
# File 'app/helpers/preferences_helper.rb', line 11

def pref_with_select_field(model, pref_name, collection = [ [t('preferences.is_true'),true], [t('preferences.is_false'), false] ])
  pref(model, pref_name) { select(model, pref_name, collection) }
end

#pref_with_text_field(model, pref_name) ⇒ Object


15
16
17
# File 'app/helpers/preferences_helper.rb', line 15

def pref_with_text_field(model, pref_name)
  pref(model, pref_name) { text_field(model, pref_name) }
end