searchgasm 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +8 -0
- data/Manifest +2 -4
- data/README.rdoc +3 -4
- data/lib/searchgasm/active_record/base.rb +23 -20
- data/lib/searchgasm/condition/base.rb +18 -7
- data/lib/searchgasm/condition/does_not_equal.rb +2 -4
- data/lib/searchgasm/condition/equals.rb +2 -4
- data/lib/searchgasm/condition/is_blank.rb +23 -0
- data/lib/searchgasm/condition/is_nil.rb +23 -0
- data/lib/searchgasm/conditions/base.rb +9 -9
- data/lib/searchgasm/config.rb +14 -14
- data/lib/searchgasm/helpers/control_types/link.rb +55 -0
- data/lib/searchgasm/helpers/control_types/links.rb +4 -9
- data/lib/searchgasm/helpers/control_types/select.rb +7 -4
- data/lib/searchgasm/helpers/form.rb +2 -2
- data/lib/searchgasm/helpers/utilities.rb +3 -2
- data/lib/searchgasm/search/base.rb +20 -2
- data/lib/searchgasm/search/conditions.rb +4 -14
- data/lib/searchgasm/search/ordering.rb +30 -29
- data/lib/searchgasm/search/pagination.rb +16 -10
- data/lib/searchgasm/shared/searching.rb +21 -19
- data/lib/searchgasm/shared/utilities.rb +18 -0
- data/lib/searchgasm/version.rb +1 -1
- data/lib/searchgasm.rb +3 -1
- data/searchgasm.gemspec +7 -11
- data/test/test_active_record_associations.rb +2 -2
- data/test/test_condition_base.rb +2 -2
- data/test/test_condition_types.rb +48 -0
- data/test/test_conditions_base.rb +5 -5
- data/test/test_search_base.rb +8 -8
- metadata +6 -10
- data/lib/searchgasm/active_record.rb +0 -8
- data/lib/searchgasm/helpers/control_types.rb +0 -57
- data/lib/searchgasm/helpers.rb +0 -9
- data/lib/searchgasm/search.rb +0 -7
@@ -1,8 +0,0 @@
|
|
1
|
-
module Searchgasm
|
2
|
-
# == Searchgasm ActiveRecord
|
3
|
-
#
|
4
|
-
# Hooks into ActiveRecord to add all of the searchgasm functionality into your models. Only uses what is publically available, doesn't dig into internals, and
|
5
|
-
# searchgasm only gets involved when needed.
|
6
|
-
module ActiveRecord
|
7
|
-
end
|
8
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module Searchgasm
|
2
|
-
module Helpers
|
3
|
-
# = Control Type Helpers
|
4
|
-
#
|
5
|
-
# The purpose of these helpers is to make ordering and paginating data, in your view, a breeze. Everyone has their own flavor of displaying data, so I made these helpers extra flexible, just for you.
|
6
|
-
#
|
7
|
-
# === Tutorial
|
8
|
-
#
|
9
|
-
# Check out my tutorial on how to implement searchgasm into a rails app: http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm
|
10
|
-
#
|
11
|
-
# === How it's organized
|
12
|
-
#
|
13
|
-
# If we break it down, you can do 4 different things with your data in your view:
|
14
|
-
#
|
15
|
-
# 1. Order your data by a single column or an array of columns
|
16
|
-
# 2. Descend or ascend your data
|
17
|
-
# 3. Change how many items are on each page
|
18
|
-
# 4. Paginate through your data
|
19
|
-
#
|
20
|
-
# Each one of these actions comes with 3 different types of helpers:
|
21
|
-
#
|
22
|
-
# 1. Link - A single link for a single value. Requires that you pass a value as the first parameter.
|
23
|
-
# 2. Links - A group of single links.
|
24
|
-
# 3. Select - A select with choices that perform an action once selected. Basically the same thing as a group of links, but just as a select form element
|
25
|
-
# 4. Remote - lets you prefix any of these helpers with "remote_" and it will use the built in rails ajax helpers. I highly recommend unobstrusive javascript though, using jQuery.
|
26
|
-
#
|
27
|
-
# === Examples
|
28
|
-
#
|
29
|
-
# Sometimes the best way to explain something is with some examples. Let's pretend we are performing these actions on a User model. Check it out:
|
30
|
-
#
|
31
|
-
# order_by_link(:name)
|
32
|
-
# => produces a single link that when clicked will order by the name column, and each time its clicked alternated between "ASC" and "DESC"
|
33
|
-
#
|
34
|
-
# order_by_links
|
35
|
-
# => produces a group of links for all of the columns in your users table, each link is basically order_by_link(column.name)
|
36
|
-
#
|
37
|
-
# order_by_select
|
38
|
-
# => produces a select form element with all of the user's columns as choices, when the value is change (onchange) it will act as if they clicked a link.
|
39
|
-
# => This is just order_by_links as a select form element, nothing fancy
|
40
|
-
#
|
41
|
-
# What about paginating? I got you covered:
|
42
|
-
#
|
43
|
-
# page_link(2)
|
44
|
-
# => creates a link to page 2
|
45
|
-
#
|
46
|
-
# page_links
|
47
|
-
# => creates a group of links for pages, similar to a flickr style of pagination
|
48
|
-
#
|
49
|
-
# page_select
|
50
|
-
# => creates a drop down instead of a group of links. The user can select the page in the drop down and it will be as if they clicked a link for that page.
|
51
|
-
#
|
52
|
-
# You can apply the _link, _links, or _select to any of the following: order_by, order_as, per_page, page. You have your choice on how you want to set up the interface. For more information and options on these individual
|
53
|
-
# helpers check out their source files. Look at the sub modules under this one (Ex: Searchgasm::Helpers::ControlTypes::Select)
|
54
|
-
module ControlTypes
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/lib/searchgasm/helpers.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
module Searchgasm
|
2
|
-
# = Searchgasm Helpers
|
3
|
-
#
|
4
|
-
# Provides helpers for rails applications that make using Searchgasm extremely easy. Please see Searchgasm::Helpers::ControlTypes and Searchgasm::Helpers::Form for more information on how to use these helpers.
|
5
|
-
#
|
6
|
-
# Also, I am always looking to improve these. I feel confident that I made these flexible enough for just about any need, but there is always that one crazy instance. If these helpers restrict you
|
7
|
-
# in any way please contact me and let me know. You can do some on my website: www.binarylogic.com. I will more than likely add in your functionality that week.
|
8
|
-
module Helpers
|
9
|
-
module UtilitiesHelper # :nodoc:
|