57 lines
1.7 KiB
Plaintext
57 lines
1.7 KiB
Plaintext
%h2
|
|
%em.fa.fa-exchange
|
|
= title t '.title'
|
|
|
|
%table.list.autopagerize_page_element
|
|
%thead
|
|
%th.event= sort_link @search, :event
|
|
%th.whodunnit= sort_link @search, :whodunnit
|
|
%th.object= sort_link @search, :object_id
|
|
%th.created_at= sort_link @search, :created_at
|
|
%th.view/
|
|
|
|
%tbody
|
|
- @versions.each do |version|
|
|
:ruby
|
|
if version.event == 'create'
|
|
object = version.item_type.constantize.find_by_id version.item_id
|
|
next unless object.try(:moderated?)
|
|
end
|
|
object = version.reify if object.nil?
|
|
|
|
changes = ''
|
|
if version.event == 'update'
|
|
version.changeset.each do |key, val|
|
|
changes += version.item_type.constantize.human_attribute_name(key)
|
|
changes += ': '
|
|
if key == 'description' && val[0].present? && val[1].present?
|
|
changes += Differ.diff(val[1], val[0]).to_s
|
|
else
|
|
changes += "#{val[0]} -> #{val[1]}"
|
|
end
|
|
changes += '
|
|
'
|
|
end
|
|
changes = strip_tags(changes).gsub(/^\s*/, '')
|
|
end
|
|
|
|
%tr
|
|
%td{ title: changes }= t ".#{version.event}_html"
|
|
%td= User.find version.whodunnit if version.whodunnit
|
|
%td= object
|
|
%td= l version.created_at, format: :short
|
|
%td
|
|
- unless version.event == 'destroy'
|
|
%a{ href: polymorphic_path(version.item_type.tableize.singularize,
|
|
id: version.item_id) }
|
|
%em.fa.fa-eye
|
|
|
|
%tfoot
|
|
%tr
|
|
%th(colspan='5')= paginate @versions
|
|
|
|
.formats
|
|
= link_to versions_path(format: :rss) do
|
|
%em.fa.fa-rss
|
|
= t '.feed'
|