<commit_before>= WillFilter

will_filter is a Rails engine plugin that makes it easy to add administration tools to your site.
 
If you ever had to build a page that displays a list of objects that can be filtered using 
various criteria, this plugin can make your life easier. Adding a filtered page can now be 
a matter of adding a few lines to your controller and creating a view to display your data.

Installation Instructions:

$ script/plugin install git://github.com/berk/will_filter.git

$ rake will_filter:sync  # this copies the necessary migrations, stylesheets, scripts and images to the main project

$ rake db:migrate # this will create the model_filters table so you can save filters you create

Examples:

Here is an example of how a mode_filter gets created in your controller and then will_paginate 
plugin is used to paginate through the results:

class ProfileController < ApplicationController
  def index
    @model_filter = ModelFilter.new("Profile", @own_profile).deserialize_from_params(params)    
    @profiles = Profile.paginate(:order=>@model_filter.order_clause, :page=>params[:page], 
                                 :per_page=>@model_filter.per_page, :conditions=>@model_filter.sql_conditions)
  end
end  

Note: @own_profile is a user or any identity you want to save filters for

That's it. Now all you have to do is create a view for this action and add the following partial where you want your filter to be rendered:

<%= render :partial=> "/model_filter/filter" %>

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

will_filter_examples project contains some samples that show you how to customize filters, etc...

If you have any questions, comments or suggestions, email me to <EMAIL>

Michael.<commit_msg>more instructions<commit_after>= WillFilter

will_filter is a Rails engine plugin that makes it easy to add administration tools to your site.
 
If you ever had to build a page that displays a list of objects that can be filtered using 
various criteria, this plugin can make your life easier. Adding a filtered page can now be 
a matter of adding a few lines to your controller and creating a view to display your data.

== Installation Instructions

  $ script/plugin install git://github.com/berk/will_filter.git
  $ rake will_filter:sync  
  $ rake db:migrate 

== Examples

Here is an example of how a mode_filter gets created in your controller and then will_paginate 
plugin is used to paginate through the results:

class ProfileController < ApplicationController
  def index
    @model_filter = ModelFilter.new("Profile", @own_profile).deserialize_from_params(params)    
    @profiles = Profile.paginate(:order=>@model_filter.order_clause, :page=>params[:page], 
                                 :per_page=>@model_filter.per_page, :conditions=>@model_filter.sql_conditions)
  end
end  

Note: @own_profile is a user or any identity you want to save filters for

That's it. Now all you have to do is create a view for this action and add the following partial where you want your filter to be rendered:

<%= render :partial=> "/model_filter/filter" %>

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

will_filter_examples project contains some samples that show you how to customize filters, etc...

If you have any questions, comments or suggestions, email me to <EMAIL>


== Authors and credits

Authors::                <NAME>

{'fraction_non_alphanumeric': 0.05664674067748363, 'fraction_numerical': 0.0, 'mean_word_length': 4.107558139534884, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3889876', 'n_tokens_mistral': 915, 'n_tokens_neox': 893, 'n_words': 450}