Sha256: a84f081cbad2a58f3a42d833438532b2b307ad13f780f9766484ae7beec6bb79
Contents?: true
Size: 1.33 KB
Versions: 9
Compression:
Stored size: 1.33 KB
Contents
module Dugway module Filters module DefaultPagination def default_pagination(paginate, div_id = 'pagination', div_class = 'pagination', prev_label = nil, next_label = nil) Array.new.tap { |html| html << %(<div class="#{ div_class }" id="#{ div_id }">) prev_label = prev_label.blank? ? paginate['previous']['title'] : prev_label if paginate['previous']['is_link'] html << %(<a class="previous" href="#{ paginate['previous']['url'] }">#{ prev_label }</a>) else html << %(<span class="previous disabled">#{ prev_label }</span>) end paginate['parts'].each do |part| if part['is_link'] html << %(<a href="#{ part['url'] }">#{ part['title'] }</a>) else html << %(<span class="#{ part['title'] == paginate['current_page'].to_s ? 'current' : 'gap' }">#{ part['title'] }</span>) end end next_label = next_label.blank? ? paginate['next']['title'] : next_label if paginate['next']['is_link'] html << %(<a class="next" href="#{ paginate['next']['url'] }">#{ next_label }</a>) else html << %(<span class="next disabled">#{ next_label }</span>) end html << %(</div>) }.join(' ') end end end end
Version data entries
9 entries across 9 versions & 1 rubygems