Skip to content

Commit

Permalink
Updated searchgasm
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Sep 19, 2008
1 parent dc93423 commit f818abf
Show file tree
Hide file tree
Showing 201 changed files with 5,491 additions and 1,055 deletions.
4 changes: 3 additions & 1 deletion README.rdoc
Expand Up @@ -2,10 +2,12 @@

This is an example of how to use Searchgasm in a rails app. Searchgasm is simple searching, ordering, and pagination all in one plugin.

Checkout Searchgasm here: http://github.com/binarylogic/searchgasm
This application live: http://searchgasm_example.binarylogic.com

Quick tutorial on how to build this application here: http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm

Searchgasm: http://github.com/binarylogic/searchgasm

=== Key files

Here are the files you want to glance at:
Expand Down
1 change: 1 addition & 0 deletions app/models/user_group.rb
@@ -1,3 +1,4 @@
class UserGroup < ActiveRecord::Base
has_many :users
has_many :orders, :through => :users
end
4 changes: 4 additions & 0 deletions app/views/jquery/users/index.html.erb
Expand Up @@ -7,6 +7,10 @@ This is the preferred method. Really nice, check out jquery_setup.js on how to s
<legend>Search Users</legend>

<% f.fields_for @search.conditions do |users| %>
Match ANY or ALL of the conditions:<br />
<%= users.select :any, [["All", false], ["Any", true]] %><br />
<br />

First name keywords:<br />
<%= users.text_field :first_name_keywords %><br />
<br />
Expand Down
4 changes: 4 additions & 0 deletions app/views/non_ajax/users/index.html.erb
Expand Up @@ -7,6 +7,10 @@ Good ol' regular http requests.
<legend>Search Users</legend>

<% f.fields_for @search.conditions do |users| %>
Match ANY or ALL of the conditions:<br />
<%= users.select :any, [["All", false], ["Any", true]] %><br />
<br />

First name keywords:<br />
<%= users.text_field :first_name_keywords %><br />
<br />
Expand Down
9 changes: 5 additions & 4 deletions app/views/rails_ajax/users/index.html.erb
Expand Up @@ -9,10 +9,13 @@ If you are wanting to do unobtrusive javascript take a look at the jQuery exampl
<legend>Search Users</legend>

<% f.fields_for @search.conditions do |users| %>
Match ANY or ALL of the conditions:<br />
<%= users.select :any, [["All", false], ["Any", true]] %><br />
<br />

First name keywords:<br />
<%= users.text_field :first_name_keywords %><br />
<br />

First name sounds like: (try &quot;bin&quot;, this is a custom condition, checkout config/initializers/searchgasm.rb)<br />
<%= users.text_field :first_name_sounds_like %><br />
<br />
Expand All @@ -24,13 +27,11 @@ If you are wanting to do unobtrusive javascript take a look at the jQuery exampl
Email ends with:<br />
<%= users.text_field :email_ends_with %><br />
<br />

<% users.fields_for users.object.orders do |orders| %>
Has orders with a total greater than:<br />
$<%= orders.text_field :total_gt %><br />
<br />
<% end %>
<% users.fields_for users.object.user_group do |user_group| %>
Belongs to user group with name that starts with:<br />
<%= user_group.text_field :name_starts_with %><br />
Expand All @@ -43,4 +44,4 @@ If you are wanting to do unobtrusive javascript take a look at the jQuery exampl

<div id="users">
<%= render :partial => "users" %>
</div>
</div>
8 changes: 4 additions & 4 deletions config/boot.rb
Expand Up @@ -82,14 +82,14 @@ def gem_version

def load_rubygems
require 'rubygems'

unless rubygems_version >= '0.9.4'
$stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
min_version = '1.1.1'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end

rescue LoadError
$stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end

Expand Down
2 changes: 1 addition & 1 deletion config/environment.rb
Expand Up @@ -5,7 +5,7 @@
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = '2.1.1' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Expand Down

0 comments on commit f818abf

Please sign in to comment.