Skip to content

Commit

Permalink
Add views for Paginator module
Browse files Browse the repository at this point in the history
-Add _blocks.html.erb view that renders page blocks;
-Add _paginator.html.erb view that renders the pagination panel for the
current page of a given Model.
  • Loading branch information
LeonTenko committed Apr 5, 2017
1 parent c30d7f4 commit 5a5299c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/views/shared/_blocks.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%=
content_tag :li, class: page_item_css do
link_to page, bets_path(page: page), class: 'page-link'
end
%>
38 changes: 38 additions & 0 deletions app/views/shared/_paginator.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<div class="paginator">
<ol class="pagination">
<%=
content_tag :li, class: previous_link_css do
link_to bets_path(page: '1'), class: 'page-link' do
content_tag :i, nil, class: 'fa fa-angle-double-left'
end
end
%>
<%=
content_tag :li, class: previous_link_css do
link_to bets_path(page: current_page - 1), class: 'page-link' do
content_tag :i, nil, class: 'fa fa-angle-left'
end
end
%>

<% blocks.each do |page|%>
<%= render 'shared/blocks', page: page,
page_item_css: page_item_css(page, current_page) %>
<% end %>

<%=
content_tag :li, class: next_link_css do
link_to bets_path(page: current_page + 1), class: 'page-link' do
content_tag :i, nil, class: 'fa fa-angle-right'
end
end
%>
<%=
content_tag :li, class: next_link_css do
link_to bets_path(page: last_page), class: 'page-link' do
content_tag :i, nil, class: 'fa fa-angle-double-right'
end
end
%>
</ol>
</div>

0 comments on commit 5a5299c

Please sign in to comment.