新建班级、新建课程的提示

This commit is contained in:
cxt 2016-10-28 18:36:35 +08:00
parent 9f702bae1e
commit 557f5d4e26
3 changed files with 10 additions and 3 deletions

View File

@ -12,12 +12,15 @@
<span><%=@syllabus.title %></span> <span><%=@syllabus.title %></span>
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" /> <input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
<% end %> <% end %>
<div class="cl"></div>
<span class="c_red ml80" id="new_course_syllabus_notice" style="display: none;">请先选择课程</span>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="mt10 ml45"> <li class="mt10 ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="new_course_name" class="courses_input w289" maxlength="100" placeholder="例如计算机系2016秋季A班" onkeyup="regex_course_name('new');"> <input type="text" name="course[name]" id="new_course_name" class="courses_input w289" maxlength="100" placeholder="例如计算机系2016秋季A班" onkeyup="regex_course_name('new');">
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span> <div class="cl"></div>
<span class="c_red ml80" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ml125 mb5 fontGrey3"><span class="success-icon mr25">正确示例计算机系2016秋季A班</span></li> <li class="ml125 mb5 fontGrey3"><span class="success-icon mr25">正确示例计算机系2016秋季A班</span></li>

View File

@ -6,8 +6,9 @@
<%= labelled_form_for @syllabus do |f| %> <%= labelled_form_for @syllabus do |f| %>
<li class="ml45"> <li class="ml45">
<label><span class="c_red">*</span>&nbsp;课程名称&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;课程名称&nbsp;&nbsp;</label>
<input type="text" name="title" id="new_syllabus_name" class="name_input" placeholder="例如:软件工程" maxlength="100" onkeyup="regex_syllabus_name();"> <input type="text" name="title" id="new_syllabus_name" class="name_input" placeholder="例如:软件工程" maxlength="100" onkeyup="regex_syllabus_name();">
<span class="c_red" id="new_syllabus_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span> <div class="cl"></div>
<span class="c_red ml80" id="new_syllabus_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ml125 fontGrey3"><span class="success-icon mr25">正确示例:软件工程</span><span class="error-icon">错误示例2016软件工程</span></li> <li class="ml125 fontGrey3"><span class="success-icon mr25">正确示例:软件工程</span><span class="error-icon">错误示例2016软件工程</span></li>

View File

@ -189,11 +189,14 @@ function regex_syllabus_option(str) {
var obj = document.getElementById(str + "_syllabus_id"); var obj = document.getElementById(str + "_syllabus_id");
var syllabus = obj.options[obj.selectedIndex]; var syllabus = obj.options[obj.selectedIndex];
if(parseInt(syllabus.value) == 0) { if(parseInt(syllabus.value) == 0) {
$("#"+str+"_course_syllabus_notice").show();
return false; return false;
} else{ } else{
$("#"+str+"_course_syllabus_notice").hide();
return true; return true;
} }
} else { } else {
$("#"+str+"_course_syllabus_notice").hide();
return true; return true;
} }
} }