2016-01-10 01:10:22 +01:00
|
|
|
%h2
|
2018-09-18 10:37:41 +02:00
|
|
|
%em.fa.fa-history
|
2016-01-10 01:10:22 +01:00
|
|
|
= title t '.title'
|
|
|
|
|
2018-09-18 10:37:41 +02:00
|
|
|
.links
|
|
|
|
= link_to versions_path(format: :rss) do
|
|
|
|
%em.fa.fa-rss
|
|
|
|
= t '.feed'
|
|
|
|
|
2016-01-10 01:10:22 +01:00
|
|
|
%table.list.autopagerize_page_element
|
|
|
|
%thead
|
2016-02-27 18:54:57 +01:00
|
|
|
%th.event
|
2016-01-10 01:10:22 +01:00
|
|
|
%th.whodunnit= sort_link @search, :whodunnit
|
|
|
|
%th.object= sort_link @search, :object_id
|
2016-09-11 17:46:28 +02:00
|
|
|
%th.changeset= sort_link @search, :changeset
|
2016-01-10 01:10:22 +01:00
|
|
|
%th.created_at= sort_link @search, :created_at
|
|
|
|
%th.view/
|
|
|
|
|
|
|
|
%tbody
|
|
|
|
- @versions.each do |version|
|
|
|
|
:ruby
|
|
|
|
if version.event == 'create'
|
2016-01-10 01:28:48 +01:00
|
|
|
object = version.item_type.constantize.find_by_id version.item_id
|
2016-01-10 01:39:31 +01:00
|
|
|
next unless object.try(:moderated?)
|
2016-01-10 01:10:22 +01:00
|
|
|
end
|
2016-01-10 01:28:48 +01:00
|
|
|
object = version.reify if object.nil?
|
2016-01-10 01:10:22 +01:00
|
|
|
|
|
|
|
changes = ''
|
|
|
|
if version.event == 'update'
|
|
|
|
version.changeset.each do |key, val|
|
|
|
|
changes += version.item_type.constantize.human_attribute_name(key)
|
|
|
|
changes += ': '
|
2016-01-11 13:06:39 +01:00
|
|
|
if key == 'description' && val[0].present? && val[1].present?
|
2016-01-10 01:10:22 +01:00
|
|
|
changes += Differ.diff(val[1], val[0]).to_s
|
|
|
|
else
|
2016-09-11 17:46:28 +02:00
|
|
|
changes += "#{val[0]} → #{val[1]}"
|
2016-01-10 01:10:22 +01:00
|
|
|
end
|
|
|
|
changes += '
|
|
|
|
'
|
|
|
|
end
|
|
|
|
changes = strip_tags(changes).gsub(/^\s*/, '')
|
|
|
|
end
|
|
|
|
|
|
|
|
%tr
|
2016-09-11 17:46:28 +02:00
|
|
|
%td= t ".#{version.event}_html"
|
2016-01-10 01:10:22 +01:00
|
|
|
%td= User.find version.whodunnit if version.whodunnit
|
|
|
|
%td= object
|
2016-09-11 18:17:25 +02:00
|
|
|
%td.changes= changes
|
2016-01-10 14:41:20 +01:00
|
|
|
%td= l version.created_at, format: :short
|
2016-01-10 01:10:22 +01:00
|
|
|
%td
|
2016-01-10 15:10:01 +01:00
|
|
|
- unless version.event == 'destroy'
|
|
|
|
%a{ href: polymorphic_path(version.item_type.tableize.singularize,
|
|
|
|
id: version.item_id) }
|
|
|
|
%em.fa.fa-eye
|
2016-01-10 01:10:22 +01:00
|
|
|
|
2016-01-10 14:41:20 +01:00
|
|
|
%tfoot
|
|
|
|
%tr
|
2016-09-11 17:46:28 +02:00
|
|
|
%th(colspan='6')= paginate @versions
|