Sha256: 7848a7543ff2ae51fd5df24649e0472fadef4687c724fd796142f013f0796b86

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 KB

Contents

module ActiveAdmin
  module Views
    class LatestVersions < ActiveAdmin::Component
      builder_method :latest_versions

      def build(resource, _attributes = {})
        panel 'Latest versions' do
          table_for resource.latest_versions do
            column :id
            column :event
            column :who
            column :object_changes do |version|
              version_attributes_diff(version.object_changes)
            end
            column :additional_objects_changes do |version|
              version_attributes_diff(version.additional_objects_changes)
            end
            column :created_at
            column :actions do |version|
              link_to 'View', admin_content_version_path(version)
            end
          end

          div do
            link_to 'View all versions', admin_content_versions_path({
              'q[item_type_eq]' => resource.class.name,
              'q[item_id_eq]' => resource.id,
            })
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activeadmin-audit-0.1.4 lib/active_admin/views/latest_versions.rb
activeadmin-audit-0.1.2 lib/active_admin/views/latest_versions.rb
activeadmin-audit-0.1.1 lib/active_admin/views/latest_versions.rb
activeadmin-audit-0.1.0 lib/active_admin/views/latest_versions.rb