socialforge/app/views/files/_hidden_file.html.erb

64 lines
2.6 KiB
Plaintext
Raw Normal View History

<script src="/javascripts/jquery.datetimepicker.js" type="text/javascript"></script>
<div id="muban_popup_box" style="width:300px;">
<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>
2016-02-23 11:04:19 +08:00
</div>
<div class="muban_popup_con clear mt15" style="margin-left: 47px;">
<%= 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) %>">
<%#= calendar_for('attachment_publish_time')%>
</div>
<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_grey mr5" onclick="$('#datetimepicker_mask').datetimepicker('destroy');hideModal();">取消</a>
<% end %>
2016-02-23 11:04:19 +08:00
</div>
<div class="cl"></div>
</div>
2016-02-23 11:04:19 +08:00
<script>
function regex_publish_time()
{
var myDate = new Date();
if($.trim($("#datetimepicker_mask").val()) == "")
2016-02-23 11:04:19 +08:00
{
$("#publish_time_notice").text("发布时间不能为空");
2016-02-23 11:04:19 +08:00
return false;
} else{
var publish_time = Date.parse($("#datetimepicker_mask").val());
if(Date.parse(formate_time(myDate)) > publish_time)
2016-02-23 11:04:19 +08:00
{
$("#publish_time_notice").text("发布时间不能小于当前时间");
2016-02-23 11:04:19 +08:00
return false;
}
else
{
$("#publish_time_notice").text("");
return true;
}
}
}
function submit_republish_file()
{
if(regex_publish_time()) {
$('#submit_file').parent().submit();
2016-02-23 11:04:19 +08:00
}
}
$(function(){
$('#datetimepicker_mask').datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
});
2016-02-23 11:04:19 +08:00
});
</script>