socialforge/app/helpers/syllabus_member_helper.rb

18 lines
965 B
Ruby
Raw Normal View History

2016-09-23 09:22:47 +08:00
module SyllabusMemberHelper
include ApplicationHelper
def find_user_not_in_current_syllabus_by_name syllabus
if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of_syllabus(syllabus).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 + "/syllabus_member/syl_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:syllabus=> syllabus, :format => 'js').to_query, :remote => true
}
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "syllabus_member_pagination_links" )
end
end