Sha256: 8d04f9973e36e80eca3bda27cd3e7c2e25b09de68b231c1af9a40542f273b56b

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

ActiveAdmin.register ActiveAdmin::Audit::ContentVersion, as: 'ContentVersion' do
  menu parent: 'System'

  actions :index, :show

  filter :item_type, input_html: { class: 'chosen' }, as: :select
  filter :event, input_html: { class: 'chosen' }, as: :select
  filter :whodunnit, input_html: { class: 'chosen' }, as: :select, collection: -> { AdminUser.all.map { |u| [u.email, u.id] } }
  filter :created_at

  index do
    id_column
    column :item
    column :item_type
    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
    actions
  end

  show do |version|
    panel version.item_type do
      attributes_table_for version do
        row :item
        row :item_type
        row :event
        row :who
        row :created_at
      end
    end

    render partial: 'object_changes', locals: {
      event: version.event,
      object_changes: version.object_snapshot_changes,
    }

    render partial: 'additional_objects_changes', locals: {
      event: version.event,
      additional_objects_changes: version.additional_objects_snapshot_changes,
    }

    render partial: 'object_snapshot', locals: {
      object_snapshot: version.object_snapshot,
    }

    render partial: 'additional_objects_snapshot', locals: {
      additional_objects_snapshot: version.additional_objects_snapshot,
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin-audit-0.1.0 app/admin/content_versions.rb