Lasha

Short description and motivation.

Usage

Controller index action

@data = Lasha.index_data(
  controller: self,
  # namespace: :admin, # optional
  # model: TxFee,      # optional
  collection: TxFee.all.order(created_at: :desc).limit(20),
  attributes: %i[amount node_id created_at],
  # actions: %i[show]  # optional
)

index_data input options

controller: (required) used to derive namespace and index actions
collection: (required) array or AR collection
attributes: (required) model attributes determine which index columns are shown
namespace-: (optional) controller namespace (derive from controller)
model-----: (optional) derive from collection
actions---: (optional) derive from controller, can contain %i[new show edit destroy]

index view index.html.slim

= render partial: "shared/index_generator", locals: { data: @data }

Installation

Add this line to your application's Gemfile:

gem 'lasha'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lasha

Development Helpers

Snippet for quickly rebuilding gem

cd ~/gem_dir
gem uninstall lasha; rake build; gem install pkg/lasha-0.2.4.gem

Contributing

PR will do. Also, you can contact me if you want to discuss large scale ideas.

License

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