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

113 lines
4.8 KiB
Plaintext
Raw Normal View History

<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<%= error_messages_for 'project' %>
<div class="project_r_h02">
<h2 class="project_h2"><%= l(:label_project_new)%></h2>
</div>
<div class="hwork_new">
<ul>
<%= labelled_form_for @project 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_projects_new_name)%>&nbsp;&nbsp;</label>
<input type="text" name="project[name]" id="project_name" class="courses_input" maxlength="100" placeholder="例如:团队协作方法与机制研究" onkeyup="regex_project_name();">
<span class="c_red" id="project_name_notice" style="display: none;">项目名称不能为空</span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_type_project)%>&nbsp;&nbsp;</label>
2015-09-24 11:44:02 +08:00
<%= select_tag :project_new_type, options_for_select([["开发模式", "1"], ["研讨模式", "2"], ["圈子模式", "3"]]) %>
<span class=" ml15 c_orange" id = "project_newtype_select"><%=l(:label_type_des_development) %></span>
</li>
<div class="cl"></div>
<li class="ml45">
<label class="fl" >&nbsp;&nbsp;<%= l(:label_tags_project_description) %>&nbsp;&nbsp;</label>
<textarea name="project[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;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
<% unless @project.identifier_frozen? %>
<em class="info">
<%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_project_identifier_info).html_safe %>
</em>
<% end %></p>
</li>
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input id="project_is_public" name="project[is_public]" type="checkbox" value="1" checked="checked">
<span class="c_grey">(打钩为公开项目,不打钩为私有项目;私有项目仅项目成员可见。)</span>
<div class="cl"></div>
</li>
<li>
<p style="display:none;">
<%= f.text_field :project_type, :value => 0 %>
</p>
</li>
<li>
<%= render :partial => 'form_new', :locals => { :f => f } %>
</li>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_project();" >提交</a>
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
<div class="cl"></div>
</li>
<% end%>
</ul>
</div><!--talknew end-->
<div class="cl"></div>
<% html_title(l(:label_project_new)) -%>
<script>
//////////////////////////////////////////////////////////////
//新建项目
//验证项目名称
function regex_project_name()
{
var name = $.trim($("#project_name").val());
if(name.length == 0)
{
$("#project_name_notice").show();
return false;
}
else
{
$("#project_name_notice").hide();
return true;
}
}
//提交新建项目
function submit_new_project()
{
if(regex_project_name())
{
$("#new_project").submit();
}
}
2015-09-24 11:44:02 +08:00
$(function(){
$('#project_new_type').change(function(){
2015-09-24 11:44:02 +08:00
var type = $('#project_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();//获取本页面其他标签的值
})
2015-09-24 11:44:02 +08:00
})
</script>