<% fields.each do |slug, field| field_key = field[:options][:field_key] %>
<%= cama_print_i18n_value(field[:name]) %>
<% values = field[:values].is_a?(Array) ? field[:values] : [field[:values]] %>
<% values.each do |value| value = value.to_s.translate if field[:options][:translate].to_s.to_bool %> <% case field[:options][:field_key] %> <% when 'text_box','text_area', 'select','radio','checkbox','colorpicker','date','email','numeric', 'phone' %>

<%= value %>

<% when 'editor' %>
<%= raw value %>
<% when 'image' %>

<%= link_to(image_tag(value, style: "max-height: 100px;"), value) %>

<% when 'audio' %>

<% when 'video' %>

<% when 'file' %>

<%= value.split('/').last %>

<% when 'url' %>

<%= value %>

<% when 'users' user = current_site.users.find(value) rescue {} %>

<%= user.fullname if user.present? %>

<% when 'posts' post = current_site.posts.find(value) rescue {} %>

<%= post.decorate.the_title if post.present? %>

<% when 'field_attrs' post = JSON.parse(value) rescue {} %>

<%= raw("#{post['attr']}: #{post['attr']}") if post.present? %>

<% else %>

<%= value %>

<% end %> <% end %>
<% end %> <%#= debug fields %>