私有作业请求分享时,强制要求写请求分享的说明文字

This commit is contained in:
cxt 2016-05-12 15:29:20 +08:00
parent ac5a9c87ac
commit d4c1f27533
1 changed files with 18 additions and 6 deletions

View File

@ -1,16 +1,28 @@
<div>
<div class="ni_con">
<%= form_tag(apply_for_homework_user_path(:id=>User.current.id,:homework_id=>homework.id), :multipart => true,:remote => true,:name=>"apply_for_homework_form",:id=>'apply_for_homework_form') do %>
<h2>请分享</h2>
<p>
请求说明(可选):
<textarea type="text" name="content" id="apply_content" class="apply_content mt10" style="outline:none;"></textarea>
<h2>请分享</h2>
<p style="color: #000;">
申请说明(必选):
<textarea type="text" name="content" id="apply_content" placeholder="请附言,以增加分享的成功机率。" class="apply_content mt10" style="outline:none;"></textarea>
</p>
<span class="c_red ml5 f12" style="display: none" id="apply_content_notice">为增加分享的成功机率,请务必填写申请说明。</span>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="$('#apply_for_homework_form').submit();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
<a href="javascript:" class="tijiao" onclick="submit_apply_homework();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
确&nbsp;&nbsp;定
</a>
</div>
<% end %>
</div>
</div>
</div>
<script type="application/javascript">
var first_click_apply = true;
function submit_apply_homework(){
if($.trim($("#apply_content").val()) == ""){
$("#apply_content_notice").show();
} else if(first_click_apply) {
first_click_apply = false;
$('#apply_for_homework_form').submit();
}
}
</script>