Class: Searchgasm::Config::Helpers
- Inherits:
-
Object
- Object
- Searchgasm::Config::Helpers
- Defined in:
- lib/searchgasm/config/helpers.rb
Overview
Helpers Configuration
Provide configuration for searchgasm’s rails helpers
Example
Searchgasm::Config.configure do |config|
config.helpers.order_by_link_asc_indicator = "ASC"
end
Class Attribute Summary collapse
-
.hidden_fields ⇒ Object
Which hidden fields to automatically include when creating a form with a Searchgasm object.
-
.javascript_library ⇒ Object
Searchgasm does some javascript magic when you use the form helpers with a Searchgasm object.
-
.order_as_link_class_name ⇒ Object
The class name for used in the order_as_link helper.
-
.order_as_select_class_name ⇒ Object
The class name for used in the order_as_select helper.
-
.order_by_link_asc_indicator ⇒ Object
The indicator that is used when the sort of a column is ascending.
-
.order_by_link_class_name ⇒ Object
The class name for used in the order_by_link helper.
-
.order_by_link_desc_indicator ⇒ Object
See order_by_link_asc_indicator=.
-
.order_by_links_ordering_by_class_name ⇒ Object
The class name used in order_by_links for the link that it is currently ordering by.
-
.order_by_select_class_name ⇒ Object
The class name for used in the order_by_select helper.
-
.page_link_class_name ⇒ Object
The class name for used in the page_link helper.
-
.page_links_current_page_class_name ⇒ Object
The class that the current page link gets.
-
.page_links_disabled_class_name ⇒ Object
The class that disabled page links get.
-
.page_links_first ⇒ Object
The default for the :first option for the page_links helper.
-
.page_links_first_page_class_name ⇒ Object
The class for the first page link.
-
.page_links_inner_spread ⇒ Object
The default for the :inner_spread option for the page_links helper.
-
.page_links_last ⇒ Object
The default for the :last option for the page_links helper.
-
.page_links_last_page_class_name ⇒ Object
The class for the last page link.
-
.page_links_next ⇒ Object
The default for the :next option for the page_links helper.
-
.page_links_next_page_class_name ⇒ Object
The class for the next page link.
-
.page_links_outer_spread ⇒ Object
The default for the :outer_spread option for the page_links helper.
-
.page_links_prev ⇒ Object
The default for the :prev option for the page_links helper.
-
.page_links_prev_page_class_name ⇒ Object
The class for the previous page link.
-
.page_select_class_name ⇒ Object
The class name for used in the page_seect helper.
-
.per_page_link_class_name ⇒ Object
The class name for used in the per_page_link helper.
-
.per_page_links_choices ⇒ Object
The choices used in the per_page_links helper.
-
.per_page_select_choices ⇒ Object
The choices used in the per_page_select helper.
-
.per_page_select_class_name ⇒ Object
The class name for used in the per_page_select helper.
-
.priority_order_by_link_activate_text ⇒ Object
The default value for the :activate_text option for priority_order_by_link.
-
.priority_order_by_link_class_name ⇒ Object
The class name for used in the priority_order_by_link helper.
-
.priority_order_by_link_deactivate_text ⇒ Object
The default value for the :deactivate_text option for priority_order_by_link.
Class Attribute Details
.hidden_fields ⇒ Object
Which hidden fields to automatically include when creating a form with a Searchgasm object. See Searchgasm::Helpers::Form for more info.
-
Default:
[:order_by, :order_as, :per_page] -
Accepts:
Array, nil, false
16 17 18 |
# File 'lib/searchgasm/config/helpers.rb', line 16 def hidden_fields @hidden_fields ||= (Searchgasm::Search::Base::SPECIAL_FIND_OPTIONS - [:page, :priority_order]) end |
.javascript_library ⇒ Object
Searchgasm does some javascript magic when you use the form helpers with a Searchgasm object. To make configuration easier Searchgasm checks for the existence of Prototype and jQuery and uses the first one it finds. To cut back on the javascript output you can specify your library here.
-
Default:
nil -
Accepts:
:prototype or :jquery
26 27 28 |
# File 'lib/searchgasm/config/helpers.rb', line 26 def javascript_library @javascript_library end |
.order_as_link_class_name ⇒ Object
The class name for used in the order_as_link helper
-
Default:
“order_as” -
Accepts:
String
35 36 37 |
# File 'lib/searchgasm/config/helpers.rb', line 35 def order_as_link_class_name @order_as_link_class_name ||= "order_as" end |
.order_as_select_class_name ⇒ Object
The class name for used in the order_as_select helper
-
Default:
“order_as” -
Accepts:
String
44 45 46 |
# File 'lib/searchgasm/config/helpers.rb', line 44 def order_as_select_class_name @order_as_select_class_name ||= "order_as" end |
.order_by_link_asc_indicator ⇒ Object
The indicator that is used when the sort of a column is ascending
-
Default:
▲ -
Accepts:
String or a Proc.
Examples
config.asc_indicator = "(ASC)"
config.asc_indicator = Proc.new { |template| template.image_tag("asc.jpg") }
58 59 60 |
# File 'lib/searchgasm/config/helpers.rb', line 58 def order_by_link_asc_indicator @order_by_link_asc_indicator ||= " ▲" end |
.order_by_link_class_name ⇒ Object
The class name for used in the order_by_link helper
-
Default:
“order_by” -
Accepts:
String
67 68 69 |
# File 'lib/searchgasm/config/helpers.rb', line 67 def order_by_link_class_name @order_by_link_class_name ||= "order_by" end |
.order_by_link_desc_indicator ⇒ Object
See order_by_link_asc_indicator=
73 74 75 |
# File 'lib/searchgasm/config/helpers.rb', line 73 def order_by_link_desc_indicator @order_by_link_desc_indicator ||= " ▼" end |
.order_by_links_ordering_by_class_name ⇒ Object
The class name used in order_by_links for the link that it is currently ordering by
-
Default:
“# The class name for used in the page_link helper -
Default:
“page” -
Accepts:
String
84 85 86 |
# File 'lib/searchgasm/config/helpers.rb', line 84 def order_by_links_ordering_by_class_name @order_by_links_ordering_by_class_name ||= "ordering_by" end |
.order_by_select_class_name ⇒ Object
The class name for used in the order_by_select helper
-
Default:
“order_by” -
Accepts:
String
93 94 95 |
# File 'lib/searchgasm/config/helpers.rb', line 93 def order_by_select_class_name @order_by_select_class_name ||= "order_by" end |
.page_link_class_name ⇒ Object
The class name for used in the page_link helper
-
Default:
“page” -
Accepts:
String
102 103 104 |
# File 'lib/searchgasm/config/helpers.rb', line 102 def page_link_class_name @page_link_class_name ||= "page" end |
.page_links_current_page_class_name ⇒ Object
The class that the current page link gets.
-
Default:
“current_page” -
Accepts:
String, set to nil to disable
117 118 119 |
# File 'lib/searchgasm/config/helpers.rb', line 117 def page_links_current_page_class_name @page_links_current_page_class_name ||= "current_page" end |
.page_links_disabled_class_name ⇒ Object
The class that disabled page links get. Including the current page, prev page, next page, first page, and last page.
-
Default:
“disabled_page” -
Accepts:
String, set to nil to disable
126 127 128 |
# File 'lib/searchgasm/config/helpers.rb', line 126 def page_links_disabled_class_name @page_links_disabled_class_name ||= "disabled_page" end |
.page_links_first ⇒ Object
The default for the :first option for the page_links helper.
-
Default:
nil -
Accepts:
Anything you want, text, html, etc. nil to disable
135 136 137 |
# File 'lib/searchgasm/config/helpers.rb', line 135 def page_links_first @page_links_first end |
.page_links_first_page_class_name ⇒ Object
The class for the first page link
-
Default:
“first_page” -
Accepts:
String, nil to disable
153 154 155 |
# File 'lib/searchgasm/config/helpers.rb', line 153 def page_links_first_page_class_name @page_links_first_page_class_name ||= "first_page" end |
.page_links_inner_spread ⇒ Object
The default for the :inner_spread option for the page_links helper.
-
Default:
3 -
Accepts:
Any integer >= 1, set to nil to show all pages
144 145 146 |
# File 'lib/searchgasm/config/helpers.rb', line 144 def page_links_inner_spread @page_links_inner_spread ||= 3 end |
.page_links_last ⇒ Object
The default for the :last option for the page_links helper.
-
Default:
nil -
Accepts:
Anything you want, text, html, etc. nil to disable
162 163 164 |
# File 'lib/searchgasm/config/helpers.rb', line 162 def page_links_last @page_links_last end |
.page_links_last_page_class_name ⇒ Object
The class for the last page link
-
Default:
“last_page” -
Accepts:
String, nil to disable
171 172 173 |
# File 'lib/searchgasm/config/helpers.rb', line 171 def page_links_last_page_class_name @page_links_last_page_class_name ||= "last_page" end |
.page_links_next ⇒ Object
The default for the :next option for the page_links helper.
-
Default:
“Next >” -
Accepts:
Anything you want, text, html, etc. nil to disable
180 181 182 |
# File 'lib/searchgasm/config/helpers.rb', line 180 def page_links_next @page_links_next ||= "Next >" end |
.page_links_next_page_class_name ⇒ Object
The class for the next page link
-
Default:
“next_page” -
Accepts:
String, nil to disable
189 190 191 |
# File 'lib/searchgasm/config/helpers.rb', line 189 def page_links_next_page_class_name @page_links_next_page_class_name ||= "next_page" end |
.page_links_outer_spread ⇒ Object
The default for the :outer_spread option for the page_links helper.
-
Default:
2 -
Accepts:
Any integer >= 1, set to nil to display, 0 to only show the “…” separator
198 199 200 |
# File 'lib/searchgasm/config/helpers.rb', line 198 def page_links_outer_spread @page_links_outer_spread ||= 1 end |
.page_links_prev ⇒ Object
The default for the :prev option for the page_links helper.
-
Default:
“< Prev” -
Accepts:
Anything you want, text, html, etc. nil to disable
216 217 218 |
# File 'lib/searchgasm/config/helpers.rb', line 216 def page_links_prev @page_links_prev ||= "< Prev" end |
.page_links_prev_page_class_name ⇒ Object
The class for the previous page link
-
Default:
“prev_page” -
Accepts:
String, nil to disable
207 208 209 |
# File 'lib/searchgasm/config/helpers.rb', line 207 def page_links_prev_page_class_name @page_links_prev_page_class_name ||= "prev_page" end |
.page_select_class_name ⇒ Object
The class name for used in the page_seect helper
-
Default:
“page” -
Accepts:
String
225 226 227 |
# File 'lib/searchgasm/config/helpers.rb', line 225 def page_select_class_name @page_select_class_name ||= "page" end |
.per_page_link_class_name ⇒ Object
The class name for used in the per_page_link helper
-
Default:
“per_page” -
Accepts:
String
234 235 236 |
# File 'lib/searchgasm/config/helpers.rb', line 234 def per_page_link_class_name @per_page_link_class_name ||= "per_page" end |
.per_page_links_choices ⇒ Object
The choices used in the per_page_links helper. Works just like per_page_select_choices.
108 109 110 |
# File 'lib/searchgasm/config/helpers.rb', line 108 def per_page_links_choices @per_page_links_choices ||= per_page_select_choices end |
.per_page_select_choices ⇒ Object
The choices used in the per_page_select helper
-
Default:
[[“10 per page”, 10], [“25 per page”, 25], [“50 per page”, 50], [“100 per page”, 100], [“150 per page”, 150], [“200 per page”, 200], [“Show all”, nil]] -
Accepts:
Array
243 244 245 246 247 248 |
# File 'lib/searchgasm/config/helpers.rb', line 243 def per_page_select_choices return @per_page_select_choices if @per_page_select_choices @per_page_select_choices = [] [10, 25, 50, 100, 150, 200].each { |choice| @per_page_select_choices << ["#{choice} per page", choice] } @per_page_select_choices << ["Show all", nil] end |
.per_page_select_class_name ⇒ Object
The class name for used in the per_page_select helper
-
Default:
“per_page” -
Accepts:
String
255 256 257 |
# File 'lib/searchgasm/config/helpers.rb', line 255 def per_page_select_class_name @per_page_select_class_name ||= "per_page" end |
.priority_order_by_link_activate_text ⇒ Object
The default value for the :activate_text option for priority_order_by_link
-
Default:
“Show %s first” -
Accepts:
String with substitutions, using rubys % method for strings
264 265 266 |
# File 'lib/searchgasm/config/helpers.rb', line 264 def priority_order_by_link_activate_text @priority_order_by_link_activate_text ||= "Show %s first" end |
.priority_order_by_link_class_name ⇒ Object
The class name for used in the priority_order_by_link helper
-
Default:
“priority_order_by” -
Accepts:
String
273 274 275 |
# File 'lib/searchgasm/config/helpers.rb', line 273 def priority_order_by_link_class_name @priority_order_by_link_class_name ||= "priority_order_by" end |
.priority_order_by_link_deactivate_text ⇒ Object
The default value for the :deactivate_text option for priority_order_by_link
-
Default:
“Dont’ show %s first” -
Accepts:
String with substitutions, using rubys % method for strings
282 283 284 |
# File 'lib/searchgasm/config/helpers.rb', line 282 def priority_order_by_link_deactivate_text @priority_order_by_link_deactivate_text ||= "Don't show %s first" end |