<% content_for :status_bar do %>

Report complesso archivistico<%= path_separator %><%= link_to @root_fond.name, dashboard_report_path %><%= path_separator %>Inventario

<% end %>
<%= link_to ' Genera RTF', inventory_report_path(@root_fond, :format => "rtf"), {:class => "rtf btn btn-small"} %> <%= link_to ' Genera PDF', inventory_report_path(@root_fond, :format => "pdf"), {:class => "pdf btn btn-small"} %>

<%= @root_fond.name %> <% if @root_fond.preferred_event.present? %> <%= @root_fond.preferred_event.full_display_date %> <% end %>

<% @fonds.each do |fond| %>

<%= fond.name %> <% if fond.preferred_event.present? %> <%= fond.preferred_event.full_display_date %> <% end %>

<% if fond.custodians.present? %>

<%= Custodian.human_name %>

<% fond.custodians.each do |custodian| %>

<%= custodian.display_name %>

<% @custodian_printable_attributes.each do |attribute| %> <% methods = attribute.split('.') %> <% if custodian.send(methods[0].to_sym).present? %>

<%= t(methods[0]) %>

<% if attribute.include?('.') %> <% text = custodian.send(methods[0].to_sym).send(methods[1].to_sym).to_s %> <% else %> <% if attribute == 'legal_status' %> <% text = t(custodian.send(attribute.to_sym).to_s) %> <% else %> <% text = custodian.send(attribute.to_sym).to_s %> <% end %> <% end %> <%= textilize_with_entities(text) %> <% end %> <% end %> <% if custodian.custodian_contacts.present? %> <% contacts = Array.new %>

<%= t("contacts") %>

<% custodian.custodian_contacts.each do |contact| %> <% contacts.push("#{Custodian.human_attribute_name(contact.contact_type)}: #{contact.contact}") %> <% end %> <%= contacts.join(', ') %>
<% end %> <% if custodian.sources.present? %>

<%= Source.human_name({:count => custodian.sources.size}) %>

<% custodian.sources.each do |source| %>

<%= source.short_title %>
<%= formatted_source(source) %>

<% end %>
<% end %> <% end %>
<% end %> <% if fond.creators.present? %>

<%= Creator.human_name({:count => fond.creators.size}) %>

<% fond.creators.each do |creator| %>

<%= creator.display_name %>

<% @creator_printable_attributes.each do |attribute| %> <% methods = attribute.split('.') %> <% if creator.send(methods[0].to_sym).present? %> <%# FIXME: hack provvisorio %> <% string = methods[0].to_s == "history" ? "Profilo storico / Biografia" : t(methods[0]) %>

<%= string %>

<% if attribute.include?('.') %> <% text = creator.send(methods[0].to_sym).send(methods[1].to_sym).to_s %> <% else %> <% if attribute == 'creator_type' %> <% text = t(creator.send(attribute.to_sym).to_s) %> <% else %> <% text = creator.send(attribute.to_sym).to_s %> <% end %> <% end %> <%= textilize_with_entities(text) %> <% end %> <% end %> <% if creator.creator_legal_statuses.present? %>

<%= t('creator_legal_status')%>

<% end %> <% if creator.sources.present? %>

<%= Source.human_name({:count => creator.sources.size}) %>

<% creator.sources.each do |source| %>

<%= source.short_title %>
<%= formatted_source(source) %>

<% end %>
<% end %> <% end %>
<% end %> <% @fond_printable_attributes.each do |attribute| %> <% methods = attribute.split('.') %> <% if fond.send(methods[0].to_sym).present? && fond.send(methods[0].to_sym) != 0 %>
<%# FIXME: hack provvisorio %> <% string = methods[0].to_s == "description" ? "Contenuto" : t(methods[0]) %>

<%= string %>

<% if attribute.include?('.') %> <% text = fond.send(methods[0].to_sym).send(methods[1].to_sym).to_s %> <% else %> <% text = fond.send(attribute.to_sym).to_s %> <% end %> <%= textilize_with_entities(text) %>
<% end %> <% end %> <% if fond.sources.present? %>

<%= Source.human_name({:count => fond.sources.size}) %>

<% fond.sources.each do |source| %>

<%= source.short_title %>
<%= formatted_source(source) %>

<% end %>
<% end %> <% if fond.units.present? %>

<%= Unit.human_name({:count => fond.units.size}) %>

<% fond.units.each do |u| %> <% if u.reference_number.present? %> <% u.tmp_reference_number = nil %> <% u.tmp_reference_string = nil %> <% end %> <% if u.tmp_reference_number.present? %> <% u.tmp_reference_string = nil %> <% end %>

<%= u.display_sequence_number_from_hash(@display_sequence_numbers) %>

<%= u.formatted_title %>

<% @unit_printable_attributes.each do |attribute| %> <% methods = attribute.split('.') %> <% if u.send(methods[0].to_sym).present? %>

<%= t(methods[0])%>

<% if attribute.include?('.') %> <% text = u.send(methods[0].to_sym).send(methods[1].to_sym).to_s %> <% if(methods[0] == 'preferred_event') %> <% text.concat("\n#{u.send(methods[0].to_sym).send('note').to_s}") %> <% end %> <% else %> <% text = u.send(attribute.to_sym).to_s %> <% end %> <%= methods[0] == 'reference_number' ? text : textilize_with_entities(text) %>
<% end %> <% end %> <% if u.unit_langs.present? %>

Lingue della documentazione:

<% u.unit_langs.each do |l| %> <%= show_item(l.code) %>
<% end %>
<% end %> <% if u.unit_other_reference_numbers.present? %>

Altre segnature:

<% u.unit_other_reference_numbers.each do |s| %> <%= s.other_reference_number %><%if s.qualifier.present? %> [<%= s.qualifier %>]<% end %> <%if s.note.present? %> {<%= s.note %>}<% end %>
<% end %>
<% end %> <% if u.headings.present? %>

Voci di indice:

<% u.headings.each do |h| %> [<%= h.heading_type %>] <%= h.name %><%if h.qualifier.present? %>, <%= h.qualifier %><% end %> <%if h.dates.present? %>(<%= h.dates %>)<% end %>
<% end %>

<% end %>
<% end %> <% end %>

<% end %>