From 0d78ef90a85d11a0bd5d9c092292c829968470ab Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Sun, 24 Feb 2013 10:10:03 +1100 Subject: Extract method --- app/controllers/application_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f3deeb64a..f5d6cbf18 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -562,6 +562,11 @@ class ApplicationController < ActionController::Base def set_popup_banner @popup_banner = render_to_string(:partial => "general/popup_banner").strip.html_safe end + + def alaveteli_git_commit + `git log -1 --format="%H"`.strip + end + # URL generating functions are needed by all controllers (for redirects), # views (for links) and mailers (for use in emails), so include them into # all of all. -- cgit v1.2.3 From 060d9fe70a1de0ba9aa592d25d6e7352114aa431 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 25 Mar 2013 16:17:03 +1100 Subject: Inline method InfoRequest.full_search --- app/controllers/application_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index df522519d..4f3624ab7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -378,7 +378,13 @@ class ApplicationController < ActionController::Base else @page = this_page end - result = InfoRequest.full_search(models, @query, order, ascending, collapse, @per_page, @page) + result = ActsAsXapian::Search.new(models, @query, + :offset => (@page - 1) * @per_page, + :limit => @per_page, + :sort_by_prefix => order, + :sort_by_ascending => ascending, + :collapse_by_prefix => collapse + ) result.results # Touch the results to load them, otherwise accessing them from the view # might fail later if the database has subsequently been reopened. return result -- cgit v1.2.3 From 9727c7b62fd3fe7b00cfc64cb4b36ba445a3a960 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 25 Mar 2013 16:28:14 +1100 Subject: Tiny refactor --- app/controllers/application_controller.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4f3624ab7..a2951bb42 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -373,11 +373,8 @@ class ApplicationController < ActionController::Base # Peform the search @per_page = per_page - if this_page.nil? - @page = get_search_page_from_params - else - @page = this_page - end + @page = this_page || get_search_page_from_params + result = ActsAsXapian::Search.new(models, @query, :offset => (@page - 1) * @per_page, :limit => @per_page, -- cgit v1.2.3