module Admin::ConfigurationHelper
def show_config(key, options = {})
=>
def show_config(key, options = {}) setting = setting_for(key) setting.valid? domkey = key.gsub(/\W/, '_') html = '' html << content_tag(:label, t("trusty_config.#{key}").titlecase, for: domkey) if setting.boolean? value = setting.checked? ? t('yes') : t('no') html << content_tag(:span, value, id: domkey, class: "#{value} #{options[:class]}") else value = setting.selected_value || setting.value html << content_tag(:span, value, id: domkey, class: options[:class]) end html << content_tag(:span, " #{t("units.#{setting.units}")}", class: 'units') if setting.units html << content_tag(:span, " #{t('warning')}: #{[setting.errors[:value]].flatten.first}", class: 'warning') if setting.errors.messages[:value].present? Rails.logger.error(html) html.html_safe end