[#191] Refactor: extract methods to helper

This commit is contained in:
Eric Davis 2011-07-08 14:59:23 -07:00
parent 4a3e32b0f4
commit 97dd339bbb
2 changed files with 12 additions and 4 deletions

View File

@ -57,4 +57,14 @@ module SearchHelper
end
('<ul>' + links.map {|link| content_tag('li', link)}.join(' ') + '</ul>') unless links.empty?
end
def link_to_previous_search_page(pagination_previous_date)
link_to_content_update('&#171; ' + 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) + ' &#187;',
params.merge(:previous => nil, :offset => pagination_next_date.strftime("%Y%m%d%H%M%S")))
end
end

View File

@ -38,12 +38,10 @@
<p><center>
<% if @pagination_previous_date %>
<%= link_to_content_update('&#171; ' + l(:label_previous),
params.merge(:previous => 1, :offset => @pagination_previous_date.strftime("%Y%m%d%H%M%S"))) %>&nbsp;
<%= link_to_previous_search_page(@pagination_previous_date) %>&nbsp;
<% end %>
<% if @pagination_next_date %>
<%= link_to_content_update(l(:label_next) + ' &#187;',
params.merge(:previous => nil, :offset => @pagination_next_date.strftime("%Y%m%d%H%M%S"))) %>
<%= link_to_next_search_page(@pagination_next_date) %>
<% end %>
</center></p>