diff --git a/Gemfile b/Gemfile
index 3416bef..345908b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -42,6 +42,8 @@ gem 'net-ldap'
gem 'devise'
+gem "kaminari"
+
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 3bc7d56..cadddf0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -119,6 +119,18 @@ GEM
concurrent-ruby (~> 1.0)
jbuilder (2.10.1)
activesupport (>= 5.0.0)
+ kaminari (1.2.1)
+ activesupport (>= 4.1.0)
+ kaminari-actionview (= 1.2.1)
+ kaminari-activerecord (= 1.2.1)
+ kaminari-core (= 1.2.1)
+ kaminari-actionview (1.2.1)
+ actionview
+ kaminari-core (= 1.2.1)
+ kaminari-activerecord (1.2.1)
+ activerecord
+ kaminari-core (= 1.2.1)
+ kaminari-core (1.2.1)
listen (3.3.3)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
@@ -263,6 +275,7 @@ DEPENDENCIES
elasticsearch-persistence
elasticsearch-rails
jbuilder (~> 2.7)
+ kaminari
listen (~> 3.2)
net-ldap
nokogiri (= 1.11.0)
diff --git a/README.md b/README.md
index f042b92..0f00fbf 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ Pour injecter les metadonnées issues de LDAP :
rails metadata_mappings:import
```
-Pour injecter manuellement des mails dans le système :
+Pour injecter manuellement des mails dans le système (le serveur Rails doit tourner) :
```
for file in tmp/equipe-select/*.eml; do cat "${file}" | rails action_mailbox:ingress:postfix URL=http://0.0.0.0:3000/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=XXXXXXXX; done
diff --git a/app/controllers/emails_controller.rb b/app/controllers/emails_controller.rb
index dbe97e1..9bb4587 100644
--- a/app/controllers/emails_controller.rb
+++ b/app/controllers/emails_controller.rb
@@ -4,7 +4,7 @@ class EmailsController < ApplicationController
# GET /emails
# GET /emails.json
def index
- @emails = Email.all
+ @emails = Email.order(date: :desc).page(params[:page])
end
# GET /emails/1
diff --git a/app/views/emails/index.html.erb b/app/views/emails/index.html.erb
index 0255729..c1dd363 100644
--- a/app/views/emails/index.html.erb
+++ b/app/views/emails/index.html.erb
@@ -42,6 +42,8 @@
+<%= paginate @emails %>
+
<%= link_to 'New Email', new_email_path %>
diff --git a/app/views/emails/show.html.erb b/app/views/emails/show.html.erb
index 9abdbd5..3db9df7 100644
--- a/app/views/emails/show.html.erb
+++ b/app/views/emails/show.html.erb
@@ -56,7 +56,7 @@