2015-03-07 10:52:20 +08:00
|
|
|
<div class="project_r_h">
|
2015-03-13 17:47:58 +08:00
|
|
|
<h2 class="project_h2"><%= l(:label_invite_join) %></h2>
|
2015-03-07 10:52:20 +08:00
|
|
|
</div>
|
2015-03-12 16:32:20 +08:00
|
|
|
<%#= render_flash_messages %>
|
2015-03-07 10:52:20 +08:00
|
|
|
<%
|
|
|
|
roles = Role.givable.all
|
|
|
|
if @project.project_type == Project::ProjectType_course
|
|
|
|
roles = roles[3..5]
|
|
|
|
else
|
|
|
|
roles = roles[0..2]
|
|
|
|
end
|
|
|
|
members = @project.member_principals.includes(:roles, :principal).all.sort
|
|
|
|
%>
|
|
|
|
|
2015-04-09 10:25:46 +08:00
|
|
|
<div class="box_main">
|
|
|
|
<h3 class="box_h3"><%= l(:label_invite_trustie_user) %></h3>
|
|
|
|
<% if roles.any? %>
|
|
|
|
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :method => :post}) do |f| %>
|
2015-03-12 15:46:24 +08:00
|
|
|
<div class="invi_search">
|
2015-03-12 16:32:20 +08:00
|
|
|
<input hidden="hidden" value="true" name="flag">
|
2015-04-09 20:46:48 +08:00
|
|
|
<input id="principal_search" class="invi_search_input fl" type="text" placeholder=<%= l(:label_invite_trustie_user_tips) %>>
|
2015-06-13 14:37:40 +08:00
|
|
|
<a class="invi_search_btn fl" onclick="observeSearchfield('principal_search', null, '<%= escape_javascript autocomplete_project_memberships_path(@project, :format => 'js',:flag => true)%> ')">搜索</a>
|
2015-03-12 15:46:24 +08:00
|
|
|
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js',:flag => true) }')" %>
|
|
|
|
<div class="cl"></div>
|
|
|
|
<div id="principals_for_new_member">
|
|
|
|
<%= render_project_members(@project) %>
|
|
|
|
</div>
|
|
|
|
<div class="cl"></div>
|
2015-04-09 10:25:46 +08:00
|
|
|
<ul class="mb5">
|
|
|
|
<li>
|
2015-03-12 15:46:24 +08:00
|
|
|
<%= l(:label_role_plural) %>:
|
|
|
|
</li>
|
|
|
|
<% roles.each do |role| %>
|
2015-04-09 10:25:46 +08:00
|
|
|
<li class="fl mr5">
|
2015-05-08 09:12:27 +08:00
|
|
|
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
|
|
|
<% if User.current.language == "zh" %>
|
|
|
|
<% if role.id == 3 %>
|
|
|
|
<label >管理人员</label>
|
|
|
|
<% elsif role.id == 4 %>
|
|
|
|
<label >开发人员</label>
|
|
|
|
<% else %>
|
|
|
|
<label >报告人员</label>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<label ><%= h role %></label>
|
|
|
|
<% end %>
|
2015-04-09 10:25:46 +08:00
|
|
|
</li>
|
2015-03-12 15:46:24 +08:00
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
<div class="cl mb10"></div>
|
2015-06-13 14:37:40 +08:00
|
|
|
<a href="javascript:void(0)" class="btn_free" onclick="submit_invite_members()">
|
2015-03-12 15:46:24 +08:00
|
|
|
<%= l(:label_invite_members)%>
|
|
|
|
</a>
|
|
|
|
</div>
|
2015-03-07 10:52:20 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function () {
|
|
|
|
var collection=$("#principals_for_new_member").children("#principals").children("label");
|
|
|
|
collection.css("text-overflow","ellipsis");
|
|
|
|
collection.css("white-space","nowrap");
|
|
|
|
collection.css("width","200px");
|
|
|
|
collection.css("overflow","hidden");
|
|
|
|
for(i=0;i<collection.length;i++){ //增加悬浮显示
|
|
|
|
var label=collection[i];
|
|
|
|
var text=$(label).text();
|
|
|
|
$(label).attr("title",text);
|
|
|
|
}
|
2015-06-13 14:37:40 +08:00
|
|
|
});
|
2015-05-22 11:20:41 +08:00
|
|
|
|
2015-06-13 14:37:40 +08:00
|
|
|
function nh_show_err_message(msg){
|
|
|
|
$("#RSide>.flash").remove();
|
|
|
|
$("#RSide").prepend('<div class="flash error" id="flash_error">'+msg+'</div>');
|
|
|
|
}
|
|
|
|
|
|
|
|
function submit_invite_members()
|
|
|
|
{
|
|
|
|
var user_ischeck=false;
|
|
|
|
$("input[name='membership[user_ids][]']").each(function(){
|
|
|
|
if($(this).prop('checked')){
|
|
|
|
user_ischeck=true;
|
2015-05-23 10:17:16 +08:00
|
|
|
}
|
2015-06-13 14:37:40 +08:00
|
|
|
});
|
|
|
|
var role_ischeck=false;
|
|
|
|
$("input[name='membership[role_ids][]']").each(function(){
|
|
|
|
if($(this).prop('checked')){
|
|
|
|
role_ischeck=true;
|
2015-05-22 11:20:41 +08:00
|
|
|
}
|
|
|
|
});
|
2015-06-13 14:37:40 +08:00
|
|
|
if(user_ischeck==false && role_ischeck==false){
|
|
|
|
nh_show_err_message('请选择用户和角色!');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(user_ischeck==false){
|
|
|
|
nh_show_err_message('请选择用户!');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(role_ischeck==false){
|
|
|
|
nh_show_err_message('请选择角色!');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$('#new_membership').submit();
|
|
|
|
}
|
2015-03-07 09:32:27 +08:00
|
|
|
</script>
|