Class: Grapple::Components::WillPaginatePagination
- Inherits:
-
HtmlComponent
- Object
- BaseComponent
- HtmlComponent
- Grapple::Components::WillPaginatePagination
- Defined in:
- lib/grapple/components/will_paginate_pagination.rb
Overview
Generates paging links using will_paginate.
Instance Attribute Summary
Attributes inherited from BaseComponent
#builder, #columns, #params, #records, #template
Instance Method Summary collapse
Methods inherited from BaseComponent
Constructor Details
This class inherits a constructor from Grapple::Components::BaseComponent
Instance Method Details
#render(paginate_parameters = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/grapple/components/will_paginate_pagination.rb', line 17 def render(paginate_parameters = {}) td_class = "" if records.instance_of?(Array) html = ' ' elsif !params[:query].blank? and records.empty? html = h(t()) td_class = "class='text-left'" else paginate_parameters[:param_name] = url_parameter(:page) if builder.namespace = { renderer: renderer }.select { |_, value| !value.nil? }.merge(paginate_parameters) html = template.will_paginate(records, ) || ' ' end builder.row "<td colspan=\"#{num_columns}\" #{td_class}>#{html}</td>" end |