This commit is contained in:
suntao 2015-09-02 17:41:32 +08:00
commit b24909df8f
4 changed files with 53 additions and 11 deletions

View File

@ -1,16 +1,17 @@
<% content_for :header_tags do %> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<% end %>
<%= error_messages_for 'homework_common' %> <%= error_messages_for 'homework_common' %>
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_course_homework_new)%>
</h2>
</div>
<div class="hwork_new"> <div class="hwork_new">
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
<%= hidden_field_tag "course",@course.id%> <%= hidden_field_tag "course",@course.id%>
<%= render :partial => 'homework_common/new_homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%> <% end%>
</div><!--hwork_new end--> </div><!--hwork_new end-->
<div class="cl"></div> <div class="cl"></div>

View File

@ -9,6 +9,7 @@
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;} div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;} .ke-inline-block{display: none;}
.ke-container{height: 40px !important;}
</style> </style>
<% user_activities.each do |user_activity| <% user_activities.each do |user_activity|
if user_activities %> if user_activities %>

View File

@ -15,9 +15,12 @@
<div class="calendar_div fl"> <div class="calendar_div fl">
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" > <input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" >
<%= calendar_for('homework_end_time')%> <%= calendar_for('homework_end_time')%>
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<p id="homework_end_time_span" class="c_red mt5"></p>
<div class="cl"></div>
<div id="homework_editor" style="display: none"> <div id="homework_editor" style="display: none">
<div class="mt10"> <div class="mt10">
<% if edit_mode %> <% if edit_mode %>
@ -31,9 +34,9 @@
<div class="mt10"> <div class="mt10">
<!--<input type="text" class="InputBox W700 SearchIcon" placeholder="发送到课程" />-->
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w720",:value => "请选择发布作业的课程"} %> <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w720",:value => "请选择发布作业的课程"} %>
</div> </div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<div class="cl"></div> <div class="cl"></div>
<div id="homework_attachments"> <div id="homework_attachments">

View File

@ -62,8 +62,15 @@ function submit_homework(id)
{ {
$("#homework_name").focus(); $("#homework_name").focus();
} }
else else if(!regex_homework_end_time())
{ {
$("#homework_end_time").focus();
}
else if(!regex_course_id())
{
$("#course_id").focus();
}
else{
homework_description_editor.sync(); homework_description_editor.sync();
$("#"+id).submit(); $("#"+id).submit();
} }
@ -85,6 +92,36 @@ function regex_homework_name()
return true; return true;
} }
} }
//验证截止时间
function regex_homework_end_time()
{
var name = $.trim($("#homework_end_time").val());
if(name=="")
{
$("#homework_end_time_span").text("截止时间不能为空");
return false;
}
else
{
$("#homework_end_time_span").text("");
return true;
}
}
//验证发送到课程
function regex_course_id(){
var course_id = $("#course_id").val();
if(course_id == -1)
{
$("#homework_course_id_span").text("发布课程不能为空");
return false;
}
else
{
$("#homework_course_id_span").text("");
return true;
}
}
//老师导入作业时查询作业 //老师导入作业时查询作业
function search_homework_by_name(url){ function search_homework_by_name(url){