Sha256: 7ea6269bb36e4a272fe1a9079e0a9a97556e447245afcde4603b8c912b48e0f0
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
module Paginate module Renderer class List < Base def previous_label I18n.t("paginate.previous") end def next_label I18n.t("paginate.next") end def page_label I18n.t("paginate.page", page: processor.page) end def render html = String.new css = %w[ paginate ] css << "disabled" unless processor.previous_page? || processor.next_page? html << %[<ul class="#{css.join(" ")}">] # Previous page if processor.previous_page? html << %[<li class="previous-page"><a href="#{previous_url}" title="#{previous_label}">#{previous_label}</a></li>] else html << %[<li class="previous-page disabled"><span title="#{previous_label}">#{previous_label}</span></li>] end # Current page html << %[<li class="page"><span>#{page_label}</span></li>] # Next page if processor.next_page? html << %[<li class="next-page"><a href="#{next_url}" title="#{next_label}">#{next_label}</a></li>] else html << %[<li class="next-page disabled"><span title="#{next_label}">#{next_label}</span></li>] end html << %[</ul>] html.html_safe end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
paginate-4.0.1 | lib/paginate/renderer/list.rb |
paginate-4.0.0 | lib/paginate/renderer/list.rb |
paginate-3.0.0 | lib/paginate/renderer/list.rb |