class UiBibz::Ui::Core::Navigations::Pagination
Create a Pagination
This element is an extend of UiBibz::Ui::Core::Component
.
Attributes¶ ↑
-
content
- Content of element -
options
- Options of element -
html_options
- Html Options of element
Options¶ ↑
You can add HTML attributes using the html_options
. You can pass arguments in options attribute:
-
position
- Symbol (:left
,:right
,:center
) -
size
(:sm
,:lg
)
Signatures¶ ↑
UiBibz::Ui::Core::Navigations::Pagination.new(content, options = nil, html_options = nil) UiBibz::Ui::Core::Navigations::Pagination.new(options = nil, html_options = nil).tap do |n| ... n.link content = nil, options = nil, html_options = nil, block n.link content = nil, options = nil, html_options = nil, block n.dropdown content = nil, options = nil, html_options = nil, block ... end
Examples¶ ↑
UiBibz::Ui::Core::Navigations::Pagination.new(type: :pills).tap do |n| n.link 'Test', url: '#test' n.link 'Test2', url: '#test2', state: :active n.dropdown('Action') do |d| d.list content = nil, options = nil, html_options = nil, &block end end.render
Helper¶ ↑
ui_pagination(options = {}, html_options = {}) do |n| n.link(content, options = {}, html_options = {}) n.link(options = {}, html_options = {}) do content end end
Public Class Methods
new(content = nil, options = nil, html_options = nil, &block)
click to toggle source
See UiBibz::Ui::Core::Component.initialize
Calls superclass method
UiBibz::Ui::Core::Component::new
# File lib/ui_bibz/ui/core/navigations/pagination.rb, line 59 def initialize(content = nil, options = nil, html_options = nil, &block) super @items = [] end
Public Instance Methods
link(content = nil, options = {}, html_options = nil, &block)
click to toggle source
Add nav link items See UiBibz::Ui::Core::Navigations::NavLink
# File lib/ui_bibz/ui/core/navigations/pagination.rb, line 73 def link(content = nil, options = {}, html_options = nil, &block) @items << PaginationLink.new(content, options, html_options, &block).render end
pre_render()
click to toggle source
Render html tag
# File lib/ui_bibz/ui/core/navigations/pagination.rb, line 65 def pre_render content_tag :nav do content_tag :ul, @items.join.html_safe, html_options end end
Private Instance Methods
component_html_classes()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/pagination.rb, line 79 def component_html_classes ['pagination', position, size] end
position()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/pagination.rb, line 83 def position case @options[:position] when :center 'justify-content-center' when :right 'justify-content-end' end end
size()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/pagination.rb, line 92 def size "pagination-#{@options[:size]}" if @options[:size] end