<%
categories = if content.is_a?(ContentSerializer)
content.data[:categories]
else
@serialized_categories_and_fields.data
end
%>
<% categories.each do |category| %>
<% next if category[:name] == 'changelog' %>
<% next if category[:name] == 'gallery' %>
<%
if creating || editing
# Show everything on create/edit forms
elsif category[:name] == 'contributors'
# Show contributors on show page if there are any to show
next if raw_model.contributors.empty?
else
# Only show other tabs if it has at least one piece of data in it
next unless category[:fields].any? do |field|
(
# This is a link field AND it has existing links
field[:type] == 'link' && field[:old_column_source].present? && raw_model.send(field[:old_column_source]).any?
) || field[:value].present?
# or: this is a text field with text in it
end
end
%>