- @resource.class.resource_field_groups.each do |rfg| %h3= resource_field_group_label(@resource.class, rfg.key) unless rfg.key == :default %table.table.table-hover.table-striped %thead %tr - 12.times do %td{ style: 'width: 8.33%; height: 0px' } %tbody - rfg.sections.each do |section| - section.fields.each_slice(section.columns) do |slice| - colspan = (12 - slice.size) / section.columns %tr - slice.each do |f| %th.text-right{ style: 'width: 10%' }= field_label_for(@resource.class, f.sym) - max_columns = rfg.max_section_columns %td{ colspan: colspan } - val = @resource.send(f.sym) - case f.type - when :integer, :float = val - when :string, :text - if f.sym.to_s.ends_with?('_url', '_link') = link_to val, val, target: f.sym - elsif @resource.respond_to?("#{f.sym}_as_html?") && @resource.send("#{f.sym}_as_html?") = raw(val) - else = simple_format(val) - when :boolean - icon_class = val ? 'fa-check text-success' : 'fa-times text-danger' %i.fa{ class: icon_class } - when :association, :belongs_to_association, :has_many_association, :has_many_through_association, :has_and_belongs_to_many_reflection, :has_one_through_association - if val.present? - if val.is_a?(ActiveRecord::Associations::CollectionProxy) %ul.no-bullets - val.each do |val1| - begin - link = link_to(val1) %li= link - rescue %li= val1 - else - begin = link_to val if val.present? - rescue = val if val.present? - when :file - if val.present? - if val.content_type.include?('image') %img.user-image{ src: val.expiring_url, style: 'max-height: 50px; max-width: 50px' } - else = link_to val, val.expiring_url - else = val - (section.columns-slice.size).times do %th %td{ colspan: colspan }