searchgasm 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/CHANGELOG.rdoc +8 -0
  2. data/Manifest +2 -4
  3. data/README.rdoc +3 -4
  4. data/lib/searchgasm/active_record/base.rb +23 -20
  5. data/lib/searchgasm/condition/base.rb +18 -7
  6. data/lib/searchgasm/condition/does_not_equal.rb +2 -4
  7. data/lib/searchgasm/condition/equals.rb +2 -4
  8. data/lib/searchgasm/condition/is_blank.rb +23 -0
  9. data/lib/searchgasm/condition/is_nil.rb +23 -0
  10. data/lib/searchgasm/conditions/base.rb +9 -9
  11. data/lib/searchgasm/config.rb +14 -14
  12. data/lib/searchgasm/helpers/control_types/link.rb +55 -0
  13. data/lib/searchgasm/helpers/control_types/links.rb +4 -9
  14. data/lib/searchgasm/helpers/control_types/select.rb +7 -4
  15. data/lib/searchgasm/helpers/form.rb +2 -2
  16. data/lib/searchgasm/helpers/utilities.rb +3 -2
  17. data/lib/searchgasm/search/base.rb +20 -2
  18. data/lib/searchgasm/search/conditions.rb +4 -14
  19. data/lib/searchgasm/search/ordering.rb +30 -29
  20. data/lib/searchgasm/search/pagination.rb +16 -10
  21. data/lib/searchgasm/shared/searching.rb +21 -19
  22. data/lib/searchgasm/shared/utilities.rb +18 -0
  23. data/lib/searchgasm/version.rb +1 -1
  24. data/lib/searchgasm.rb +3 -1
  25. data/searchgasm.gemspec +7 -11
  26. data/test/test_active_record_associations.rb +2 -2
  27. data/test/test_condition_base.rb +2 -2
  28. data/test/test_condition_types.rb +48 -0
  29. data/test/test_conditions_base.rb +5 -5
  30. data/test/test_search_base.rb +8 -8
  31. metadata +6 -10
  32. data/lib/searchgasm/active_record.rb +0 -8
  33. data/lib/searchgasm/helpers/control_types.rb +0 -57
  34. data/lib/searchgasm/helpers.rb +0 -9
  35. 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
@@ -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:
@@ -1,7 +0,0 @@
1
- module Searchgasm
2
- # = Searchgasm Shared Functionality
3
- #
4
- # Encapsulates shared functions / code that is used throughout searchgasm, so that we dont repeat ourself
5
- module Shared
6
- end
7
- end