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-6.3.1 lib/udongo/will_paginate/options.rb
udongo-6.3.0 lib/udongo/will_paginate/options.rb
udongo-6.2.1 lib/udongo/will_paginate/options.rb
udongo-6.2.0 lib/udongo/will_paginate/options.rb
udongo-6.1.0 lib/udongo/will_paginate/options.rb
udongo-6.0.0 lib/udongo/will_paginate/options.rb
udongo-5.9.0 lib/udongo/will_paginate/options.rb
udongo-5.8.0 lib/udongo/will_paginate/options.rb
udongo-5.7.0 lib/udongo/will_paginate/options.rb
udongo-5.6.0 lib/udongo/will_paginate/options.rb
udongo-5.5.0 lib/udongo/will_paginate/options.rb
udongo-5.4.0 lib/udongo/will_paginate/options.rb
udongo-5.3.1 lib/udongo/will_paginate/options.rb
udongo-5.3.0 lib/udongo/will_paginate/options.rb
udongo-5.2.0 lib/udongo/will_paginate/options.rb
udongo-5.1.0 lib/udongo/will_paginate/options.rb
udongo-5.0.2 lib/udongo/will_paginate/options.rb
udongo-5.0.1 lib/udongo/will_paginate/options.rb
udongo-5.0.0 lib/udongo/will_paginate/options.rb
udongo-4.0.0 lib/udongo/will_paginate/options.rb