Class: Udongo::WillPaginate::Options
- Inherits:
-
Object
- Object
- Udongo::WillPaginate::Options
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/udongo/will_paginate/options.rb
Instance Method Summary collapse
- #defaults ⇒ Object
-
#initialize(options = {}) ⇒ Options
constructor
A new instance of Options.
- #nav_label(default_value, sr_only_value) ⇒ Object
- #next_label ⇒ Object
- #previous_label ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Options
Returns a new instance of Options.
6 7 8 |
# File 'lib/udongo/will_paginate/options.rb', line 6 def initialize( = {}) @options = || {} end |
Instance Method Details
#defaults ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/udongo/will_paginate/options.rb', line 10 def defaults { class: 'pagination', inner_window: 1, outer_window: 0, renderer: Udongo::WillPaginate::Renderer, previous_label: previous_label, next_label: next_label } end |
#nav_label(default_value, sr_only_value) ⇒ Object
29 30 31 32 33 |
# File 'lib/udongo/will_paginate/options.rb', line 29 def nav_label(default_value, sr_only_value) string = content_tag(:span, default_value.html_safe, aria: { hidden: true }) string += content_tag(:span, I18n.t("will_paginate.#{sr_only_value}"), class: 'sr-only') string.html_safe end |
#next_label ⇒ Object
21 22 23 |
# File 'lib/udongo/will_paginate/options.rb', line 21 def next_label nav_label('→', 'next_label') end |
#previous_label ⇒ Object
25 26 27 |
# File 'lib/udongo/will_paginate/options.rb', line 25 def previous_label nav_label('←', 'previous_label') end |
#values ⇒ Object
35 36 37 |
# File 'lib/udongo/will_paginate/options.rb', line 35 def values @options.reverse_merge!(defaults) end |