Skip to content

Rails helper for rendering an AR model or iterable collection of AR models as an HTML table

License

Notifications You must be signed in to change notification settings

amleaver/docket

Repository files navigation

Build Status Coverage Status

Docket

Overview

Adds a docket helper to a Rails project for rendering an AR model or iterable collection of models as an HTML table.

Usage

From your Rails view call docket with the following:

  • model: An AR model instance or collection of models to render in a table.
  • ignore (optional): An array of symbols which map to model attributes which won't be rendered in the table.
  • calls (optional): An array of strings which map to methods to call against the instance.
  • table_class (optional): Class attribute to use for the table.
  • table_id (optional): ID attribute to use for the table.
  • table_style (optional): Style attribute to use for the table.

Example

<%= docket @users, 
    ignore: [:updated_at, :created at],
    calls: [['fullname'], ['is_admin.humanize', 'Is Admin?']],
    table_class: 'tablesorter',
    table_id: 'user',
    table_style: 'background-color: white'
%>

License

MIT-LICENSE.

About

Rails helper for rendering an AR model or iterable collection of AR models as an HTML table

Resources

License

Stars

Watchers

Forks

Packages

No packages published