summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-07 07:44:44 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-07 07:44:44 +0000
commit756eaeffb4d1b9fe14f9948b37589cfb97573c3a (patch)
tree0d414a2aa486fb71034b8edc9d386aa803519e9f
parentd1ad182192afe16eecf78361aa2bc0c8de3b0663 (diff)
downloadredmine-756eaeffb4d1b9fe14f9948b37589cfb97573c3a.tar.gz
redmine-756eaeffb4d1b9fe14f9948b37589cfb97573c3a.zip
Make search results per page configurable (#19005).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@13962 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/search_controller.rb4
-rw-r--r--app/views/settings/_general.html.erb2
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/fr.yml1
-rw-r--r--config/settings.yml2
5 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index a58092564..9bc9926bc 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -66,7 +66,9 @@ class SearchController < ApplicationController
@result_count_by_type = fetcher.result_count_by_type
@tokens = fetcher.tokens
- @result_pages = Paginator.new @result_count, 10, params['page']
+ per_page = Setting.search_results_per_page.to_i
+ per_page = 10 if per_page == 0
+ @result_pages = Paginator.new @result_count, per_page, params['page']
@results = fetcher.results(@result_pages.offset, @result_pages.per_page)
else
@question = ""
diff --git a/app/views/settings/_general.html.erb b/app/views/settings/_general.html.erb
index 9cba46ccb..9bfd23b53 100644
--- a/app/views/settings/_general.html.erb
+++ b/app/views/settings/_general.html.erb
@@ -11,6 +11,8 @@
<p><%= setting_text_field :per_page_options, :size => 20 %>
<em class="info"><%= l(:text_comma_separated) %></em></p>
+<p><%= setting_text_field :search_results_per_page, :size => 6 %>
+
<p><%= setting_text_field :activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p>
<p><%= setting_text_field :host_name, :size => 60 %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index afa401f10..93cf851ba 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -415,6 +415,7 @@ en:
setting_force_default_language_for_loggedin: Force default language for logged-in users
setting_link_copied_issue: Link issues on copy
setting_max_additional_emails: Maximum number of additional email addresses
+ setting_search_results_per_page: Search results per page
permission_add_project: Create project
permission_add_subprojects: Create subprojects
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 331737ca9..992992f22 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -435,6 +435,7 @@ fr:
setting_force_default_language_for_loggedin: Forcer la langue par défault pour les utilisateurs identifiés
setting_link_copied_issue: Lier les demandes lors de la copie
setting_max_additional_emails: Nombre maximal d'adresses email additionnelles
+ setting_search_results_per_page: Résultats de recherche affichés par page
permission_add_project: Créer un projet
permission_add_subprojects: Créer des sous-projets
diff --git a/config/settings.yml b/config/settings.yml
index a0f920da0..d2f0ff9bc 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -59,6 +59,8 @@ activity_days_default:
default: 30
per_page_options:
default: '25,50,100'
+search_results_per_page:
+ default: 10
mail_from:
default: redmine@example.net
bcc_recipients: