# Options :
# :id HTML id of the <tfoot> node
# :colspan number of columns in the table
+ # :url_results url to display on the number of results
# :include_loading_icon add a hidden loading icon, only if value is true and if the option :id is set as well. The HTML id of the generated icon
# is '<id>_loading'
def paginate_java(pagination, options={}, &block)
total = pagination.total.to_i
page_index = pagination.pageIndex() ? pagination.pageIndex().to_i : 1
pages = pagination.pages().to_i
+ results_html = options[:url_results] ? message('x_results', :params => "<a href='#{options[:url_results]}'>#{total}</a>") : message('x_results', :params => [total])
html = '<tfoot'
html += " id='#{options[:id]}'" if options[:id]
html += '<div'
html += " id='#{options[:id]}_pages'" if options[:id]
html += '>'
- html += message('x_results', :params => [total]) if total>0
+ html += results_html if total>0
if pages > 1
max_pages = pages
link_params[:widget_id] = widget_id
link_params[:period] = params[:period]
%>
- <%= paginate_java(paging, :colspan => 4, :id => "issue-filter-foot-#{widget_id}", :include_loading_icon => true) { |label, page_id|
+ <%= paginate_java(paging, :colspan => 4, :id => "issue-filter-foot-#{widget_id}", :include_loading_icon => true,
+ :url_results => url_for({:controller => 'issues', :action => 'search' }.merge(search_options)) ) { |label, page_id|
link_to_remote(label,
:update => "issues-widget-#{widget_id}",
:url => link_params.merge({:pageIndex => page_id}))