From 97dd339bbb53fec10f2c9a93250fdb9af6236bcd Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Fri, 8 Jul 2011 14:59:23 -0700 Subject: [PATCH] [#191] Refactor: extract methods to helper --- app/helpers/search_helper.rb | 10 ++++++++++ app/views/search/index.rhtml | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 414e4391..98fc27fa 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -57,4 +57,14 @@ module SearchHelper end ('') unless links.empty? end + + def link_to_previous_search_page(pagination_previous_date) + link_to_content_update('« ' + l(:label_previous), + params.merge(:previous => 1, :offset => pagination_previous_date.strftime("%Y%m%d%H%M%S"))) + end + + def link_to_next_search_page(pagination_next_date) + link_to_content_update(l(:label_next) + ' »', + params.merge(:previous => nil, :offset => pagination_next_date.strftime("%Y%m%d%H%M%S"))) + end end diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index 674cabf6..8e9e556c 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -38,12 +38,10 @@

<% if @pagination_previous_date %> -<%= link_to_content_update('« ' + l(:label_previous), - params.merge(:previous => 1, :offset => @pagination_previous_date.strftime("%Y%m%d%H%M%S"))) %>  + <%= link_to_previous_search_page(@pagination_previous_date) %>  <% end %> <% if @pagination_next_date %> -<%= link_to_content_update(l(:label_next) + ' »', - params.merge(:previous => nil, :offset => @pagination_next_date.strftime("%Y%m%d%H%M%S"))) %> + <%= link_to_next_search_page(@pagination_next_date) %> <% end %>