Socket
Book a DemoInstallSign in
Socket

audited-ui

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audited-ui

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Audited::Ui

A UI for audited, a Ruby on Rails extension for auditing models.

Installation

Add this line to your application's Gemfile:

gem "audited-ui"

And then execute:

$ bundle

Or install it yourself as:

$ gem install audited-ui

Usage

By just installing it, audited-ui will add the following routes:

/audited/audits
/audited/audits/:auditable_type
/audited/audits/:auditable_type/:auditable_id

that will allow you to audit all records of all types, all records of a given auditable type, or all records of a given auditable object, respectively.

Audit all records by linking to audited_audits_path, like this:

<%= link_to "Audit all records", audited_audits_path %>

Or just a specific auditable type, using audited_auditable_type_audits_path, like this:

<%= link_to "Audit all people records", audited_auditable_type_audits_path(auditable_type: "person") %>

Or a specific record, using audited_auditable_audits_path, like this:

<%= link_to "Audit this person", audited_auditable_audits_path(auditable_type: "person", auditable_id: person.id) %>

Customizing views

If you already set it up, you'll notice that audited-ui comes with a barebone UI that you can use. But, purposedly, the UI is very simple. The idea is that you can use it if it's good enough, but in most cases you should customize it to match your application's UI.

To generate the views simply run:

$ bundle exec rails g audited:ui:views

I18n

Every string is I18ned, even class and attributes names. See this guide if you want to translate your audited models and attributes.

By default only english and spanish are supported. You can add other locales by copying the content of this file into your app's config/locale/yourlocale.yml and translating the given strings. And if you do that send a PR :P .

If you need to customize just one string, copy that string in your app's locale file:

en:
  audited:
    ui:
      audits:
        index:
          title:
            all: Auditing everything

TODO

  • Mount the engine with a method, similar to devise_for, so we can have more and better control on routes.
  • AuditedUI configuration, if we need to configure anything.
  • Ready to use views (tailwind/bootstrap), if it makes sense.
  • Filters (by user, by dates, by changed attribute).
  • Sort by column.
  • Revert to a specific version.
  • Tests.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 18 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.