Sha256: 029342a38e6df1822495e005bc5a8e92db61c7f238f957d36c373b63e5870b83
Contents?: true
Size: 837 Bytes
Versions: 6
Compression:
Stored size: 837 Bytes
Contents
module HtmlHelper def paginate list return unless list.respond_to?(:paginate_next) return nil if list.paginate_page == 1 && !list.paginate_next ret = ['<div class="paginate"><div>'] if list.paginate_page > 1 url = Url.current list.paginate_page == 1 ? url.delete(list.paginate_param) : url.qs(list.paginate_param, list.paginate_page-1) ret.push %[<a href="#{url.relative}">←</a>] else ret.push %[<span>←</span>] end ret.push %[<i>#{list.paginate_page == 1 ? '•' : list.paginate_page}</i>] if list.paginate_next url = Url.current url.qs(list.paginate_param, list.paginate_page+1) ret.push %[<a href="#{url.relative}">→</a>] else ret.push %[<span>→</span>] end ret.push '</div></div>' ret.join('') end end
Version data entries
6 entries across 6 versions & 1 rubygems