@project_count = Project.count(:conditions => conditions)
@project_pages = Paginator.new self, @project_count,
- 25,
+ per_page_option,
params['page']
@projects = Project.find :all, :order => sort_clause,
:conditions => conditions,
attachments
end
+ # Returns the number of objects that should be displayed
+ # on the paginated list
+ def per_page_option
+ per_page = nil
+ if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i)
+ per_page = params[:per_page].to_s.to_i
+ session[:per_page] = per_page
+ elsif session[:per_page]
+ per_page = session[:per_page]
+ else
+ per_page = Setting.per_page_options_array.first || 25
+ end
+ per_page
+ end
+
# qvalues http header parser
# code taken from webrick
def parse_qvalues(value)
sort_update
@topic_count = @board.topics.count
- @topic_pages = Paginator.new self, @topic_count, 25, params['page']
+ @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page']
@topics = @board.topics.find :all, :order => "#{Message.table_name}.sticky DESC, #{sort_clause}",
:include => [:author, {:last_reply => :author}],
:limit => @topic_pages.items_per_page,
sort_update
retrieve_query
if @query.valid?
- limit = %w(pdf csv).include?(params[:format]) ? Setting.issues_export_limit.to_i : 25
+ limit = %w(pdf csv).include?(params[:format]) ? Setting.issues_export_limit.to_i : per_page_option
@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
@issue_pages = Paginator.new self, @issue_count, limit, params['page']
@issues = Issue.find :all, :order => sort_clause,
def revisions
@changeset_count = @repository.changesets.count
@changeset_pages = Paginator.new self, @changeset_count,
- 25,
+ per_page_option,
params['page']
@changesets = @repository.changesets.find(:all,
:limit => @changeset_pages.items_per_page,
@user_count = User.count(:conditions => conditions)
@user_pages = Paginator.new self, @user_count,
- 15,
+ per_page_option,
params['page']
@users = User.find :all,:order => sort_clause,
:conditions => conditions,
@page = @wiki.find_page(params[:page])
@version_count = @page.content.versions.count
- @version_pages = Paginator.new self, @version_count, 25, params['p']
+ @version_pages = Paginator.new self, @version_count, per_page_option, params['p']
# don't load text
@versions = @page.content.versions.find :all,
:select => "id, author_id, comments, updated_on, version",
l(:actionview_datehelper_select_month_names).split(',')[month-1]
end
- def pagination_links_full(paginator, options={}, html_options={})
+ def pagination_links_full(paginator, count=nil, options={})
page_param = options.delete(:page_param) || :page
-
+ url_param = params.dup
+
html = ''
html << link_to_remote(('« ' + l(:label_previous)),
- {:update => "content", :url => options.merge(page_param => paginator.current.previous)},
- {:href => url_for(:params => options.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous
+ {:update => "content", :url => url_param.merge(page_param => paginator.current.previous)},
+ {:href => url_for(:params => url_param.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous
html << (pagination_links_each(paginator, options) do |n|
link_to_remote(n.to_s,
- {:url => {:params => options.merge(page_param => n)}, :update => 'content'},
- {:href => url_for(:params => options.merge(page_param => n))})
+ {:url => {:params => url_param.merge(page_param => n)}, :update => 'content'},
+ {:href => url_for(:params => url_param.merge(page_param => n))})
end || '')
html << ' ' + link_to_remote((l(:label_next) + ' »'),
- {:update => "content", :url => options.merge(page_param => paginator.current.next)},
- {:href => url_for(:params => options.merge(page_param => paginator.current.next))}) if paginator.current.next
+ {:update => "content", :url => url_param.merge(page_param => paginator.current.next)},
+ {:href => url_for(:params => url_param.merge(page_param => paginator.current.next))}) if paginator.current.next
+
+ unless count.nil?
+ html << [" (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})", per_page_links(paginator.items_per_page)].compact.join(' | ')
+ end
+
html
end
+ def per_page_links(selected=nil)
+ links = Setting.per_page_options_array.collect do |n|
+ n == selected ? n : link_to_remote(n, {:update => "content", :url => params.dup.merge(:per_page => n)},
+ {:href => url_for(params.dup.merge(:per_page => n))})
+ end
+ links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil
+ end
+
def set_html_title(text)
@html_header_title = text
end
class_eval src, __FILE__, __LINE__
end
+ # Helper that returns an array based on per_page_options setting
+ def self.per_page_options_array
+ per_page_options.split(%r{[\s,]}).collect(&:to_i).select {|n| n > 0}.sort
+ end
+
# Checks if settings have changed since the values were read
# and clears the cache hash if it's the case
# Called once per request
</tbody>
</table>
-<p><%= pagination_links_full @project_pages, :status => @status %>
-[ <%= @project_pages.current.first_item %> - <%= @project_pages.current.last_item %> / <%= @project_count %> ]</p>
+<p class="pagination"><%= pagination_links_full @project_pages, @project_count %></p>
<% set_html_title l(:label_project_plural) -%>
</tbody>
</table>
-<%= pagination_links_full @auth_source_pages %>
+<p class="pagination"><%= pagination_links_full @auth_source_pages %></p>
<% end %>
</tbody>
</table>
-<p><%= pagination_links_full @topic_pages %>
-[ <%= @topic_pages.current.first_item %> - <%= @topic_pages.current.last_item %> / <%= @topic_count %> ]</p>
+<p class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></p>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</tbody>
</table>
-<%= pagination_links_full @issue_status_pages %>
+<p class="pagination"><%= pagination_links_full @issue_status_pages %></p>
<% set_html_title(l(:label_issue_status_plural)) -%>
<%= link_to 'CSV', {:format => 'csv'}, :class => 'icon icon-csv' %>,
<%= link_to 'PDF', {:format => 'pdf'}, :class => 'icon icon-pdf' %>
</div>
-<p><%= pagination_links_full @issue_pages %>
-[ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]</p>
+<p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p>
<% end %>
<% end %>
<% end %>
<%= textilizable(news.description) %>
<% end %>
<% end %>
-<%= pagination_links_full @news_pages %>
+<p class="pagination"><%= pagination_links_full @news_pages %></p>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<% end %>
</tbody>
</table>
-<p><%= pagination_links_full @changes_pages, :rev => @changeset.revision %>
-[ <%= @changes_pages.current.first_item %> - <%= @changes_pages.current.last_item %> / <%= @changes_count %> ]</p>
+<p class="pagination"><%= pagination_links_full @changes_pages %></p>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%>
-<p><%= pagination_links_full @changeset_pages %>
-[ <%= @changeset_pages.current.first_item %> - <%= @changeset_pages.current.last_item %> / <%= @changeset_count %> ]</p>
+<p class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></p>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
</tbody>
</table>
-<p><%= pagination_links_full @role_pages %></p>
+<p class="pagination"><%= pagination_links_full @role_pages %></p>
<p><%= link_to l(:label_permissions_report), :action => 'report' %></p>
<p><label><%= l(:setting_attachment_max_size) %></label>
<%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB</p>
+<p><label><%= l(:setting_per_page_options) %></label>
+<%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %><br /><em><%= l(:text_comma_separated) %></em></p>
+
<p><label><%= l(:setting_issues_export_limit) %></label>
<%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p>
</tbody>
</table>
-<%= pagination_links_full @tracker_pages %>
+<p class="pagination"><%= pagination_links_full @tracker_pages %></p>
<% set_html_title(l(:label_tracker_plural)) -%>
</tbody>
</table>
-<p><%= pagination_links_full @user_pages, :status => @status %>
-[ <%= @user_pages.current.first_item %> - <%= @user_pages.current.last_item %> / <%= @user_count %> ]
-</p>
+<p class="pagination"><%= pagination_links_full @user_pages, @user_count %></p>
<% set_html_title(l(:label_user_plural)) -%>
</tbody>
</table>
<%= submit_tag l(:label_view_diff), :class => 'small' %>
-<%= pagination_links_full @version_pages, :page_param => :p %>
-[ <%= @version_pages.current.first_item %> - <%= @version_pages.current.last_item %> / <%= @version_count %> ]
+<span class="pagination"><%= pagination_links_full @version_pages, @version_count, :page_param => :p %></span>
<% end %>
issues_export_limit:
format: int
default: 500
+per_page_options:
+ default: '25,50,100'
mail_from:
default: redmine@somenet.foo
bcc_recipients:
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
setting_repositories_encodings: Repositories encodings
setting_emails_footer: Emails footer
setting_protocol: Protocol
+setting_per_page_options: Objects per page options
label_user: User
label_user_plural: Users
label_registration_activation_by_email: account activation by email
label_registration_manual_activation: manual account activation
label_registration_automatic_activation: automatic account activation
+label_display_per_page: 'Per page: %s'
button_login: Login
button_submit: Submit
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
setting_repositories_encodings: Encodages des dépôts
setting_emails_footer: Pied-de-page des emails
setting_protocol: Protocole
+setting_per_page_options: Options d'objets affichés par page
label_user: Utilisateur
label_user_plural: Utilisateurs
label_registration_activation_by_email: activation du compte par email
label_registration_manual_activation: activation manuelle du compte
label_registration_automatic_activation: activation automatique du compte
+label_display_per_page: 'Par page: %s'
button_login: Connexion
button_submit: Soumettre
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: 注釈
label_issues_by: %s別の問題
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Adnotuj
label_issues_by: Zagadnienia wprowadzone przez %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate\r
label_issues_by: Issues by %s\r
field_searchable: Searchable\r
+label_display_per_page: 'Per page: %s'\r
+setting_per_page_options: Objects per page options\r
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (time tracking)
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
button_annotate: Annotate
label_issues_by: Issues by %s
field_searchable: Searchable
+label_display_per_page: 'Per page: %s'
+setting_per_page_options: Objects per page options
.autoscroll {overflow-x: auto; padding:1px; width:100%; margin-bottom: 1.2em;}
#user_firstname, #user_lastname, #user_mail, #my_account_form select { width: 90%; }
+.pagination {font-size: 90%}
+p.pagination {margin-top:8px;}
+
/***** Tabular forms ******/
.tabular p{
margin: 0;