Sha256: 3fbcc4ceceb59b1ded5b365d93756f395626f0ef33435ae5fdc26c2b3f6b1394

Contents?: true

Size: 842 Bytes

Versions: 28

Compression:

Stored size: 842 Bytes

Contents

module Workarea
  module Admin
    module SettingsHelper
      def sanitize_config_value(value)
        return if value.blank? && value.to_s != 'false'

        case value
        when ActiveSupport::Duration
          amount, unit = value.parts.first.reverse
          duration = pluralize(amount, unit.to_s.singularize)
          tag.code html_escape(duration), class: 'code code--block'
        when SwappableList
          tag.pre data: { expandable: '' } do
            tag.code JSON.pretty_generate(value.to_a), class: 'code code--block'
          end
        when Hash, Array
          tag.pre data: { expandable: '' } do
            tag.code JSON.pretty_generate(value), class: 'code code--block'
          end
        else
          tag.code html_escape(value.to_s), class: 'code code--block'
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.26 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.25 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.23 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.22 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.21 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.20 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.19 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.18 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.17 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.16 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.15 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.14 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.13 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.12 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.11 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.10 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.9 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.8 app/helpers/workarea/admin/settings_helper.rb
workarea-admin-3.5.7 app/helpers/workarea/admin/settings_helper.rb