will_filter

rails engine plugin for filtering active_record model objects

  • 所有者: berk/will_filter
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

= WillFilter

will_filter is a Rails engine plugin that provides a GUI for filtering your ActiveRecord models.

== Preamble

If you ever had to build an admin tool for your web site that displayed a list of objects that can be filtered using
various criteria, this plugin will make your life easier. Adding a filtered page can now be
a matter of adding two lines of code - one to your controller and one to your view. See examples below.

== Installation Instructions

Add the following gems to your Gemfile:

gem 'will_filter'
gem 'kaminari'

And run:

$ bundle

To configure and initialize will_filter engine, run the following commands:

$ rails generate will_filter
$ rake db:migrate

At the top of your routes.rb file, add the following line:

mount WillFilter::Engine => "/will_filter"

== Examples

To add a filtered result-set to your controller use the following method call:

class UsersController < ApplicationController

def index
  @users = User.filter(:params => params)    
end

end

Note: 'User' is a Rails ActiveRecord model

Now all you have to do is create a view for this action and add the following tag where you want the filter to be rendered:

<%= will_filter_tag(@users) %>

And optionally you can do (for results table):

<%= will_filter_table_tag(@users) %>

That's it. This will render a filter box with various conditions, operators and values for the model object you selected.

= Documentation

Please read the following document to learn more about filter customization:

https://github.com/berk/will_filter/wiki/Customizing-Filters

Please read the following document to learn more about table tag customization:

https://github.com/berk/will_filter/wiki/Customizing-Table-View

= Dummy Application

This plugin comes with a dummy test project. To try out some of the examples, run the following commands:

$ git clone git://github.com/berk/will_filter.git
$ cd will_filter/test/dummy
$ rake db:migrate
$ rake samples:init
$ rails server

Open your browser and point to:

http://localhost:3000

If you have any questions, comments or suggestions, email me at theiceberk@gmail.com

== Authors and credits

Authors:: Michael Berkovich

主要指標

概覽
名稱與所有者berk/will_filter
主編程語言Ruby
編程語言Ruby (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2009-02-27 07:15:06
推送於2023-01-19 05:42:15
最后一次提交2018-06-29 12:13:34
發布數12
最新版本名稱5.1.4 (發布於 )
第一版名稱v3.1.2 (發布於 2011-10-01 13:57:52)
用户参与
星數157
關注者數11
派生數76
提交數158
已啟用問題?
問題數60
打開的問題數40
拉請求數5
打開的拉請求數12
關閉的拉請求數15
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?