完成项目配置-成员模块

This commit is contained in:
huang 2015-04-14 11:47:47 +08:00
parent b3c3693d72
commit b98a67f50d
4 changed files with 69 additions and 71 deletions

View File

@ -38,7 +38,7 @@ module MembersHelper
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q],:flag => true, :format => 'js')), :remote => true
}
s + content_tag('ul', links,:class => 'wlist', :style =>"float:left;margin-top:0px;")
s + content_tag('ul', links,:class => 'wlist', :id => "course_member_pagination_links" )
end
# add by nwb
@ -55,6 +55,19 @@ module MembersHelper
s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links")
end
# 项目配置中添加成员列表
def render_principals_for_new_project_members(project)
scope = Principal.active.sorted.not_member_of(project).like(params[:q])
principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true) {|text, parameters, options|
link_to text, appliedproject_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
}
s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links")
end
# 当前申请加入的成员名单
def render_principals_for_applied_members(project)

View File

@ -164,7 +164,15 @@
</ul>
<% end %><!--end-->
<!--menu 左侧工具栏 -->
<%= render :partial => 'layouts/base_development_group', :locals => {:project => @project}%> <!-- end -->
<!--project_new_type: 1为开发组2为科研组3为朋友圈子-->
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
<%= render :partial => 'layouts/base_development_group', :locals => {:project => @project}%>
<% elsif @project.project_new_type == 2 %>
<%= render :partial => 'layouts/base_research_team', :locals => {:project => @project}%>
<% else %>
<%= render :partial => 'layouts/base_friend_group', :locals => {:project => @project}%>
<% end %>
<!-- end -->
</div><!--项目侧导航 end-->
<div class="cl"></div>
@ -211,13 +219,13 @@
<div id="light" class="white_content02">
<!-- 这里写需弹出框的HTML代码 -->
<% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%>
<div ><a href="javascript:void(0)" onClick="close_window('development_group');" class="box_close" id="close_light"></a></div>
<div ><a href="javascript:void(0)" onClick="close_window('<%= text%>');" class="box_close" id="close_light"></a></div>
<div class=" mt10">
<h3 class="mb10 c_blue">请选择项目类型:</h3>
<ul class="mb10" id="project_type">
<li><input type="radio" name="project_type" checked="" id="development_group"/><label >&nbsp;&nbsp;开发组</label></li>
<li><input type="radio" name="project_type" id="research_group"/><label >&nbsp;&nbsp;科研组</label></li>
<li><input type="radio" name="project_type" id="friend_organization"/><label >&nbsp;&nbsp;朋友圈</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 1 ? 'checked' : ''%> id="development_group"/><label >&nbsp;&nbsp;开发组</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 2 ? 'checked' : ''%> id="research_group"/><label >&nbsp;&nbsp;科研组</label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label >&nbsp;&nbsp;朋友圈</label></li>
</ul>
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>

View File

@ -2,7 +2,7 @@
<% if @flag == "true"%>
$('#principals_for_new_member').html('<%= escape_javascript(render_project_members(@project)) %>');
<% else%>
$('#principals_for_new_member').html('<%= escape_javascript(render_principals_for_new_members(@project)) %>');
$('#principals_for_new_member').html('<%= escape_javascript(render_project_members(@project)) %>');
<% end%>
<% elsif @course%>
var checked = $("#principals input:checked").size();

View File

@ -25,7 +25,7 @@
) do |f| %>
<% roles.each do |role| %>
<ul style="text-align: left;" class="ml20">
<%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<label ><%= h role %></label>
</ul>
@ -51,8 +51,6 @@
<%# end%>
</li>
<% end%>
</li>
</ul>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
@ -60,58 +58,37 @@
</div><!-- 左边-->
<div class="members_right">
<div class="members_jion">
<p class="c_blue mb10 fb">+申请加入</p>
<ul class="mb10">
<li><input name="membership[user_ids][]" type="checkbox" value="3172"> <a href="/users/3172" class="c_blue">JackWu (巫 荣杰)</a></li>
<li><input name="membership[user_ids][]" type="checkbox" value="3172"> <a href="/users/3172" class="c_blue">JackWu (巫 荣杰)</a></li>
<li><input name="membership[user_ids][]" type="checkbox" value="3172"> <a href="/users/3172" class="c_blue">JackWu (巫 荣杰)</a></li>
</ul>
<ul class="mb10">
<li>角色:</li>
<li><input type="checkbox" /><label>Manager</label></li>
<li><input type="checkbox" /><label>Developer</label></li>
<li><input type="checkbox" /><label>Reporter</label></li>
</ul>
<div class="cl"></div>
<a href="javascript:void(0)" class="blue_btn fl" >批准</a><a href="javascript:void(0)" class="grey_btn fl ml10" >拒绝</a>
</div><!--members_jion end-->
<div class="cl"></div>
<div class="members_add">
<p class="c_blue fb mt10 mb5">添加成员</p>
<p class="c_blue fb mt10 mb5"><%= l(:label_member_new) %></p>
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<div class="member_search">
<input class="member_search_input fl" type="text" name="" value="输入用户名称搜索好友"><a class="invi_search_btn fl c_white" >搜索</a>
<input hidden="hidden" value="true" name="flag">
<input id="principal_search" class="member_search_input fl" type="text" placeholder="请输入用户名称来搜索好友">
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
<div class="cl"></div>
<ul class="mb5">
<li><input type="checkbox" name="" checked=""> <label >suntao</label> </li>
<li><input type="checkbox" name="" > <label >suntaoalibb</label> </li>
<li><input type="checkbox" name="" > <label >用户名称</label> </li>
<li><input type="checkbox" name="" > <label >suntao</label> </li>
<li><input type="checkbox" name="" checked=""> <label >suntao</label> </li>
<li><input type="checkbox" name="" > <label >suntaoalibb</label> </li>
<li><input type="checkbox" name="" > <label >用户名称</label> </li>
<li><input type="checkbox" name="" > <label >suntao</label> </li>
<li><input type="checkbox" name="" > <label >用户名称</label> </li>
<li><input type="checkbox" name="" > <label >suntao</label> </li>
</ul>
<div class="cl"></div>
<ul class="wlist mr40" >
<li><a href="javascript:void(0)">下一页</a></li>
<li><a href="javascript:void(0)">...</a></li>
<li><a href="javascript:void(0)">2</a></li>
<li class="wlist_select" ><a href="javascript:void(0)">1</a></li>
<li><a href="javascript:void(0)">上一页</a></li>
</ul>
<div id="principals_for_new_member">
<%= render_principals_for_new_project_members(@project) %>
</div>
<div class="cl"></div>
<ul class="rolebox mb10 mt10">
<li class="fb">角色: </li>
<li ><input class="fl" type="checkbox" name="" checked=""> <label >TeachingAsistant</label> </li>
<li ><input type="checkbox" name="" > <label >Teacher</label> </li>
<li ><input type="checkbox" name="" > <label >Student</label> </li>
<li class="fb">
<%= l(:label_role_plural) %>
</li>
<% roles.each do |role| %>
<li>
<%= check_box_tag 'membership[role_ids][]', role.id %>
<label ><%= h role %></label>
</li>
<% end %>
</ul>
<div class="cl"></div>
<a href="javascript:void(0)" class=" blue_btn">新增成员</a>
</div>
<div class="cl mb10"></div>
<a href="javascript:void(0)" class="member_btn" onclick="$('#new_membership').submit();">
新增成员
</a>
</div>
<% end%>
</div><!-- 右边 end-->