diff options
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 |