diff --git a/Pearlception/Gemfile b/Pearlception/Gemfile index e334ea2..882f710 100644 --- a/Pearlception/Gemfile +++ b/Pearlception/Gemfile @@ -36,6 +36,8 @@ gem 'bcrypt', '~> 3.1.7' # gem 'capistrano-rails', group: :development # for sign in sign up gem 'devise' +#for pagination +gem 'kaminari' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Pearlception/Gemfile.lock b/Pearlception/Gemfile.lock index 47ab8e3..e375e40 100644 --- a/Pearlception/Gemfile.lock +++ b/Pearlception/Gemfile.lock @@ -82,6 +82,18 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + kaminari (1.0.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.0.1) + kaminari-activerecord (= 1.0.1) + kaminari-core (= 1.0.1) + kaminari-actionview (1.0.1) + actionview + kaminari-core (= 1.0.1) + kaminari-activerecord (1.0.1) + activerecord + kaminari-core (= 1.0.1) + kaminari-core (1.0.1) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -201,6 +213,7 @@ DEPENDENCIES hirb-unicode jbuilder (~> 2.5) jquery-rails + kaminari listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) pry-byebug diff --git a/Pearlception/app/assets/images/ajax-loader.gif b/Pearlception/app/assets/images/ajax-loader.gif new file mode 100644 index 0000000..3eaeeca Binary files /dev/null and b/Pearlception/app/assets/images/ajax-loader.gif differ diff --git a/Pearlception/app/controllers/dashboard_controller.rb b/Pearlception/app/controllers/dashboard_controller.rb index bc5e667..10a757e 100644 --- a/Pearlception/app/controllers/dashboard_controller.rb +++ b/Pearlception/app/controllers/dashboard_controller.rb @@ -2,6 +2,7 @@ class DashboardController < ApplicationController before_filter :deny_to_visitors def index + @results = Result.page(params[:page]).per(5) end diff --git a/Pearlception/app/views/dashboard/index.html.erb b/Pearlception/app/views/dashboard/index.html.erb index 0c6abd8..fdaf05d 100644 --- a/Pearlception/app/views/dashboard/index.html.erb +++ b/Pearlception/app/views/dashboard/index.html.erb @@ -143,6 +143,12 @@ <% end %> +
+
+ <%= paginate @results %>
+ <%= page_entries_info @results %> +
+