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

118 lines
5.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<%= 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 mb10">
<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="project_new_input project_new_input_project_new" maxlength="100" placeholder="例如:团队协作方法与机制研究" onkeyup="regex_project_name();">
<p class="c_orange ml70" id="project_name_notice" style="display: none;">项目名称不能为空</p>
</li>
<div class="cl"></div>
<!-- <li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%#= l(:label_type_project)%>&nbsp;&nbsp;</label>
<%#= 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 mb10">
<label class="fl mr5">&nbsp;&nbsp;<%= l(:label_tags_project_description) %>&nbsp;&nbsp;:</label>
<%= f.kindeditor :description, :editor_id => 'project_create_editor',
:owner_id => @project.nil? ? 0: @project.id,
:owner_type => OwnerTypeHelper::PROJECT,
:width => '86%',
:height => 300,
:minHeight=> 300,
:class => 'courses_text ml5 fl',
:input_html => { :id => 'description',
:class => 'courses_text fl',
:maxlength => 5000 }
%>
<!--<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 ml70">
<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 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()
{
project_create_editor.sync();
if(regex_project_name())
{
$("#new_project").submit();
}
}
$(function(){
$('#project_new_type').change(function(){
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();//获取本页面其他标签的值
})
})
</script>