Module: SystemSettings::ApplicationHelper

Defined in:
app/helpers/system_settings/application_helper.rb

Constant Summary collapse

SEPARATOR =
";"

Instance Method Summary collapse

Instance Method Details

#display_settings_file_pathObject



29
30
31
32
33
34
35
# File 'app/helpers/system_settings/application_helper.rb', line 29

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



6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/system_settings/application_helper.rb', line 6

def format_value(value)
  if value.respond_to?(:each)
    capture do
      value.each do |v|
        concat (:span, v, class: "value-part")
      end
    end
  else
    value
  end
end

#format_value_for_form(record) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/system_settings/application_helper.rb', line 18

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