Sha256: d982c7ec92027d26c01b14d052b48c10dc49757706d843761979c77e2ba7de0e

Contents?: true

Size: 952 Bytes

Versions: 67

Compression:

Stored size: 952 Bytes

Contents

module Udongo
  module WillPaginate
    class Options
      include ActionView::Helpers::TagHelper

      def initialize(options = {})
        @options = options || {}
      end

      def defaults
        {
          class: 'pagination',
          inner_window: 1,
          outer_window: 0,
          renderer: Udongo::WillPaginate::Renderer,
          previous_label: previous_label,
          next_label: next_label
        }
      end

      def next_label
        nav_label('→', 'next_label')
      end

      def previous_label
        nav_label('←', 'previous_label')
      end

      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

      def values
        @options.reverse_merge!(defaults)
      end
    end
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
udongo-7.9.0 lib/udongo/will_paginate/options.rb
udongo-7.8.1 lib/udongo/will_paginate/options.rb
udongo-7.8.0 lib/udongo/will_paginate/options.rb
udongo-7.7.2 lib/udongo/will_paginate/options.rb
udongo-7.7.1 lib/udongo/will_paginate/options.rb
udongo-7.7.0 lib/udongo/will_paginate/options.rb
udongo-7.6.2 lib/udongo/will_paginate/options.rb
udongo-7.6.1 lib/udongo/will_paginate/options.rb
udongo-7.6.0 lib/udongo/will_paginate/options.rb
udongo-7.5.1 lib/udongo/will_paginate/options.rb
udongo-7.5.0 lib/udongo/will_paginate/options.rb
udongo-7.4.2 lib/udongo/will_paginate/options.rb
udongo-7.4.1 lib/udongo/will_paginate/options.rb
udongo-7.4.0 lib/udongo/will_paginate/options.rb
udongo-7.3.5 lib/udongo/will_paginate/options.rb
udongo-7.3.4 lib/udongo/will_paginate/options.rb
udongo-7.3.3 lib/udongo/will_paginate/options.rb
udongo-7.3.2 lib/udongo/will_paginate/options.rb
udongo-7.3.1 lib/udongo/will_paginate/options.rb
udongo-7.2.1 lib/udongo/will_paginate/options.rb