class WillPaginate::ActionView::BootstrapLinkRenderer
Protected Instance Methods
gap()
click to toggle source
# File lib/generators/templates/app/initializers/link_renderer.rb, line 21 def gap text = @template.will_paginate_translate(:page_gap) { '…' } %(<a class="gap btn btn-default disabled">#{text}</a>) end
html_container(html)
click to toggle source
# File lib/generators/templates/app/initializers/link_renderer.rb, line 37 def html_container(html) '<ul class="pagination pagination-sm justify-content-end mb-0">' + html + '</ul>' end
page_number(page)
click to toggle source
# File lib/generators/templates/app/initializers/link_renderer.rb, line 9 def page_number(page) is_current_page = (page == current_page) temphtml = '<li class="page-item ' + (is_current_page ? 'active' : '') + '">' unless is_current_page temphtml += link(page, page, :rel => rel_value(page), :class => 'page-link') else temphtml += tag(:a, page, :class => 'current active page-link') end temphtml += '</li>' temphtml end
previous_or_next_page(page, text, classname)
click to toggle source
# File lib/generators/templates/app/initializers/link_renderer.rb, line 26 def previous_or_next_page(page, text, classname) temphtml = '<li class="page-item">' if page temphtml += link(text, page, :class => classname + ' page-link') else temphtml += tag(:a, text, :class => classname + ' page-link') end temphtml += '</li>' temphtml end
Private Instance Methods
link(text, target, attributes = {})
click to toggle source
# File lib/generators/templates/app/initializers/link_renderer.rb, line 47 def link(text, target, attributes = {}) if target.is_a? Fixnum attributes[:rel] = rel_value(target) target = url(target) end attributes[:href] = target tag(:a, text, attributes) end
param_name()
click to toggle source
# File lib/generators/templates/app/initializers/link_renderer.rb, line 43 def param_name @options[:param_name].to_s end