Module: SettingsHelper

Defined in:
app/helpers/settings_helper.rb

Instance Method Summary collapse

Instance Method Details

#short_cat(category) ⇒ Object


23
24
25
# File 'app/helpers/settings_helper.rb', line 23

def short_cat category
  category.gsub(/Setting::/,'')
end

#show_value(setting) ⇒ Object


12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/settings_helper.rb', line 12

def show_value setting
  case setting.settings_type
  when "array"
    "[ " + setting.value.join(", ") + " ]"
  else
    setting.value
  end
rescue
  setting.value
end

#value(setting) ⇒ Object


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

def value setting
  case setting.settings_type
  when "boolean"
    edit_select(setting, :value, {:select_values => {:true => "true", :false => "false"}.to_json } )
  else
    edit_textfield(setting, :value,{:helper => :show_value})
  end
end