socialforge/app/helpers/contest_members_helper.rb

18 lines
950 B
Ruby

#encoding=utf-8
module ContestMembersHelper
def find_user_not_in_current_contest_by_name contest
if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of_contest(contest).like(params[:q])
else
scope = []
end
principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals', :class => 'sy_new_tchlist')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
link_to text, host_with_protocol + "/contest_members/contest_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:contest=> contest, :format => 'js').to_query, :remote => true
}
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "contest_member_pagination_links" )
end
end