trustieplus/app/views/exercise/_edit_head.html.erb

32 lines
1.5 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.

<%= form_for(@exercise, :html => {:multipart => true, :id => "exercise_head_form"}, :remote => true) do |f| %>
<div class="ml15 mr15 mb15">
<input class="panel-box-sizing panel-form-width-100" name="exercise[exercise_name]" maxlength="100" id="exercise_name" value="<%= @exercise.try(:exercise_name) %>" placeholder="试卷标题" style="text-align: center;"/>
</div>
<div class="ml15 mr15">
<textarea id="mustBe" name="exercise[exercise_description]" class="panel-box-sizing panel-form-width-100" placeholder="试卷须知共有选择、填空、简答3种题型其中选择题包括单选题和多选题;您可以在此处填写本次试卷答题的相关说明"><%= @exercise.try(:exercise_description) %></textarea>
</div>
<p class="fr">
<a href="javascript:void(0)" onclick="ex_head_submit($(this));" class="fr task-btn mr15 task-btn-orange">保存</a>
<a href="javascript:void(0)" onclick="ex_head_cancel();" class="fr task-btn mr10">取消</a>
</p>
<% end %>
<script>
$(function(){
$("#exercise_head_edit").on("keydown", "input[name='exercise[exercise_name]']", function(event){
var code;
if (!event) {
event = window.event; //针对ie浏览器
code = event.keyCode;
}
else {
code = event.keyCode;
}
if(code == 13) {
event.preventDefault();
return false;
}
});
});
</script>