Sha256: 3528d7b8f0be581242e26817aaab69df7d303fd1591ee76b546cb1d1fef303a5

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

require "materialize_pagination/version"

module MaterializePagination
  # MaterializeCSS UI Framework WillPaginate LinkRenderer
  module MaterializeRenderer

    # @return [String] list of pagination links
    def html_container(html)
      tag :div, tag(:ul, html, :class => "pagination"), class: 'row'
    end

    # @return [String] rendered pagination link
    def page_number(page)
      classes = ['waves-effect', ('active' if page == current_page)].join(' ')

      list_item = tag :li, page, :class => classes
      link(list_item, page, :rel => rel_value(page))
    end

    # @return [String] rendered gap between pagination links
    def gap
      tag :li, link('…'.html_safe, '#'), :class => 'disabled'
    end

    # @return [String] rendered previous and next arrow links
    def previous_or_next_page(page, text, classname)
      classes = [(classname if @options[:page_links]), ('disabled' unless page)].join(' ')
      chevron_direction = classname == 'previous_page' ? 'left' : 'right'

      tag :li, link("<i class='material-icons'>chevron_#{chevron_direction}</i>".html_safe, page || '#!'), class: classes
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
will_paginate-materialize-0.1.2 lib/materialize_pagination/materialize_renderer.rb
will_paginate-materialize-0.1.1 lib/materialize_pagination/materialize_renderer.rb
will_paginate-materialize-0.1.0 lib/materialize_pagination/materialize_renderer.rb