Project

lintity

0.0
No release in over a year
Rails gem to create list of entities
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 7.0, >= 7.0.2.3
 Project Readme

Lintity

Training gem (Engine) that shows list of entities

Installation

Add this line to your application's Gemfile:

gem "lintity"

And then execute:

$ bundle

Or install it yourself as:

$ gem install lintity

System Requirements

  • Ruby >= 3.0
  • Ruby On Rails >= 7.0
  • gem 'importmap-rails'
  • gem 'stimulus-rails'
  • bootstrap 5
  • gem 'font-awesome-rails'
  • ActiveRecord

Usage

Create your controller

class CustomersController < Lintity::EntityListController #inherit
  layout 'application'  #use own main layout
  before_action :set_customer, only: [:edit]

  def index
    @search_path = customers_path
    
    @records = 
      if @filter_field
        Customer.where("#{@filter_field} #{@filter_sign} ?", @filter_value.to_i)  #implementing filter result
      else
        Customer.all
      end
  end

  def edit; end

  private

  def init_fields  #your fields from model
    @fields_settings = [
      { field: 'name', name: 'Name', type: 'edit', path: Proc.new { |customer_id| edit_customer_path(id: customer_id) } },  #Add path for edit of a record
      { field: 'phone', name: 'Phone', type: 'info' },
      { field: 'address', name: 'Address', type: 'info' },
      { field: 'ordered', name: 'Ordered', type: 'numeric_filter' },
      { field: 'no_of_orders', name: 'No Of Orders', type: 'numeric_filter' },
      { field: 'total_amount', name: 'Total Amount', type: 'numeric_filter' },
    ]
  end

  def set_customer
    @customer = Customer.find(params[:id])
  end
end

Results

  • Entity List View: list

  • Filter filter

License

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