diff --git a/README.rdoc b/README.rdoc index 4a9cb49..241a707 100644 --- a/README.rdoc +++ b/README.rdoc @@ -2,7 +2,7 @@ {Gem Version}[http://badge.fury.io/rb/bootstrap-kaminari-views] -Basic Gem for quick default inclusion of {Kaminari}[https://github.com/amatsuda/kaminari] theme compatible with {Twitter Bootstrap 2.0}[http://getbootstrap.com/2.3.2/] and {Twitter Bootstrap 3.0}[http://getbootstrap.com] +Basic Gem for quick default inclusion of {Kaminari}[https://github.com/amatsuda/kaminari] theme compatible with {Twitter Bootstrap 2.0}[http://getbootstrap.com/2.3.2/], {Twitter Bootstrap 3.0}[http://getbootstrap.com] and {Twitter Bootstrap 4.0}[https://v4-alpha.getbootstrap.com] = Usage @@ -17,6 +17,8 @@ Render Pagination with a theme = paginate @posts, :theme => 'twitter-bootstrap-3' + = paginate @posts, :theme => 'twitter-bootstrap-4' + Render with specific pagination classes = paginate @posts, :theme => 'twitter-bootstrap-3', @@ -33,13 +35,13 @@ If you want to use one or more options as the default across your app, you can o module ApplicationHelper - + def paginate objects, options = {} options.reverse_merge!( theme: 'twitter-bootstrap' ) super( objects, options ) end - + end diff --git a/app/views/kaminari/.DS_Store b/app/views/kaminari/.DS_Store new file mode 100644 index 0000000..44494a8 Binary files /dev/null and b/app/views/kaminari/.DS_Store differ diff --git a/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb b/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb new file mode 100644 index 0000000..fb4841b --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.first? %> +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote, class: 'page-link' %> +
  • +<% end %> diff --git a/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb b/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb new file mode 100644 index 0000000..62993d4 --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb @@ -0,0 +1,10 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= raw(t 'views.pagination.truncate') %> +
  • diff --git a/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb b/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb new file mode 100644 index 0000000..03f9ed9 --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.last? %> + +<% end %> diff --git a/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb b/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb new file mode 100644 index 0000000..421ab45 --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.last? %> +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, class: 'page-link', :rel => 'next', :remote => remote %> +
  • +<% end %> diff --git a/app/views/kaminari/twitter-bootstrap-4/_page.html.erb b/app/views/kaminari/twitter-bootstrap-4/_page.html.erb new file mode 100644 index 0000000..f21be40 --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_page.html.erb @@ -0,0 +1,12 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= link_to page, url, opts = {class: 'page-link', :remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> +
  • diff --git a/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb b/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb new file mode 100644 index 0000000..404bf87 --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb @@ -0,0 +1,26 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%- pagination_class ||= '' %> +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb b/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb new file mode 100644 index 0000000..5e7ff4d --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Previous" page + - available local variables + url: url to the previous page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.first? %> + +<% end %>