From a9f2557c8d6e9d17316734ae481790fe77f6cdfc Mon Sep 17 00:00:00 2001 From: YarekTenko Date: Mon, 27 Mar 2017 10:08:19 -0700 Subject: [PATCH] Add views for Paginator module -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. --- app/views/shared/_blocks.html.erb | 5 ++++ app/views/shared/_paginator.html.erb | 38 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 app/views/shared/_blocks.html.erb create mode 100644 app/views/shared/_paginator.html.erb diff --git a/app/views/shared/_blocks.html.erb b/app/views/shared/_blocks.html.erb new file mode 100644 index 0000000..530ac74 --- /dev/null +++ b/app/views/shared/_blocks.html.erb @@ -0,0 +1,5 @@ +<%= + content_tag :li, class: page_item_css_class do + link_to page, bets_path(page: page), class: 'page-link' + end +%> diff --git a/app/views/shared/_paginator.html.erb b/app/views/shared/_paginator.html.erb new file mode 100644 index 0000000..842f295 --- /dev/null +++ b/app/views/shared/_paginator.html.erb @@ -0,0 +1,38 @@ +
+
    + <%= + content_tag :li, class: previous_link_css_class 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_class 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_class: page_item_css_class(page, current_page) %> + <% end %> + + <%= + content_tag :li, class: next_link_css_class 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_class do + link_to bets_path(page: last_page), class: 'page-link' do + content_tag :i, nil, class: 'fa fa-angle-double-right' + end + end + %> +
+