To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / helpers / members_helper.rb @ 1566:ac2e4a54a6a6

History | View | Annotate | Download (1.59 KB)

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

    
20
module MembersHelper
21
  def render_principals_for_new_members(project)
22
    scope = Principal.active.sorted.not_member_of(project).like(params[:q])
23
    principal_count = scope.count
24
    principal_pages = Redmine::Pagination::Paginator.new principal_count, 100, params['page']
25
    principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
26

    
27
    s = content_tag('div', principals_check_box_tags('membership[user_ids][]', principals), :id => 'principals')
28

    
29
    links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options|
30
      link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
31
    }
32

    
33
    s + content_tag('p', links, :class => 'pagination')
34
  end
35
end