Module: SystemSettings::ApplicationHelper
- Defined in:
- app/helpers/system_settings/application_helper.rb
Constant Summary collapse
- SEPARATOR =
";".freeze
Instance Method Summary collapse
- #display_settings_file_path ⇒ Object
- #format_value(value) ⇒ Object
- #format_value_for_form(record) ⇒ Object
Instance Method Details
#display_settings_file_path ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/helpers/system_settings/application_helper.rb', line 27 def display_settings_file_path if SystemSettings.settings_file_path.to_s.include?(Rails.root.to_s) Pathname.new(SystemSettings.settings_file_path).relative_path_from(Rails.root) else SystemSettings.settings_file_path end end |
#format_value(value) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/system_settings/application_helper.rb', line 4 def format_value(value) if value.respond_to?(:each) capture do value.each do |v| concat content_tag(:span, v, class: "value-part") end end else value end end |
#format_value_for_form(record) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/system_settings/application_helper.rb', line 16 def format_value_for_form(record) case record when SystemSettings::StringListSetting record.value.map { |v| v.gsub(SEPARATOR, "\\#{SEPARATOR}") }.join(SEPARATOR) when SystemSettings::IntegerListSetting, SystemSettings::DecimalListSetting record.value.join(SEPARATOR) else record.value end end |