From 756eaeffb4d1b9fe14f9948b37589cfb97573c3a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 7 Feb 2015 07:44:44 +0000 Subject: [PATCH] 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 --- app/controllers/search_controller.rb | 4 +++- app/views/settings/_general.html.erb | 2 ++ config/locales/en.yml | 1 + config/locales/fr.yml | 1 + config/settings.yml | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) 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 @@

<%= setting_text_field :per_page_options, :size => 20 %> <%= l(:text_comma_separated) %>

+

<%= setting_text_field :search_results_per_page, :size => 6 %> +

<%= setting_text_field :activity_days_default, :size => 6 %> <%= l(:label_day_plural) %>

<%= 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: -- 2.39.5