From 0721f013d099c1dd3ba42115fc72330056ba7090 Mon Sep 17 00:00:00 2001 From: Rafael Michels Motta Date: Tue, 24 Jan 2017 14:05:19 -0200 Subject: [PATCH 1/4] Bootstrap 4 support --- app/views/kaminari/.DS_Store | Bin 0 -> 6148 bytes .../twitter-bootstrap-4/_first_page.html.erb | 13 +++++++++ .../twitter-bootstrap-4/_gap.html.erb | 8 ++++++ .../twitter-bootstrap-4/_last_page.html.erb | 13 +++++++++ .../twitter-bootstrap-4/_next_page.html.erb | 13 +++++++++ .../twitter-bootstrap-4/_page.html.erb | 12 ++++++++ .../twitter-bootstrap-4/_paginator.html.erb | 26 ++++++++++++++++++ .../twitter-bootstrap-4/_prev_page.html.erb | 13 +++++++++ 8 files changed, 98 insertions(+) create mode 100644 app/views/kaminari/.DS_Store create mode 100644 app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb create mode 100644 app/views/kaminari/twitter-bootstrap-4/_gap.html.erb create mode 100644 app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb create mode 100644 app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb create mode 100644 app/views/kaminari/twitter-bootstrap-4/_page.html.erb create mode 100644 app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb create mode 100644 app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb diff --git a/app/views/kaminari/.DS_Store b/app/views/kaminari/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1b266bafd07550c4c9e1cf7e9b57677ad6d92c66 GIT binary patch literal 6148 zcmeHK!AiqG5PhRP6g*h)B6!)e;Gy6Lgc84?KcF_ELPJ7L@tTu=u zIy~c%dN==uy(hK}ZqRa1m+Slaa@EwWZR7ZC|H!&2%WB)LfVbE4mmI(6H|wVQW@P)Y zo2@5psfP{*f`MQl82H}|@Xl759vOxX27-ZL;FAG89}=5l;n*AIqk}4!07QL8XQ8dN zgvKPt!m&5x3`H!IXrbaIhFCbqllv8py`hCey!a6R@<;I^`RiOiWp_wn7&;gT28IkA zT6d=R{}q3k(IS5s61`v`82Doh$fR7B3vSBq)-T)ByEd_1v#F?GuLgzo;1R%%o+GDu d(&m%e^eY^DLtRD3b2u>`0-2Cd!N3nN@D9lqJU##b literal 0 HcmV?d00001 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..685c395 --- /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..2bcc522 --- /dev/null +++ b/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb @@ -0,0 +1,8 @@ +<%# 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') %>
  • \ No newline at end of file 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..9c3f939 --- /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..0cab28b --- /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..c577378 --- /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..bbbd024 --- /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 %> From 494a63ef1262d660c94711471951680ec38537bc Mon Sep 17 00:00:00 2001 From: Rafael Michels Motta Date: Tue, 24 Jan 2017 14:14:57 -0200 Subject: [PATCH 2/4] Fix pagination class --- app/views/kaminari/.DS_Store | Bin 6148 -> 6148 bytes .../twitter-bootstrap-4/_first_page.html.erb | 2 +- .../twitter-bootstrap-4/_last_page.html.erb | 2 +- .../twitter-bootstrap-4/_next_page.html.erb | 2 +- .../twitter-bootstrap-4/_page.html.erb | 2 +- .../twitter-bootstrap-4/_prev_page.html.erb | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/kaminari/.DS_Store b/app/views/kaminari/.DS_Store index 1b266bafd07550c4c9e1cf7e9b57677ad6d92c66..44494a8e77de039da4ba89f35bceab9bc27b4c8e 100644 GIT binary patch delta 18 ZcmZoMXffE}%E;(Dxq(q <% 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/_last_page.html.erb b/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb index 9c3f939..03f9ed9 100644 --- a/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +++ b/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb @@ -7,7 +7,7 @@ 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 index 0cab28b..421ab45 100644 --- a/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +++ b/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb @@ -7,7 +7,7 @@ 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 index c577378..f21be40 100644 --- a/app/views/kaminari/twitter-bootstrap-4/_page.html.erb +++ b/app/views/kaminari/twitter-bootstrap-4/_page.html.erb @@ -7,6 +7,6 @@ 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/_prev_page.html.erb b/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb index bbbd024..5e7ff4d 100644 --- a/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +++ b/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb @@ -7,7 +7,7 @@ remote: data-remote -%> <% unless current_page.first? %> - <% end %> From d1f82baa59711b2cbe5d710fe99ac315152547b0 Mon Sep 17 00:00:00 2001 From: Rafael Michels Motta Date: Tue, 24 Jan 2017 14:20:10 -0200 Subject: [PATCH 3/4] Bootstrap 4 readme --- README.rdoc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 From e8d57b2fbf56607731c6c9bf254f24f38ce2beec Mon Sep 17 00:00:00 2001 From: Rafael Michels Motta Date: Tue, 24 Jan 2017 14:44:02 -0200 Subject: [PATCH 4/4] Fix truncate --- app/views/kaminari/twitter-bootstrap-4/_gap.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb b/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb index 2bcc522..62993d4 100644 --- a/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb +++ b/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb @@ -5,4 +5,6 @@ per_page: number of items to fetch per page remote: data-remote -%> -
  • <%= raw(t 'views.pagination.truncate') %>
  • \ No newline at end of file +
  • + <%= raw(t 'views.pagination.truncate') %> +