Module: CollectionObjects::CatalogHelper
- Defined in:
- app/helpers/collection_objects/catalog_helper.rb
Instance Method Summary collapse
- #collection_object_catalog_date_range(item) ⇒ Object
- #collection_object_history_object_value(item) ⇒ Object
- #collection_object_history_row(item) ⇒ Object
- #collection_object_history_table(data) ⇒ Object
Instance Method Details
#collection_object_catalog_date_range(item) ⇒ Object
35 36 37 38 |
# File 'app/helpers/collection_objects/catalog_helper.rb', line 35 def collection_object_catalog_date_range(item) d = [ item.start_date, item.end_date].compact.collect{|t| t.strftime('%F')}.join('/') d.empty? ? tag.em('not provided') : d end |
#collection_object_history_object_value(item) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/helpers/collection_objects/catalog_helper.rb', line 24 def collection_object_history_object_value(item) case item.object_class_name when 'Tag' tag.td( controlled_vocabulary_term_tag(item.object.keyword) ) when 'Depiction' tag.td( image_link(item.object.image)) else tag.td( object_link(item.object)) end end |
#collection_object_history_row(item) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/helpers/collection_objects/catalog_helper.rb', line 15 def collection_object_history_row(item) tag.tr( class: Catalog::CollectionObject::FILTER_MAP[item.type]) do tag.td( item.type.to_s.humanize ) + tag.td( collection_object_catalog_date_range(item) ) + tag.td( item.object_class_name ) + collection_object_history_object_value(item) end end |
#collection_object_history_table(data) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/collection_objects/catalog_helper.rb', line 3 def collection_object_history_table(data) tag.table( class: [:full_width]) do tag.tr do tag.th('Event') + tag.th('Date') + tag.th('Derived from') + tag.th('Object') end + data.ordered_by_date.collect{|d| collection_object_history_row(d)}.join.html_safe end end |