- collapsed = session[:contact_show_general].nil? # && contact.errors.empty?
= section_title :contact_show_general, collapsed, t(:general_info), t('show_general_info_small')
.show_fields
  #contact_show_general{ hidden_if(collapsed) }
    %table.asset_attributes
      %tr
        = col(t(:first_name), contact.first_name)
        = col(t(:last_name), contact.last_name)
      %tr
        = col(t(:email), contact.email, false, true)
        = col(t(:phone), contact.phone)
      %tr
        = col(t(:account), account_with_url_for(contact))
        - assigned_to_user = User.find_by_id(contact.assigned_to)
        = col(t(:assigned_to), assigned_to_user ? link_to(assigned_to_user.name, url_for(assigned_to_user)) : "")
      %tr
        = col(t(:tags), contact.tag_list.map{|tag| content_tag(:span, tag, :class => "fbtag")}.join(' '))
        
    -# Show custom fields that are in the default field group
    - custom_field_group = contact.field_groups.select{|f| f.name == 'custom_fields'}
    - fields = custom_field_group.first.fields.without_pairs
    = render("fields/group_view", :fields => fields, :entity => contact) if fields.any?

- collapsed = session[:contact_show_general].nil? # && contact.errors.empty?
= section_title :contact_show_general, collapsed, t(:general_info), t('show_general_info_small')
.show_fields
  #contact_show_general{ hidden_if(collapsed) }
    %table.asset_attributes
      %tr
        = col(t(:first_name), contact.first_name)
        = col(t(:last_name), contact.last_name)
      %tr
        = col(t(:email), contact.email, false, true)
        = col(t(:phone), contact.phone)
      %tr
        = col(t(:account), account_with_url_for(contact))
        - assigned_to_user = User.find_by_id(contact.assigned_to)
        = col(t(:assigned_to), assigned_to_user ? link_to(assigned_to_user.name, url_for(assigned_to_user)) : "")
      %tr
        = col(t(:tags), contact.tag_list.map{|tag| content_tag(:span, tag, :class => "fbtag")}.join(' '))

    -# Show custom fields that are in the default field group
    - custom_field_group = contact.field_groups.select{|f| f.name == 'custom_fields'}
    - fields = custom_field_group.first.try(:fields).try(:without_pairs)
    = render("fields/group_view", :fields => fields, :entity => contact) unless fields.nil?

Patch rare case of custom field with no field group
Patch rare case of custom field with no field group
