新建作业初始显示调整

This commit is contained in:
cxt 2016-11-18 18:37:41 +08:00
parent 20465ef281
commit 003c6a7551
5 changed files with 28 additions and 16 deletions

View File

@ -3728,7 +3728,7 @@ end
def homework_type_option def homework_type_option
type = [] type = []
option0 = [] option0 = []
option0 << "请选择" option0 << "请选择作业类型"
option0 << 0 option0 << 0
option1 = [] option1 = []
option1 << "普通作业" option1 << "普通作业"

View File

@ -12,7 +12,7 @@
$("#homework_end_time_span").text(""); $("#homework_end_time_span").text("");
$("#homework_course_id_span").text(""); $("#homework_course_id_span").text("");
$("#homework_editor").toggle(); $("#homework_editor").toggle();
$("#select_type_nitice").show(); //$("#select_type_nitice").show();
document.getElementById("homework_type_option").options[0].selected = true; document.getElementById("homework_type_option").options[0].selected = true;
} }

View File

@ -4,10 +4,17 @@
<%= javascript_include_tag 'homework','baiduTemplate' %> <%= javascript_include_tag 'homework','baiduTemplate' %>
<script type="text/javascript"> <script type="text/javascript">
function homework_name_focus(){
$('#homework_editor').show();
var type = $("#homework_type_option").children('option:selected').val();
if(type == "0"){
$('#select_type_nitice').show();
}
}
var first_click = true; var first_click = true;
$(function(){ $(function(){
$("#homework_type_option").on("change",function(){ $("#homework_type_option").on("change",function(){
$('#homework_editor').show(); //$('#homework_editor').show();
var type = $(this).children('option:selected').val(); var type = $(this).children('option:selected').val();
if(type == "0"){ if(type == "0"){
$('#select_type_nitice').show(); $('#select_type_nitice').show();
@ -192,22 +199,21 @@
<% if not_allow_select || group_pro %> <% if not_allow_select || group_pro %>
<input type="text" style="display: none" name="homework_type" value="<%=homework.homework_type %>"/> <input type="text" style="display: none" name="homework_type" value="<%=homework.homework_type %>"/>
<% end %> <% end %>
<span class="c_red fl ml10 mt5 <%= edit_mode ? 'none' : '' %>" id="select_type_nitice">发布作业,请先选择作业类型</span> <span class="c_red fl ml10 mt5 none" id="select_type_nitice">发布作业,请先选择作业类型</span>
</div>
<div class="cl"></div>
<div class="mt10">
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox fl w701 <%= edit_mode ? 'w701' : 'w603' %>" maxlength="255" onfocus="homework_name_focus();" onkeyup="regex_homework_name();" placeholder="发布作业,请先输入作业标题" value="<%= homework.name%>" >
<%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fr",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%> <%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fr",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
<% unless edit_mode %>
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
<% end %>
<div class="cl"></div>
<p id="homework_name_span" class="c_red mt5"></p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div id="homework_editor" class="mt10" style="display: <%= edit_mode ? 'block':'none'%>"> <div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
<div>
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox fl w701" maxlength="255" onkeyup="regex_homework_name();" placeholder="发布作业,请先输入作业标题" value="<%= homework.name%>" >
<% unless edit_mode %>
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
<% end %>
<div class="cl"></div>
<p id="homework_name_span" class="c_red mt5"></p>
</div>
<div class="cl"></div>
<div class="mt10"> <div class="mt10">
<label class="fl c_grey f14 mt5">截止日期:</label> <label class="fl c_grey f14 mt5">截止日期:</label>
<div class="calendar_div fl mr70"> <div class="calendar_div fl mr70">

View File

@ -766,6 +766,12 @@ function submit_homework(id){
//验证新建作业的名字 //验证新建作业的名字
function regex_homework_name() function regex_homework_name()
{ {
var type = $("#homework_type_option").children('option:selected').val();
if(type == "0"){
$('#select_type_nitice').show();
return false;
}
var name = $.trim($("#homework_name").val()); var name = $.trim($("#homework_name").val());
if(name=="") if(name=="")

View File

@ -548,7 +548,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
#worksDescription p {word-wrap:break-word;} #worksDescription p {word-wrap:break-word;}
/*20160907作业详情更改*/ /*20160907作业详情更改*/
.homework-type-option {border:1px solid #d9d9d9; width:98px; height:28px; color:#888; font-size:14px;} .homework-type-option {border:1px solid #d9d9d9; width:128px; height:28px; color:#888; font-size:14px;}
.homework-detail-tab {font-size:14px; color:#484848; overflow:hidden;} .homework-detail-tab {font-size:14px; color:#484848; overflow:hidden;}
.homework-detail-tab li {float:left; width:100px; text-align:center; padding:3px 0; border-bottom:2px solid #ddd;} .homework-detail-tab li {float:left; width:100px; text-align:center; padding:3px 0; border-bottom:2px solid #ddd;}
.homework-detail-tab li.selected {border-bottom:2px solid #f00;} .homework-detail-tab li.selected {border-bottom:2px solid #f00;}