Sha256: e96b374dbe6025ffcda9b97c0e2a08201f8dac2c3d9de0871bfeb807d60b3656

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8
module Sidekiq
  module Monitor
    module Web
      class PaginateRenderer < WillPaginate::Sinatra::LinkRenderer
        protected

        def html_container(html)
          tag :div, tag(:ul, html), :class => 'pagination pagination-right'
        end

        def page_number(page)
          tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
        end

        def gap
          tag :li, tag(:span, '&hellip;'), :class => 'gap'
        end

        def previous_page
          num = @collection.current_page > 1 && @collection.current_page - 1
          previous_or_next_page num, '«', 'previous_page'
        end

        def next_page
          num = @collection.current_page < total_pages && @collection.current_page + 1
          previous_or_next_page num, '»', 'next_page'
        end

        def previous_or_next_page(page, text, classname)
          tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ')
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-monitor-0.0.2 lib/sidekiq/monitor/web/paginate_renderer.rb