@ -9,7 +9,7 @@ module HomeworkAttachHelper
end
#作业添加、编辑界面的tab页
def homework_settings_tabs f
@project = Project . find 205
@project = Project . find 76
@f = f
tabs = [ { :name = > 'info' , :action = > :edit_homework , :partial = > 'homework_attach/edit_homework' , :label = > :label_information_plural } ,
{ :name = > 'members' , :action = > :homework_member , :partial = > 'homework_attach/homework_member' , :label = > :label_member_plural }
@ -17,18 +17,27 @@ module HomeworkAttachHelper
#tabs.select {|tab| User.current.allowed_to?(tab[:action], @homework)}
end
def render_principals_for_new_members ( project )
scope = Principal . active . sorted . not_member_of ( project ) . like ( params [ :q ] )
principal_count = scope . count
principal_pages = Redmine :: Pagination :: Paginator . new principal_count , 10 , params [ 'page' ] #by young
principal s = scope . offset ( principal_pages . offset ) . limit ( principal_pages . per_page ) . all
s = content_tag ( 'div' , principals_check_box_tags_ex ( '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
}
#作业可选成员列表分页
def render_new_members_for_homework members
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
#scope = project.members
principal _count = members . count
limit = 10
principal_pages = Redmine :: Pagination :: Paginator . new principal_count , limit , params [ 'page' ] #by young
offset || = principal_pages . offset
principals = members [ offset , limit ]
s = content_tag ( 'div' , member_check_box_tags_ex ( 'membership[user_ids][]' , principals ) , :id = > 'principals' )
links = pagination_links_full ( principal_pages , principal_count , :per_page_links = > false , :remote = > true )
s + content_tag ( 'div' , content_tag ( 'ul' , links ) , :class = > 'pagination_new' )
end
#扩展的checkbox生成
def member_check_box_tags_ex ( name , principals )
s = ''
principals . each do | member |
s << " <label> #{ check_box_tag name , member . id , false , :id = > nil } #{ h member . user . name } </label> \n "
end
s . html_safe
end
end