socialforge/app/views/organizations/new.html.erb

111 lines
4.3 KiB
Plaintext
Raw Normal View History

<% @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>&nbsp;<%= l(:label_organization_name)%>&nbsp;&nbsp;</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>
</li>
<div class="cl"></div>
<div class="cl"></div>
<li class="ml45">
<label class="fl" >&nbsp;&nbsp;<%= l(:label_organization_description) %>&nbsp;&nbsp;</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 >公开&nbsp;&nbsp;</label>
<input id="organization_is_public" name="organization[is_public]" type="checkbox" value="1" checked="checked">
2015-11-13 19:10:44 +08:00
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)</span>
<div class="cl"></div>
</li>
2015-11-20 14:30:54 +08:00
<li class=" ml125" >
<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>
//////////////////////////////////////////////////////////////
2015-11-12 20:57:41 +08:00
//新建组织
//验证组织名称
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();
return false;
}
else
{
2015-11-05 17:57:07 +08:00
$("#organization_name_notice").html('').hide();
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()
)
}
//提交新建项目
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)
{
$("#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>