socialforge/app/views/shixuns/_form.html.erb

78 lines
3.0 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.

<div class="hwork_new">
<ul>
<%= form_for(@shixun) do |f| %>
<% if @shixun.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@shixun.errors.count, "error") %> prohibited this product from being saved:</h2>
<ul>
<% @shixun.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;实训名称&nbsp;&nbsp;:</label>
<%= f.text_field :name, :class => "project_new_input project_new_input_project_new", :placeholder => "例如:团队协作方法与机制研究", :onkeyup => "regex_project_name();" %>
<p class="c_orange ml70" id="project_name_notice" style="display: none;">实训名称不能为空</p>
</li>
<li class="ml45 mb10">
<label class="fl mr5">&nbsp;&nbsp;预备知识&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 }
%>
<div class="cl"></div>
</li>
<li class="mb5 ml70">
<label >&nbsp;公开&nbsp;</label>
<%= f.text_field :is_public, :id => "project_is_public", :name => "shixun[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>
<div class="cl"></div>
<script>
//////////////////////////////////////////////////////////////
//新建项目
//验证项目名称
function regex_project_name()
{
var name = $.trim($("#shixun_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_shixun").submit();
}
}
</script>