2015-11-03 11:19:38 +08:00
|
|
|
|
|
|
|
|
|
<% @nav_dispaly_organization_label = 1
|
|
|
|
|
@nav_dispaly_forum_label = 1 %>
|
|
|
|
|
<%= error_messages_for 'organization' %>
|
|
|
|
|
<div class="organization_r_h02">
|
|
|
|
|
<h2 class="organization_h2"><%= l(:label_organization_new)%></h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hwork_new">
|
|
|
|
|
<ul>
|
|
|
|
|
<%= labelled_form_for @organization do |f| %>
|
|
|
|
|
<li class="ml45">
|
|
|
|
|
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
|
|
|
|
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
|
|
|
|
<label><span class="c_red">*</span> <%= l(:label_organization_name)%> :</label>
|
2015-11-05 17:57:07 +08:00
|
|
|
|
<input type="text" name="organization[name]" id="organization_name" class="courses_input" maxlength="100" onblur="check_uniq(this);" onkeyup="regex_organization_name();">
|
|
|
|
|
<span id="organization_name_notice" ></span>
|
2015-11-03 11:19:38 +08:00
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<li class="ml45">
|
|
|
|
|
<label class="fl" > <%= l(:label_organization_description) %> :</label>
|
|
|
|
|
<textarea name="organization[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<p style="display: none" >
|
|
|
|
|
<%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :maxlength => Project::IDENTIFIER_MAX_LENGTH,
|
|
|
|
|
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
|
|
|
|
<li class=" mb5 ml80">
|
|
|
|
|
<label >公开 :</label>
|
|
|
|
|
<input id="organization_is_public" name="organization[is_public]" type="checkbox" value="1" checked="checked">
|
|
|
|
|
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。)</span>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<li class=" ml90" >
|
|
|
|
|
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_organization();" >提交</a>
|
|
|
|
|
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<% end%>
|
|
|
|
|
</ul>
|
|
|
|
|
</div><!--talknew end-->
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
<% html_title(l(:label_organization_new)) -%>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
//新建项目
|
|
|
|
|
//验证项目名称
|
|
|
|
|
function regex_organization_name()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#organization_name").val());
|
|
|
|
|
if(name.length == 0)
|
|
|
|
|
{
|
2015-11-05 17:57:07 +08:00
|
|
|
|
$("#organization_name_notice").html('<span class="c_red">名字不能为空<span>').show();
|
2015-11-03 11:19:38 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-11-05 17:57:07 +08:00
|
|
|
|
$("#organization_name_notice").html('').hide();
|
2015-11-03 11:19:38 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-05 17:57:07 +08:00
|
|
|
|
var $checkName = false;
|
|
|
|
|
|
|
|
|
|
function check_uniq(dom){
|
|
|
|
|
if($("#organization_name").val().trim() == ""){
|
|
|
|
|
$("#organization_name_notice").html('<span class="c_red">名字不能为空<span>').show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$.get(
|
|
|
|
|
'<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-03 11:19:38 +08:00
|
|
|
|
//提交新建项目
|
|
|
|
|
function submit_new_organization()
|
|
|
|
|
{
|
2015-11-05 17:57:07 +08:00
|
|
|
|
$.get(
|
|
|
|
|
'<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()
|
|
|
|
|
)
|
|
|
|
|
if(regex_organization_name() && $checkName)
|
2015-11-03 11:19:38 +08:00
|
|
|
|
{
|
|
|
|
|
$("#new_organization").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
|
$('#organization_new_type').change(function(){
|
|
|
|
|
var type = $('#organization_new_type').val();
|
|
|
|
|
if(type == '1'){
|
|
|
|
|
$(this).next().html("<%= l(:label_type_des_development)%>");
|
|
|
|
|
}
|
|
|
|
|
else if(type == '2'){
|
|
|
|
|
$(this).next().html("<%= l(:label_type_des_research)%>");
|
|
|
|
|
}
|
|
|
|
|
else if(type == '3'){
|
|
|
|
|
$(this).next().html("<%= l(:label_type_des_friend)%>");
|
|
|
|
|
}
|
|
|
|
|
// var p1=$(this).children('option:selected').val("研讨模式:面向小组研究,支持任务分工、论坛交流、资源分享等。");//这就是selected的值
|
|
|
|
|
// var p2=$('#param2').val();//获取本页面其他标签的值
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|