module CmAdmin::ViewHelpers::FieldDisplayHelper
def show_field_value(ar_object, field)
def show_field_value(ar_object, field) content_tag(:div, class: "info-split__rhs") do case field.field_type || :string when :integer ar_object.send(field.field_name).to_s when :decimal ar_object.send(field.field_name).to_f.round(field.precision).to_s if ar_object.send(field.field_name) when :string ar_object.send(field.field_name).to_s when :datetime ar_object.send(field.field_name).strftime(field.format || "%d/%m/%Y").to_s if ar_object.send(field.field_name) when :text ar_object.send(field.field_name) when :custom send(field.helper_method, ar_object, field.field_name) when :link if field.custom_link link = field.custom_link else link = ar_object.send(field.field_name) end content_tag :a, href: link do ar_object.send(field.field_name).to_s end when :attachment concat show_attachment_value(ar_object, field) end end end