Sha256: 60ab95d7eb45393dbb2c5aa85014b468c034e48e627cdd4502aad5f11d2c9fa5
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'will_paginate/view_helpers/action_view' module Coalla class LinkRenderer < WillPaginate::ActionView::LinkRenderer protected def html_container(html) tag(:div, tag(:ul, html, class: 'pagination'), class: 't-center') end def page_number(page) if page == current_page tag(:li, tag(:a, page), class: 'active') else tag(:li, link(page, page, rel: rel_value(page))) end end def gap text = @template.will_paginate_translate(:page_gap) { '…' } tag(:li, tag(:a, text), class: 'disabled') end def previous_page num = @collection.current_page > 1 && @collection.current_page - 1 previous_or_next_page(num, @options[:previous_label]) end def next_page num = @collection.current_page < @collection.total_pages && @collection.current_page + 1 previous_or_next_page(num, @options[:next_label]) end def previous_or_next_page(page, text) if page tag(:li, link(text, page)) else tag(:li, tag(:a, text), class: 'disabled') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
coalla-cms-0.7.0.0 | lib/coalla/builders/link_renderer.rb |
coalla-cms-0.6.1.1 | lib/coalla/builders/link_renderer.rb |
coalla-cms-0.6.0.9 | lib/coalla/builders/link_renderer.rb |