1、课程成员列表显示昵称

2、添加课程成员功能
This commit is contained in:
sw 2015-03-30 13:47:19 +08:00
parent 98bf8dd494
commit 083a3b9de6
4 changed files with 37 additions and 42 deletions

View File

@ -45,17 +45,14 @@ module MembersHelper
# 课程可添加的成员列表 # 课程可添加的成员列表
def render_principals_for_new_course_members(course) def render_principals_for_new_course_members(course)
scope = Principal.active.sorted.not_member_of_course(course).like(params[:q]) scope = Principal.active.sorted.not_member_of_course(course).like(params[:q])
principal_count = scope.count principals = paginateHelper scope,10
principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
principals = 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(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true) {|text, parameters, options|
links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options|
link_to text, autocomplete_course_memberships_path(course, parameters.merge(:q => params[:q], :format => 'js')), :remote => true link_to text, autocomplete_course_memberships_path(course, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
} }
s + content_tag('div', content_tag('ul', links), :class => 'pagination_new') s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links")
end end

View File

@ -17,38 +17,33 @@
</div><!-- 左边--> </div><!-- 左边-->
<div class="members_right"> <div class="members_right">
<p class="c_blue fb mt10 mb5">添加成员</p> <p class="c_blue fb mt10 mb5">添加成员</p>
<div class="member_search"> <%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
<input class="member_search_input fl" type="text" name="" value="输入用户名称搜索好友"> <div class="member_search">
<a class="invi_search_btn fl c_white" >搜索</a> <input hidden="hidden" value="true" name="flag">
<div class="cl"></div> <input id="principal_search" class="member_search_input fl" type="text" placeholder="请输入用户名称来搜索好友">
<ul class="mb5"> <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js',:flag => true) }')" %>
<li><input type="checkbox" name="" checked=""> <label >suntao</label> </li> <div class="cl"></div>
<li><input type="checkbox" name="" > <label >suntaoalibb</label> </li>
<li><input type="checkbox" name="" > <label >用户名称</label> </li> <div id="principals_for_new_member">
<li><input type="checkbox" name="" > <label >suntao</label> </li> <%= render_principals_for_new_course_members(@course) %>
<li><input type="checkbox" name="" checked=""> <label >suntao</label> </li> </div>
<li><input type="checkbox" name="" > <label >suntaoalibb</label> </li> <div class="cl"></div>
<li><input type="checkbox" name="" > <label >用户名称</label> </li>
<li><input type="checkbox" name="" > <label >suntao</label> </li> <ul class="rolebox mb10 mt10">
<li><input type="checkbox" name="" > <label >用户名称</label> </li> <li class="fb">
<li><input type="checkbox" name="" > <label >suntao</label> </li> <%= l(:label_role_plural) %>
</ul> </li>
<div class="cl"></div> <% @roles.each do |role| %>
<ul class="wlist mr40" > <li>
<li><a href="#">下一页</a></li> <%= check_box_tag 'membership[role_ids][]', role.id %>
<li><a href="#">...</a></li> <label ><%= h role %></label>
<li><a href="#">2</a></li> </li>
<li class="wlist_select" ><a href="#">1</a></li> <% end %>
<li><a href="#">上一页</a></li> </ul>
</ul> <div class="cl mb10"></div>
<div class="cl"></div> <a href="#" class="member_btn" onclick="$('#new_membership').submit();">
<ul class="rolebox mb10 mt10"> 新增成员
<li class="fb">角色: </li> </a>
<li ><input class="fl" type="checkbox" name="" checked=""> <label >Manager</label> </li> </div>
<li ><input type="checkbox" name="" > <label >Developer</label> </li> <% end%>
<li ><input type="checkbox" name="" > <label >Reporter</label> </li>
</ul>
<div class="cl"></div>
<a href="#" class="member_btn">新增成员</a>
</div>
</div><!-- 右边 end--> </div><!-- 右边 end-->

View File

@ -1,6 +1,6 @@
<% @members.each do |member| %> <% @members.each do |member| %>
<li > <li >
<%= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %> <%= link_to_user_header member.principal,false,:class => "w150 c_orange fl" %>
<span class="w150 fl"> <span class="w150 fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %> <%= h member.roles.sort.collect(&:to_s).join(', ') %>
</span> </span>

View File

@ -376,6 +376,9 @@ span.add_attachment {font-size: 80%;line-height: 2.5em;}
a:hover.link_file_board{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;} a:hover.link_file_board{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !important; padding-left:20px !important; color:#64bdd9 !important; } a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !important; padding-left:20px !important; color:#64bdd9 !important; }
#course_member_pagination_links{height: auto;float: left;}
#course_member_pagination_links li{margin-bottom: 5px;}
/* colorbox /* colorbox
*******************************************************************************/ *******************************************************************************/
/* /*