diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-18 17:57:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-18 17:57:16 +0000 |
commit | 1257f1960ff6d59b2f3f7890777d3481f1800430 (patch) | |
tree | 6be67b6fc92cb8a408ed002fc6fe219ea566bb9a /app/helpers/members_helper.rb | |
parent | 10c96dba8b79822e1d54ef58bb8139851cf30c80 (diff) | |
download | redmine-1257f1960ff6d59b2f3f7890777d3481f1800430.tar.gz redmine-1257f1960ff6d59b2f3f7890777d3481f1800430.zip |
Adds pagination to users list when adding project or group members (#9549).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11200 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/members_helper.rb')
-rw-r--r-- | app/helpers/members_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index d56fc6179..eb06a3977 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -18,4 +18,18 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module MembersHelper + def render_principals_for_new_members(project) + scope = Principal.active.not_member_of(project).like(params[:q]).order('type, login, lastname ASC') + principal_count = scope.count + principal_pages = Redmine::Pagination::Paginator.new principal_count, 100, params['page'] + principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all + + s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals') + + links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| + link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true + } + + s + content_tag('p', links, :class => 'pagination') + end end |