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.
-
.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 |
.order_as_link_class_name ⇒ Object
The class name for used in the order_as_link helper
-
Default:
“order_as” -
Accepts:
String
25 26 27 |
# File 'lib/searchgasm/config/helpers.rb', line 25 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
34 35 36 |
# File 'lib/searchgasm/config/helpers.rb', line 34 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") }
48 49 50 |
# File 'lib/searchgasm/config/helpers.rb', line 48 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
57 58 59 |
# File 'lib/searchgasm/config/helpers.rb', line 57 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=
63 64 65 |
# File 'lib/searchgasm/config/helpers.rb', line 63 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
74 75 76 |
# File 'lib/searchgasm/config/helpers.rb', line 74 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
83 84 85 |
# File 'lib/searchgasm/config/helpers.rb', line 83 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
92 93 94 |
# File 'lib/searchgasm/config/helpers.rb', line 92 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
107 108 109 |
# File 'lib/searchgasm/config/helpers.rb', line 107 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
116 117 118 |
# File 'lib/searchgasm/config/helpers.rb', line 116 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
125 126 127 |
# File 'lib/searchgasm/config/helpers.rb', line 125 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
143 144 145 |
# File 'lib/searchgasm/config/helpers.rb', line 143 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
134 135 136 |
# File 'lib/searchgasm/config/helpers.rb', line 134 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
152 153 154 |
# File 'lib/searchgasm/config/helpers.rb', line 152 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
161 162 163 |
# File 'lib/searchgasm/config/helpers.rb', line 161 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
170 171 172 |
# File 'lib/searchgasm/config/helpers.rb', line 170 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
179 180 181 |
# File 'lib/searchgasm/config/helpers.rb', line 179 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
188 189 190 |
# File 'lib/searchgasm/config/helpers.rb', line 188 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
206 207 208 |
# File 'lib/searchgasm/config/helpers.rb', line 206 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
197 198 199 |
# File 'lib/searchgasm/config/helpers.rb', line 197 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
215 216 217 |
# File 'lib/searchgasm/config/helpers.rb', line 215 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
224 225 226 |
# File 'lib/searchgasm/config/helpers.rb', line 224 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.
98 99 100 |
# File 'lib/searchgasm/config/helpers.rb', line 98 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
233 234 235 236 237 238 |
# File 'lib/searchgasm/config/helpers.rb', line 233 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
245 246 247 |
# File 'lib/searchgasm/config/helpers.rb', line 245 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
254 255 256 |
# File 'lib/searchgasm/config/helpers.rb', line 254 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
263 264 265 |
# File 'lib/searchgasm/config/helpers.rb', line 263 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
272 273 274 |
# File 'lib/searchgasm/config/helpers.rb', line 272 def priority_order_by_link_deactivate_text @priority_order_by_link_deactivate_text ||= "Don't show %s first" end |