# Lasha This rails plugin aims to be a general helper gem for as many rails apps as possible. It will to be a collection of features and helpers that many rails apps would need. Potential of this gem is endless, please fork and add more features! ## Features #### Helpers * [Index Table Generator](#index-table-generator) * [Mailer helper](#mailer-helper) ## Usage #### Index Table Generator Controller `index` action ``` @data = Lasha.index_data( controller: self, # namespace: :admin, # optional # model: Model, # optional collection: Model.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 } ``` #### Mailer helper Mail helper uses its own partial, just invoke: ``` LashaMailer.notify("destination@email.com", "subject", "body").deliver! ``` ## Installation Add this line to your application's Gemfile: ```ruby gem "lasha" ``` And then execute: ```bash $ bundle ``` Or install it yourself as: ```bash $ gem install lasha ``` ## Dependencies * rails (5+) * sassc-rails ## Development Helpers Snippet for quickly rebuilding gem ``` cd ~/gem_dir gem uninstall lasha; rake build; gem install pkg/lasha-0.2.7.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](https://opensource.org/licenses/MIT).