You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

members_helper.rb 1.6KB

1234567891011121314151617181920212223242526272829303132333435
  1. # encoding: utf-8
  2. #
  3. # Redmine - project management software
  4. # Copyright (C) 2006-2014 Jean-Philippe Lang
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License
  8. # as published by the Free Software Foundation; either version 2
  9. # of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. module MembersHelper
  20. def render_principals_for_new_members(project)
  21. scope = Principal.active.sorted.not_member_of(project).like(params[:q])
  22. principal_count = scope.count
  23. principal_pages = Redmine::Pagination::Paginator.new principal_count, 100, params['page']
  24. principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
  25. s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals')
  26. links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options|
  27. link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
  28. }
  29. s + content_tag('p', links, :class => 'pagination')
  30. end
  31. end