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/_pagination.html.erb b/app/views/search/_pagination.html.erb new file mode 100644 index 00000000..d06fe8eb --- /dev/null +++ b/app/views/search/_pagination.html.erb @@ -0,0 +1,10 @@ +
+

+ <% if pagination_previous_date %> + <%= link_to_previous_search_page(pagination_previous_date) %> + <% end %> + <% if pagination_next_date %> + <%= link_to_next_search_page(pagination_next_date) %> + <% end %> +

+
diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index 674cabf6..db9e3b64 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -24,6 +24,9 @@

<%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)

+ + <%= render :partial => 'pagination', :locals => {:pagination_previous_date => @pagination_previous_date, :pagination_next_date => @pagination_next_date } %> +
<% @results.each do |e| %>
@@ -36,15 +39,6 @@
<% end %> -

-<% 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"))) %>  -<% 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"))) %> -<% end %> -

+<%= render :partial => 'pagination', :locals => {:pagination_previous_date => @pagination_previous_date, :pagination_next_date => @pagination_next_date } %> <% html_title(l(:label_search)) -%> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 0c79cd64..a7087308 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -331,6 +331,9 @@ dt.time-entry { background-image: url(../images/time.png); } #search-results dt.issue.closed { background-image: url(../images/ticket_checked.png); } +.search-pagination { text-align: center; } +.search-pagination a {padding: 0 5px; } + div#roadmap .related-issues { margin-bottom: 1em; } div#roadmap .related-issues td.checkbox { display: none; } div#roadmap .wiki h1:first-child { display: none; }