From 3d4d97f66c8edb949d481e2d43995c0bfd8c50cf Mon Sep 17 00:00:00 2001 From: Meutel Date: Mon, 29 Jun 2015 20:08:57 +0200 Subject: [PATCH] fix ajax pagination --- app/helpers/application_helper.rb | 4 ++++ app/views/authors/index.js.erb | 1 + app/views/books/index.js.erb | 1 + app/views/series/index.js.erb | 1 + 4 files changed, 7 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..f2de255 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,6 @@ module ApplicationHelper + + # set per_page globally + WillPaginate.per_page = 10 + end diff --git a/app/views/authors/index.js.erb b/app/views/authors/index.js.erb index 41478db..4d33523 100644 --- a/app/views/authors/index.js.erb +++ b/app/views/authors/index.js.erb @@ -1 +1,2 @@ $("#items").html("<%= escape_javascript(render('authors/index')) %>"); +$(".pagination").find("a").attr("data-remote", true); diff --git a/app/views/books/index.js.erb b/app/views/books/index.js.erb index 71a51d0..425b2d3 100644 --- a/app/views/books/index.js.erb +++ b/app/views/books/index.js.erb @@ -1 +1,2 @@ $("#items").html("<%= escape_javascript(render('books/index')) %>"); +$(".pagination").find("a").attr("data-remote", true); diff --git a/app/views/series/index.js.erb b/app/views/series/index.js.erb index 4301451..93006ea 100644 --- a/app/views/series/index.js.erb +++ b/app/views/series/index.js.erb @@ -1 +1,2 @@ $("#items").html("<%= escape_javascript(render('series/index')) %>"); +$(".pagination").find("a").attr("data-remote", true);