班级资源延期发布的输入框不应该允许用户手动编辑

This commit is contained in:
cxt 2017-03-06 15:45:25 +08:00
parent 686cf8b926
commit f0b7846453
4 changed files with 41 additions and 9 deletions

View File

@ -1,23 +1,24 @@
<script src="/javascripts/jquery.datetimepicker.js" type="text/javascript"></script>
<div id="muban_popup_box" style="width:300px;">
<div id="muban_popup_box" style="width:340px;">
<div class="muban_popup_top">
<h3 class="fl">发布设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="$('#datetimepicker_mask').datetimepicker('destroy');"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear mt15" style="margin-left: 47px;">
<div class="muban_popup_con clear mt15" style="margin-left: 37px;">
<%= form_tag(republish_file_course_file_path(@course,@file), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<div class="mb10">
<label class="fl c_dark f14" style="margin-top: 4px;">延期发布:</label>
<div class="calendar_div fl">
<input type="text" name="publish_time" id="datetimepicker_mask" placeholder="发布时间" style="width: 130px;" class="InputBox fl calendar_input" value="<%=format_time(@file.publish_time) %>">
<input type="text" name="publish_time" id="datetimepicker_mask" readonly="readonly" placeholder="发布时间" style="width: 130px;" class="InputBox fl calendar_input" value="<%=format_time(@file.publish_time) %>">
<%#= calendar_for('attachment_publish_time')%>
</div>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_publish_time();">清空</a>
<span class="fl c_red" style="margin-top: 4px;" id="publish_time_notice"></span>
<div class="cl"></div>
</div>
<a href="javascript:void(0);" class="fr sy_btn_blue" style="margin-right: 95px;" id="submit_file" onclick="submit_republish_file();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_blue" style="margin-right: 115px;" id="submit_file" onclick="submit_republish_file();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="$('#datetimepicker_mask').datetimepicker('destroy');hideModal();">取消</a>
<% end %>
</div>
@ -51,6 +52,11 @@
$('#submit_file').parent().submit();
}
}
function reset_publish_time(){
$("#datetimepicker_mask").val('');
$("#reset_time").hide();
}
$(function(){
$('#datetimepicker_mask').datetimepicker({
allowBlank:true,
@ -58,7 +64,13 @@
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
validateOnBlur:false,
onSelectDate:function() {
$("#reset_time").show();
},
onSelectTime:function() {
$("#reset_time").show();
}
});
});
</script>

View File

@ -52,6 +52,7 @@
<div class="calendar_div fl ml10">
<input type="text" name="publish_time" id="datetimepicker_mask" placeholder="发布时间(可选)" style="width: 130px;" class="InputBox fl calendar_input" readonly="readonly">
</div>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_publish_time();">清空</a>
<div class="cl"></div>
<span class="c_red f12" style="margin-top: 4px;" id="publish_time_notice"></span>
<div class="cl"></div>
@ -109,6 +110,10 @@
$('#submit_resource').parent().submit();
<% end %>
}
function reset_publish_time(){
$("#datetimepicker_mask").val('');
$("#reset_time").hide();
}
$(function(){
$('#datetimepicker_mask').datetimepicker({
allowBlank:true,
@ -116,7 +121,13 @@
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
validateOnBlur:false,
onSelectDate:function() {
$("#reset_time").show();
},
onSelectTime:function() {
$("#reset_time").show();
}
});
});
</script>

View File

@ -1,2 +1,2 @@
var htmlvalue = '<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>';
pop_box_new(htmlvalue, 300, 140);
pop_box_new(htmlvalue, 340, 140);

View File

@ -68,7 +68,15 @@
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
validateOnBlur:false,
onSelectDate:function() {
$("#reset_time").show();
$("#homework_publish_time_div").show();
},
onSelectTime:function() {
$("#reset_time").show();
$("#homework_publish_time_div").show();
}
});
<% end %>
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
@ -94,6 +102,7 @@
function reset_end_time(){
$("#homework_end_time").val('');
$("#homework_publish_time").val('');
$("#reset_time").hide();
$("#homework_publish_time_div").hide();
}
@ -280,7 +289,7 @@
<%# end %>
</div>
<% if !edit_mode || (edit_mode && homework.homework_detail_manual.comment_status.to_i < 1) %>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" onclick="reset_end_time();">清空</a>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_end_time();">清空</a>
<% end %>
<div class="fl <%= homework.publish_time.nil? ? 'none' : '' %> ml50" id="homework_publish_time_div">
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布时间(可选):</label>